tpot
tpot copied to clipboard
'path' must be None or a list, not <class '_frozen_importlib_external._NamespacePath'>
I'm trying to run this following code from my SPYDER
from tpot import TPOTClassifier from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split import numpy as np iris = load_iris() X_train, X_test, y_train, y_test = train_test_split(iris.data.astype(np.float64), iris.target.astype(np.float64), train_size=0.75, test_size=0.25) tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2) tpot.fit(X_train, y_train) print(tpot.score(X_test, y_test)) tpot.export('tpot_iris_pipeline.py')
I'm getting this error WHEN I RUN
C:\Anaconda3\lib\importlib_bootstrap.py:219: ImportWarning: can't resolve package from spec or package, falling back on name and path return f(*args, **kwds) Traceback (most recent call last): File "
", line 1, in tpot.fit(X_train, y_train)
File "C:\Anaconda3\lib\site-packages\tpot\base.py", line 577, in fit self._fit_init()
File "C:\Anaconda3\lib\site-packages\tpot\base.py", line 485, in _fit_init ArgBaseClass=ARGType
File "C:\Anaconda3\lib\site-packages\tpot\operator_utils.py", line 159, in TPOTOperatorClassFactory import_str, op_str, op_obj = source_decode(opsourse)
File "C:\Anaconda3\lib\site-packages\tpot\operator_utils.py", line 72, in source_decode exec('from {} import {}'.format(import_str, op_str))
File "
File "
File "
File "
File "
File "C:\Anaconda3\lib\site-packages\pyximport\pyximport.py", line 253, in find_module fp, pathname, (ext,mode,ty) = imp.find_module(fullname,package_path)
File "C:\Anaconda3\lib\imp.py", line 271, in find_module "not {}".format(type(path)))
RuntimeError: 'path' must be None or a list, not <class '_frozen_importlib_external._NamespacePath'>
Please, I need urgent help... I 've tried to search online for the past 2 days, I can't find the solution. I want to use tpot to classifier my dataset, but I'm just running this example first to see how to work.
Can you please try to run the example codes on python console or ipython console instead from Spyder? It seems a import error.
Thanks so much.... It's working on ipython. Please, I want to ask if I can turn my result into a model and use it at API on Flask to build an application for my web? or I can only use the exported (tpot.export) for API?
Can I apply Feature Scaling and Feature Selection using PCA/LDA before training my data?
Note, this was an issue with Spyder.
code : from fbprophet import Prophet
error: RuntimeError: 'path' must be None or a list, not <class '_frozen_importlib_external._NamespacePath'>
Please resolve my error