ClimbsRocks / auto_ml

[UNMAINTAINED] Automated machine learning for analytics & production
http://auto-ml.readthedocs.io
MIT License
1.64k stars 310 forks source link

Error when training with optimize_final_model = True #376

Closed kngo107 closed 6 years ago

kngo107 commented 6 years ago

Hi I got an error when running the followings on Ubuntu:

Error:


Optimizing the hyperparameters for your model now About to run EvolutionaryAlgorithmSearchCV to find the optimal hyperparameters for the model GradientBoostingRegressor to predict MEDV Population size each generation: 35 Number of generations: 3 Types [1, 2, 1, 1, 1, 1, 2] and maxint [2, 4, 1, 7, 0, 9, 5] detected --- Evolve in 14400 possible combinations --- Traceback (most recent call last): line 641, in train self.trained_final_model = self.train_ml_estimator(self.model_names, self._scorer, X_df, y) line 1237, in train_ml_estimator gscv_results = self.fit_grid_search(X_df, y, grid_search_params, feature_learning=feature_learning) line 1162, in fit_grid_search gs.fit(X_df, y) File "/usr/local/lib/python2.7/dist-packages/evolutionary_search/cv.py", line 355, in fit self._fit(X, y, possible_params) File "/usr/local/lib/python2.7/dist-packages/evolutionary_search/cv.py", line 426, in _fit halloffame=hof, verbose=self.verbose) File "/usr/local/lib/python2.7/dist-packages/deap/algorithms.py", line 150, in eaSimple fitnesses = toolbox.map(toolbox.evaluate, invalid_ind) File "/usr/lib/python2.7/multiprocessing/pool.py", line 251, in map return self.map_async(func, iterable, chunksize).get() File "/usr/lib/python2.7/multiprocessing/pool.py", line 567, in get raise self._value cPickle.PicklingError: Can't pickle <type 'instancemethod'>: attribute lookup builtin.instancemethod failed

My code: ml_predictor = Predictor(type_of_estimator=problem_type, column_descriptions=column_descriptions) ml_predictor.train(train_set, verbose=False, compare_all_models = True, optimize_final_model = True) and I'm using the boston dataset

I'm not sure if it happens to everyone. I have tried to run it on both windows and ubuntu and i got the same issue.

kngo107 commented 6 years ago

The issue is solved if I change n_jobs to be 1 instead of multiprocessing.cpu_count() which returns 4 for my machine.

kngo107 commented 6 years ago

I have found a solution for this problem. I had to edit "/usr/local/lib/python2.7/dist-packages/evolutionary_search/cv.py" use pathos.multiprocessing.Pool instead of multiprocessing.Pool