I'm trying to implement the most basic flow of machine learning in node-red
using this library: https://flows.nodered.org/node/node-red-contrib-machine-learning.
This flow loads a CSV file, shuffles it and creates a training and a test partition.
I installed:
I opened node-red
from Anaconda
.
The problem:
When Clicking on "Start" node, I get the following error:
Traceback (most recent call last):
File "C:\Users\stava\node_modules\node-red-contrib-machine-learning\nodes\dataset\create-dataset/create-dataset.py",
line 12, in <module> df = pandas.read_csv(config['path'], header=None)
File "C:\Users\stava\AppData\Local\conda\conda\envs\py35\lib\site-packages\pandas\io\parsers.py",
line 678, in parser_f return _read(filepath_or_buffer, kwds)
File "C:\Users\stava\AppData\Local\conda\conda\envs\py35\lib\site-packages\pandas\io\parsers.py",
line 440, in _read parser = TextFileReader(filepath_or_buffer, **kwds)
File "C:\Users\stava\AppData\Local\conda\conda\envs\py35\lib\site-packages\pandas\io\parsers.py",
line 787, in __init__ self._make_engine(self.engine)
File "C:\Users\stava\AppData\Local\conda\conda\envs\py35\lib\site-packages\pandas\io\parsers.py",
line 1014, in _make_engine self._engine = CParserWrapper(self.f, **self.options)
File "C:\Users\stava\AppData\Local\conda\conda\envs\py35\lib\site-packages\p...
Currently, there is a reported and unresolved bug in their repository. The bug - Node red can't find any of the files you provided the path to them in the nodes. Solution (Works in Linux distributions and MacOS): Provide the full path to your files (as we did in this project). We couldn't make it work in Windows.
The decision tree classifier predictor
node accepts arrays in an array of data and returns the prediction. Have a look at how we sent him data from message to array for prediction
node. Each sub-array corresponds to data that should be sent to get a prediction:
return {
payload: [[...msg.payload.user_code,msg.payload.datetime]]
};
More info and an example of a full working project can be found here.