sklearn nmf - question about its use
The API allows two types of operations: Learn and transform a matrix under analysis. Or alternatively, learn the factorization on one matrix (myfile / X) and then apply the same transformation on a new matrix (X_new), having the same number of columns (but potentially different number of rows).

Think of it as learning the basis transformation on one set of input data (.fit method) and then apply the same basis transformation on new set of data (.transform method).

If you are interested in transforming the same matrix (myfile in your case), use only the fit_transform method instead of transform.