auto_ml
auto_ml copied to clipboard
Error Running Multiple Classifiers
When I use one classifier it works fine, but when I use multiple classifiers it always gives an error related to pickling. Here's my code: ml_predictor = Predictor(type_of_estimator='classifier', column_descriptions=column_descriptions) models = ['AdaBoostClassifier', 'GradientBoostingClassifier'] ml_predictor.train(df_train, model_names=models) ml_predictor.score(df_test, df_test.target)
and here is the error:
About to run GridSearchCV on the pipeline for several models to predict target Fitting 2 folds for each of 2 candidates, totalling 4 fits
AttributeError Traceback (most recent call last)
~/auto_ml/auto_ml/predictor.py in train(failed resolving arguments) 668 669 # This is our main logic for how we train the final model --> 670 self.trained_final_model = self.train_ml_estimator(self.model_names, self._scorer, X_df, y) 671 672 if self.ensemble_config is not None and len(self.ensemble_config) > 0:
~/auto_ml/auto_ml/predictor.py in train_ml_estimator(self, estimator_names, scoring, X_df, y, feature_learning, prediction_interval) 1247 self.grid_search_params = grid_search_params 1248 -> 1249 gscv_results = self.fit_grid_search(X_df, y, grid_search_params, refit=True) 1250 1251 trained_final_model = gscv_results.best_estimator_
~/auto_ml/auto_ml/predictor.py in fit_grid_search(self, X_df, y, gs_params, feature_learning, refit) 1192 # Note that we will only report analytics results on the final model that ultimately gets selected, and trained on the entire dataset 1193 -> 1194 gs.fit(X_df, y) 1195 1196 if self.verbose:
/usr/local/lib/python3.5/dist-packages/sklearn/model_selection/_search.py in fit(self, X, y, groups, **fit_params) 637 error_score=self.error_score) 638 for parameters, (train, test) in product(candidate_params, --> 639 cv.split(X, y, groups))) 640 641 # if one choose to see train score, "out" will contain train score info
/usr/local/lib/python3.5/dist-packages/sklearn/externals/joblib/parallel.py in call(self, iterable) 787 # consumption. 788 self._iterating = False --> 789 self.retrieve() 790 # Make sure that we get a last message telling us we are done 791 elapsed_time = time.time() - self._start_time
/usr/local/lib/python3.5/dist-packages/sklearn/externals/joblib/parallel.py in retrieve(self) 697 try: 698 if getattr(self._backend, 'supports_timeout', False): --> 699 self._output.extend(job.get(timeout=self.timeout)) 700 else: 701 self._output.extend(job.get())
/usr/lib/python3.5/multiprocessing/pool.py in get(self, timeout) 606 return self._value 607 else: --> 608 raise self._value 609 610 def _set(self, i, obj):
/usr/lib/python3.5/multiprocessing/pool.py in _handle_tasks(taskqueue, put, outqueue, pool, cache) 383 break 384 try: --> 385 put(task) 386 except Exception as e: 387 job, ind = task[:2]
/usr/local/lib/python3.5/dist-packages/sklearn/externals/joblib/pool.py in send(obj) 369 def send(obj): 370 buffer = BytesIO() --> 371 CustomizablePickler(buffer, self._reducers).dump(obj) 372 self._writer.send_bytes(buffer.getvalue()) 373 self._send = send
~/auto_ml/auto_ml/predictor.py in _pickle_method(m) 47 # For handling parallelism edge cases 48 def _pickle_method(m): ---> 49 if m.im_self is None: 50 return getattr, (m.im_class, m.im_func.func_name) 51 else:
AttributeError: 'function' object has no attribute 'im_self'