I have installed PyML package in order to use some machine learning algorithms, and according to the tutorial, my installation is successful.
I try to run a python script which includes the following line to import modules from PyML
from PyML import datafunc,svm,assess,modelSelection,ker
However I get the error message above saying
File
<stdin>
, line 1, in<module>
ImportError: cannot import name datafunc
cannot import name datafunc`. From terminal I check every module by saying
from PyML import datafunc, from PyML import svm, from PyML import ker
I only get error message for datafunc
. The PyML library is under the site-packages
folder of Python 2.7.
I check this question here Python error: ImportError: cannot import name Akismet, but I could't see how it will help my problem.
Do you have any idea why Python imports some modules but does not import this one?
In PyML-0.7.13.3, the datafunc
module exists in PyML/containers
directory.
So it seems that you can import the module as follows:
from PyML.containers import datafunc
Howerver, it raises an error beacuse the datafunc
module uses
undefined classes BaseVectorDataSet
and SparseDataSet
.
Thus you need to modify the source of PyML
in order to use datafunc
module.
First, prepend the following two lines to PyML/containers/datafunc.py
and re-install the PyML library.
from PyML.containers.baseDatasets import BaseVectorDataSet
from PyML.containers.vectorDatasets import SparseDataSet
Then you can import the modules as follows:
from PyML import svm, modelSelection, ker
from from PyML.containers import datafunc
from from PyML.evaluators import assess
BTW, I recommend that you use more documented and tested machine learning library, such as scikit-learn.