JacobPlaster / ann-writer

An artificial machine learning program that attempts to impersonate the writing style of any given text training set
MIT License
318 stars 74 forks source link

ValueError: Unknown label type: 'continuous' #3

Closed ddworken closed 8 years ago

ddworken commented 8 years ago

When I run:

python3 main.py -td Datasets/HarryPotter\(large\).txt

I get:

Traceback (most recent call last):
  File "main.py", line 140, in <module>
    Main()
  File "main.py", line 88, in Main
    MLNetworkSS.FitNetwork()
  File "/home/david/code/SCNeuralNetwork/ann-writer/Modules/MachineLearning.py", line 28, in FitNetwork
    self._fit(self.trainingData, self.trainingDataResults)
  File "/home/david/code/SCNeuralNetwork/ann-writer/Modules/MachineLearning.py", line 44, in _fit
    self.clf.fit(np.asarray(dataVector, dtype="float"), np.asarray(targetVector, dtype="float"))
  File "/usr/local/lib/python3.4/dist-packages/sklearn/neighbors/base.py", line 774, in fit
    check_classification_targets(y)
  File "/usr/local/lib/python3.4/dist-packages/sklearn/utils/multiclass.py", line 173, in check_classification_targets
    raise ValueError("Unknown label type: %r" % y_type)
ValueError: Unknown label type: 'continuous'

Any idea what I'm doing wrong?

-Python 3.4.3+
-numpy 1.8.2
-nltk 3.0.4
-scikit-learn 0.18.dev0
JacobPlaster commented 8 years ago

Hi ddworken,

It seems as if numpy is failing to detect that the training array is a float. Does the command work on smaller data sets such as:

python3 main.py -td Datasets/HarryPotter(small).txt

YueHuali commented 8 years ago

Change the float into long. It will be fine.