2013/2/8 Vinay B, <vybe3...@gmail.com>: > Hi, > I tried again . I feel there's something wrong I'm doing with my code so > far. In any case, the print loop I added was > > doc_idx = 0 > for cluster_doc_filename in file_names: > # predicted_cluster = km.predict(cluster_doc_filename) > predicted_cluster = km.predict(doc_idx) #passing in an > int index > print cluster_doc_filename + " " + str(predicted_cluster) > doc_idx+=1 > > Resulting in > > > Traceback (most recent call last): > File > "/home/vinayb/.IntelliJIdea12/config/plugins/python/helpers/pydev/pydevd.py", > line 1475, in <module> > debugger.run(setup['file'], None, None) > File > "/home/vinayb/.IntelliJIdea12/config/plugins/python/helpers/pydev/pydevd.py", > line 1122, in run > pydev_imports.execfile(file, globals, locals) #execute the script > File > "/home/vinayb/workspace/LearnSciKitLearn/examples/ScalableClusteringApp.py", > line 138, in <module> > predicted_cluster = km.predict(doc_idx) > File "/usr/local/lib/python2.7/dist-packages/sklearn/cluster/k_means_.py", > line 776, in predict > X = self._check_test_data(X) > File "/usr/local/lib/python2.7/dist-packages/sklearn/cluster/k_means_.py", > line 682, in _check_test_data > n_features, expected_n_features)) > ValueError: Incorrect number of features. Got 1 features, expected 10000
Use a debugger or add a print statement to introspect the content and shape of your data variables and check whether they match your expectations. -- Olivier http://twitter.com/ogrisel - http://github.com/ogrisel ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb _______________________________________________ Scikit-learn-general mailing list Scikit-learn-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/scikit-learn-general