0

I am trying to perform cross-validation on NMF to find the best parameters to use. I tried using the sklearn cross-validation but get an error that states the NMF does not have a scoring method. Could anyone here help me with that? Thank you all

ranaz
  • 97
  • 1
  • 10
  • See this example: https://scikit-learn.org/stable/auto_examples/compose/plot_compare_reduction.html#sphx-glr-auto-examples-compose-plot-compare-reduction-py – Vivek Kumar Dec 13 '18 at 09:11

1 Answers1

2

A property of nmf is that it is an unsupervised (machine learning) method. This generally means that there is no labeled data that can serve as a 'golden standard'. In case of NMF you can not define what is the 'desired' outcome beforehand.

The cross validation in sklearn is designed for supervised machine learning, in which you have labeled data by definition.

What cross validation does, it holds out sets of labeled data, then trains a model on the data that is leftover and evaluates this model on the held out set. For this evaluation any metric can be used. For example: accuracy, precision, recall and F-measure, and for computing these measures it needs labeled data.

Ottotos
  • 633
  • 5
  • 14
  • Still you can hold out data - project and see the accuracy of reconstruction. Of course as then umber of components increase the accuracy improves ! – Areza Nov 05 '19 at 09:38