Questions tagged [nmf]

Non-negative matrix factorization (NMF or NNMF), also non-negative matrix approximation is a group of algorithms in multivariate analysis and linear algebra where a matrix V is factorized into (usually) two matrices W and H, with the property that all three matrices have no negative elements.

is a technique to approximate a matrix like V = WH. Here dimension of V,W,H can be respectively m*n, m*p, p*n where p << n usually. Now W can be thought as a weight matrix for hidden variables. As p can be very small this can also be viewed as a dimensionality reduction technique like .

is widely applicable in most real world cases where V can't have negative values like , , recommender system etc. General applications of include:

For this tag users should provide mathematical clarity as it is an advanced topic along with information about application to specific case.

Useful links:

77 questions
0
votes
1 answer

model.fit_transform valueerror expected 2D array, got scalar array instead

I am trying to decompose a spectrum of a mixture of compounds into its main components ("pure compounds") by means of non-negative matrix factorization. mixed_spectrum is a np array expressing the spectrum of my compounds mixture, and W_init…
gionti
  • 96
  • 5
0
votes
0 answers

NMF topics are made without any document assigned to the topic

I have made a NMF topic model with the gensim package in Python. However, the model made some topics without any document being assigned to the topic. I have read the NMF paper but it is still unclear for me how this is possible. Has anyone an idea…
0
votes
0 answers

Can you take average of two document-topic matrices for example one is produced by LDA and the other one is produced by NMF?

I'd like to use two models for topic modelling. Can it be possible that I get the average of two different document-topic matrices to have a new document-topic matrix? If not is there a way to use two different topic modelling method such as LDA and…
chato
  • 11
  • 1
0
votes
0 answers

Using the NMF method for hashtag recommendation in collaborative filter recommendation systems

I want to use the NMF method to recommend hashtags in a collaborative filtering, I have written the following code and created the NMF matrix from the (user-hashtag) matrix. But for the next part that should be recommended, I don't know what to do!…
zahra
  • 1
  • 1
0
votes
1 answer

In R, do correlation between a column of a data frame between all columns in another data frame?

I am trying to determine the correlation between meta genes from running NMF with clinical metadata. As such, I have two data frames to work with. The first being the h matrix with Metagene expression for each patient. The other data frame being the…
0
votes
0 answers

why does Non negative matrix Factorization decompose a spectrogram into time and frequency component?

When i compute NMF over a spectrogram (mag of stft of a signal ) i obtain W,H = NMF(MyStft,r) # where r=2 is the rank W and H will respectively contain the spectrum and the temporal information. My question is why? whats the logic behind…
0
votes
0 answers

Reshape W to plot component images: sklearn NMF output from decomposition of 3D numpy array

I need help to plot the output of sklearn decomposition.NMF. The original data is an image stack (3D numpy array) with dimensions z,y,x = 46,974,1414. data is reshaped for input to the sklearn NMF decomposition. data_r=data.reshape(-1,z), so…
0
votes
0 answers

ValueError: array must not contain infs or NaNs with NMF and TF-IDF in Python

I'm trying to estimate topics through NMF over a TF-IDF decomposition.However when I run the following line: nmf = NMF(n_components = dimension) nmf_array = nmf.fit_transform(x_tfidf) I got this error: ValueError: array must not contain infs or…
0
votes
0 answers

Can we save the lda model with old data and use trained model for new data?

I have 100 sentences in a excel sheet.. I need to generate topics from this sentences. For that im using LDA model. I have trained the model, fit transform the model and got the optimum number of topics from 100 sentences. Now wrt optimum number of…
End user
  • 77
  • 3
0
votes
0 answers

sklearn NMF, the inference weight values are changed whenever I try it again

Whenever I'm doing inference (nmf_model.transform(matrix)) The weight value of each topics for documents are changed. from sklearn.decomposition import NMF nmf_model = NMF( n_components = 7, init = 'nndsvda', solver = 'mu', beta_loss =…
Grace.K
  • 9
  • 2
0
votes
1 answer

octave nmf_bpas error: vertical dimensions mismatch (8x1 vs 1x400)

I have a problem with non-negative matrix factorization in octave. I try to estimate synergies from Emg-data, but octave only lets me do this for two or more synergies, but not for one. I was able to reproduce the problem with the following…
pauk98
  • 3
  • 2
0
votes
2 answers

How to select optimal number of components for NMF in python sklearn?

There is not a built-in function in python's sklearn to do this. In my research I found out that a "precision score" err(components) can be calculated via The optimal number of components will have the minimum err(c). Given the below test code, how…
RTrain3k
  • 845
  • 1
  • 13
  • 27
0
votes
1 answer

Number of keywords in text cluster

I'm working in a decently-sized data set, and wish to identify what # topics make sense. I used both NMF and LDA (sklearn implementation), but the key question: what is a suitable measure for success. Visually I have in many topics only a few…
user9165100
  • 371
  • 3
  • 11
0
votes
1 answer

How to evaluate NMF Topic Modeling by using Confusion Matrix?

I am doing topic modeling using NMF model. I want to evaluate its performance by confusion matrix or if there are other better methods to evaluate NMF, I am ok with that also. I tried to find tutorials or other resources on internet but couldn't…
Piyush Ghasiya
  • 515
  • 7
  • 25
0
votes
1 answer

What is n_components in NMF(Non-Negative Matrix Factorization) in sklearn?

What is n_components in sklearn.NMF? nmf = NMF(n_components=2, init='random', random_state=0) nmf.fit(V)