Pandas 尝试使用GridSearchCV拟合神经网络分类器时出现值错误
我尝试将GridSearchCV与MLPClassizer一起使用,以便使用最佳参数拟合一些训练数据:Pandas 尝试使用GridSearchCV拟合神经网络分类器时出现值错误,pandas,numpy,neural-network,classification,grid-search,Pandas,Numpy,Neural Network,Classification,Grid Search,我尝试将GridSearchCV与MLPClassizer一起使用,以便使用最佳参数拟合一些训练数据: parameters={ 'learning_rate': ["constant", "invscaling", "adaptive"], 'hidden_layer_sizes': [x for x in itertools.product((10,20,30,40,50,100),repeat=3)], 'alpha': [10.0 **-np.arange(1,
parameters={
'learning_rate': ["constant", "invscaling", "adaptive"],
'hidden_layer_sizes': [x for x in itertools.product((10,20,30,40,50,100),repeat=3)],
'alpha': [10.0 **-np.arange(1, 7)],
'activation': ["logistic", "relu", "Tanh"]
}
ord_pred = MLPClassifier(hidden_layer_sizes = (100,1))
clf = GridSearchCV(estimator=ord_pred,param_grid=parameters,n_jobs=-1,verbose = 10)
orders_prior1 = orders_prior.groupby('product_id').filter(lambda x: len(x) >= 3).fillna(0)
clf.fit(orders_prior1[['user_id','order_number','order_dow','order_hour_of_day','days_since_prior_order']]\
,orders_prior1['product_id'], orders_prior1['user_order'])
但是,我得到了以下错误/例外:
if self.alpha < 0.0:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
The above exception was the direct cause of the following exception:
TransportableException Traceback (most recent call last)
C:\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in retrieve(self)
681 if 'timeout' in getfullargspec(job.get).args:
--> 682 self._output.extend(job.get(timeout=self.timeout))
683 else:
C:\Anaconda3\lib\multiprocessing\pool.py in get(self, timeout)
643 else:
--> 644 raise self._value
645
TransportableException: TransportableException
___________________________________________________________________________
ValueError Wed Aug 16 19:23:55 2017
PID: 18804 Python 3.6.2: C:\Anaconda3\python.exe
...........................................................................
C:\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in __call__(self=<sklearn.externals.joblib.parallel.BatchedCalls object>)
126 def __init__(self, iterator_slice):
127 self.items = list(iterator_slice)
128 self._size = len(self.items)
129
130 def __call__(self):
--> 131 return [func(*args, **kwargs) for func, args, kwargs in self.items]
self.items = [(<function _fit_and_score>, (MLPClassifier(activation='logistic',
alph...on_fraction=0.1, verbose=False, warm_start=False), user_id order_number order_dow orde... 7.0
[32433710 rows x 5 columns], 0 196
1 14084
2 ...
Name: product_id, Length: 32433710, dtype: int64, <function _passthrough_scorer>, memmap([ 1606, 1610, 1618, ..., 32433707, 32433708, 32433709]), memmap([ 0, 1, 2, ..., 32190332, 32190334, 32190356]), 10, {'activation': 'logistic', 'alpha': array([ 1.00000000e-01, 1.00000000e-02, 1.0...0000000e-04, 1.00000000e-05, 1.00000000e-06]), 'hidden_layer_sizes': (10, 10, 10), 'learning_rate': 'constant'}), {'error_score': 'raise', 'fit_params': {}, 'return_n_test_samples': True, 'return_parameters': True, 'return_times': True, 'return_train_score': True})]
132
133 def __len__(self):
134 return self._size
135
...........................................................................
C:\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in <listcomp>(.0=<list_iterator object>)
126 def __init__(self, iterator_slice):
127 self.items = list(iterator_slice)
128 self._size = len(self.items)
129
130 def __call__(self):
--> 131 return [func(*args, **kwargs) for func, args, kwargs in self.items]
func = <function _fit_and_score>
args = (MLPClassifier(activation='logistic',
alph...on_fraction=0.1, verbose=False, warm_start=False), user_id order_number order_dow orde... 7.0
[32433710 rows x 5 columns], 0 196
1 14084
2 ...
Name: product_id, Length: 32433710, dtype: int64, <function _passthrough_scorer>, memmap([ 1606, 1610, 1618, ..., 32433707, 32433708, 32433709]), memmap([ 0, 1, 2, ..., 32190332, 32190334, 32190356]), 10, {'activation': 'logistic', 'alpha': array([ 1.00000000e-01, 1.00000000e-02, 1.0...0000000e-04, 1.00000000e-05, 1.00000000e-06]), 'hidden_layer_sizes': (10, 10, 10), 'learning_rate': 'constant'})
kwargs = {'error_score': 'raise', 'fit_params': {}, 'return_n_test_samples': True, 'return_parameters': True, 'return_times': True, 'return_train_score': True}
132
133 def __len__(self):
134 return self._size
135
...........................................................................
C:\Anaconda3\lib\site-packages\sklearn\model_selection\_validation.py in _fit_and_score(estimator=MLPClassifier(activation='logistic',
alph...on_fraction=0.1, verbose=False, warm_start=False), X= user_id order_number order_dow orde... 7.0
[32433710 rows x 5 columns], y=0 196
1 14084
2 ...
Name: product_id, Length: 32433710, dtype: int64, scorer=<function _passthrough_scorer>, train=memmap([ 1606, 1610, 1618, ..., 32433707, 32433708, 32433709]), test=memmap([ 0, 1, 2, ..., 32190332, 32190334, 32190356]), verbose=10, parameters={'activation': 'logistic', 'alpha': array([ 1.00000000e-01, 1.00000000e-02, 1.0...0000000e-04, 1.00000000e-05, 1.00000000e-06]), 'hidden_layer_sizes': (10, 10, 10), 'learning_rate': 'constant'}, fit_params={}, return_train_score=True, return_parameters=True, return_n_test_samples=True, return_times=True, error_score='raise')
233
234 try:
235 if y_train is None:
236 estimator.fit(X_train, **fit_params)
237 else:
--> 238 estimator.fit(X_train, y_train, **fit_params)
estimator.fit = <bound method BaseMultilayerPerceptron.fit of ML...n_fraction=0.1, verbose=False, warm_start=False)>
X_train = user_id order_number order_dow orde... 7.0
[21606079 rows x 5 columns]
y_train = 1606 17762
1610 17762
1618 ...
Name: product_id, Length: 21606079, dtype: int64
fit_params = {}
239
240 except Exception as e:
241 # Note fit time as time until error
242 fit_time = time.time() - start_time
...........................................................................
C:\Anaconda3\lib\site-packages\sklearn\neural_network\multilayer_perceptron.py in fit(self=MLPClassifier(activation='logistic',
alph...on_fraction=0.1, verbose=False, warm_start=False), X= user_id order_number order_dow orde... 7.0
[21606079 rows x 5 columns], y=1606 17762
1610 17762
1618 ...
Name: product_id, Length: 21606079, dtype: int64)
613
614 Returns
615 -------
616 self : returns a trained MLP model.
617 """
--> 618 return self._fit(X, y, incremental=False)
self._fit = <bound method BaseMultilayerPerceptron._fit of M...n_fraction=0.1, verbose=False, warm_start=False)>
X = user_id order_number order_dow orde... 7.0
[21606079 rows x 5 columns]
y = 1606 17762
1610 17762
1618 ...
Name: product_id, Length: 21606079, dtype: int64
619
620 @property
621 def partial_fit(self):
622 """Fit the model to data matrix X and target y.
...........................................................................
C:\Anaconda3\lib\site-packages\sklearn\neural_network\multilayer_perceptron.py in _fit(self=MLPClassifier(activation='logistic',
alph...on_fraction=0.1, verbose=False, warm_start=False), X= user_id order_number order_dow orde... 7.0
[21606079 rows x 5 columns], y=1606 17762
1610 17762
1618 ...
Name: product_id, Length: 21606079, dtype: int64, incremental=False)
320 if not hasattr(hidden_layer_sizes, "__iter__"):
321 hidden_layer_sizes = [hidden_layer_sizes]
322 hidden_layer_sizes = list(hidden_layer_sizes)
323
324 # Validate input parameters.
--> 325 self._validate_hyperparameters()
self._validate_hyperparameters = <bound method BaseMultilayerPerceptron._validate...n_fraction=0.1, verbose=False, warm_start=False)>
326 if np.any(np.array(hidden_layer_sizes) <= 0):
327 raise ValueError("hidden_layer_sizes must be > 0, got %s." %
328 hidden_layer_sizes)
329
...........................................................................
C:\Anaconda3\lib\site-packages\sklearn\neural_network\multilayer_perceptron.py in _validate_hyperparameters(self=MLPClassifier(activation='logistic',
alph...on_fraction=0.1, verbose=False, warm_start=False))
386 if not isinstance(self.shuffle, bool):
387 raise ValueError("shuffle must be either True or False, got %s." %
388 self.shuffle)
389 if self.max_iter <= 0:
390 raise ValueError("max_iter must be > 0, got %s." % self.max_iter)
--> 391 if self.alpha < 0.0:
self.alpha = array([ 1.00000000e-01, 1.00000000e-02, 1.0...0000000e-04, 1.00000000e-05, 1.00000000e-06])
392 raise ValueError("alpha must be >= 0, got %s." % self.alpha)
393 if (self.learning_rate in ["constant", "invscaling", "adaptive"] and
394 self.learning_rate_init <= 0.0):
395 raise ValueError("learning_rate_init must be > 0, got %s." %
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
___________________________________________________________________________
During handling of the above exception, another exception occurred:
JoblibValueError Traceback (most recent call last)
<ipython-input-20-7c1268d1d451> in <module>()
9 orders_prior1 = orders_prior.groupby('product_id').filter(lambda x: len(x) >= 3).fillna(0)
10 # up = orders_prior['product_id'].unique()
---> 11 clf.fit(orders_prior1 [['user_id','order_number','order_dow','order_hour_of_day','days_since_prior_order']] ,orders_prior1['product_id'], orders_prior1['user_order'])
12
13 # ord_pred.partial_fit(orders_prior.fillna(0).iloc[0:894]\
C:\Anaconda3\lib\site-packages\sklearn\model_selection\_search.py in fit(self, X, y, groups)
943 train/test set.
944 """
--> 945 return self._fit(X, y, groups, ParameterGrid(self.param_grid))
946
947
C:\Anaconda3\lib\site-packages\sklearn\model_selection\_search.py in _fit(self, X, y, groups, parameter_iterable)
562 return_times=True, return_parameters=True,
563 error_score=self.error_score)
--> 564 for parameters in parameter_iterable
565 for train, test in cv_iter)
566
C:\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in __call__(self, iterable)
766 # consumption.
767 self._iterating = False
--> 768 self.retrieve()
769 # Make sure that we get a last message telling us we are done
770 elapsed_time = time.time() - self._start_time
C:\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in retrieve(self)
717 ensure_ready = self._managed_backend
718 backend.abort_everything(ensure_ready=ensure_ready)
--> 719 raise exception
720
721 def __call__(self, iterable):
JoblibValueError: JoblibValueError
___________________________________________________________________________
Multiprocessing exception:
...........................................................................
C:\Anaconda3\lib\runpy.py in _run_module_as_main(mod_name='ipykernel_launcher', alter_argv=1)
188 sys.exit(msg)
189 main_globals = sys.modules["__main__"].__dict__
190 if alter_argv:
191 sys.argv[0] = mod_spec.origin
192 return _run_code(code, main_globals, None,
--> 193 "__main__", mod_spec)
mod_spec = ModuleSpec(name='ipykernel_launcher', loader=<_f...nda3\\lib\\site-packages\\ipykernel_launcher.py')
194
195 def run_module(mod_name, init_globals=None,
196 run_name=None, alter_sys=False):
197 """Execute a module's code without importing it
F:\thecads_vm-master\eds\Final Project\Instacart\<ipython-input-20-7c1268d1d451> in <module>()
6 }
7 ord_pred = MLPClassifier(hidden_layer_sizes = (100,1))
8 clf = GridSearchCV(estimator=ord_pred,param_grid=parameters,n_jobs=-1,verbose = 10)
9 orders_prior1 = orders_prior.groupby('product_id').filter(lambda x: len(x) >= 3).fillna(0)
10 # up = orders_prior['product_id'].unique()
---> 11 clf.fit(orders_prior1 [['user_id','order_number','order_dow','order_hour_of_day','days_since_prior_order']] ,orders_prior1['product_id'], orders_prior1['user_order'])
12
13 # ord_pred.partial_fit(orders_prior.fillna(0).iloc[0:894]\
14 # [['user_id','order_number','order_dow','order_hour_of_day','days_since_prior_order']]\
15 # ,orders_prior.iloc[0:894]['product_id'], up)
...........................................................................
C:\Anaconda3\lib\site-packages\sklearn\model_selection\_search.py in fit(self=GridSearchCV(cv=None, error_score='raise',
...rain_score=True,
scoring=None, verbose=10), X= user_id order_number order_dow orde... 7.0
[32433710 rows x 5 columns], y=0 196
1 14084
2 ...
Name: product_id, Length: 32433710, dtype: int64, groups=0 11
1 11
2 ...Name: user_order, Length: 32433710, dtype: object)
940
941 groups : array-like, with shape (n_samples,), optional
942 Group labels for the samples used while splitting the dataset into
943 train/test set.
944 """
--> 945 return self._fit(X, y, groups, ParameterGrid(self.param_grid))
self._fit = <bound method BaseSearchCV._fit of GridSearchCV(...ain_score=True,
scoring=None, verbose=10)>
X = user_id order_number order_dow orde... 7.0
[32433710 rows x 5 columns]
y = 0 196
1 14084
2 ...
Name: product_id, Length: 32433710, dtype: int64
groups = 0 11
1 11
2 ...Name: user_order, Length: 32433710, dtype: object
self.param_grid = {'activation': ['logistic', 'relu', 'Tanh'], 'alpha': [array([ 1.00000000e-01, 1.00000000e-02, 1.0...0000000e-04, 1.00000000e-05, 1.00000000e-06])], 'hidden_layer_sizes': [(10, 10, 10), (10, 10, 20), (10, 10, 30), (10, 10, 40), (10, 10, 50), (10, 10, 100), (10, 20, 10), (10, 20, 20), (10, 20, 30), (10, 20, 40), (10, 20, 50), (10, 20, 100), (10, 30, 10), (10, 30, 20), (10, 30, 30), (10, 30, 40), (10, 30, 50), (10, 30, 100), (10, 40, 10), (10, 40, 20), ...], 'learning_rate': ['constant', 'invscaling', 'adaptive']}
946
947
948 class RandomizedSearchCV(BaseSearchCV):
949 """Randomized search on hyper parameters.
...........................................................................
C:\Anaconda3\lib\site-packages\sklearn\model_selection\_search.py in _fit(self=GridSearchCV(cv=None, error_score='raise',
...rain_score=True,
scoring=None, verbose=10), X= user_id order_number order_dow orde... 7.0
[32433710 rows x 5 columns], y=0 196
1 14084
2 ...
Name: product_id, Length: 32433710, dtype: int64, groups=0 11
1 11
2 ...Name: user_order, Length: 32433710, dtype: object, parameter_iterable=<sklearn.model_selection._search.ParameterGrid object>)
559 fit_params=self.fit_params,
560 return_train_score=self.return_train_score,
561 return_n_test_samples=True,
562 return_times=True, return_parameters=True,
563 error_score=self.error_score)
--> 564 for parameters in parameter_iterable
parameters = undefined
parameter_iterable = <sklearn.model_selection._search.ParameterGrid object>
565 for train, test in cv_iter)
566
567 # if one choose to see train score, "out" will contain train score info
568 if self.return_train_score:
...........................................................................
C:\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in __call__(self=Parallel(n_jobs=-1), iterable=<generator object BaseSearchCV._fit.<locals>.<genexpr>>)
763 if pre_dispatch == "all" or n_jobs == 1:
764 # The iterable was consumed all at once by the above for loop.
765 # No need to wait for async callbacks to trigger to
766 # consumption.
767 self._iterating = False
--> 768 self.retrieve()
self.retrieve = <bound method Parallel.retrieve of Parallel(n_jobs=-1)>
769 # Make sure that we get a last message telling us we are done
770 elapsed_time = time.time() - self._start_time
771 self._print('Done %3i out of %3i | elapsed: %s finished',
772 (len(self._output), len(self._output),
---------------------------------------------------------------------------
Sub-process traceback:
---------------------------------------------------------------------------
ValueError Wed Aug 16 19:23:55 2017
PID: 18804 Python 3.6.2: C:\Anaconda3\python.exe
...........................................................................
C:\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in __call__(self=<sklearn.externals.joblib.parallel.BatchedCalls object>)
126 def __init__(self, iterator_slice):
127 self.items = list(iterator_slice)
128 self._size = len(self.items)
129
130 def __call__(self):
--> 131 return [func(*args, **kwargs) for func, args, kwargs in self.items]
self.items = [(<function _fit_and_score>, (MLPClassifier(activation='logistic',
alph...on_fraction=0.1, verbose=False, warm_start=False), user_id order_number order_dow orde... 7.0
[32433710 rows x 5 columns], 0 196
1 14084
2 ...
Name: product_id, Length: 32433710, dtype: int64, <function _passthrough_scorer>, memmap([ 1606, 1610, 1618, ..., 32433707, 32433708, 32433709]), memmap([ 0, 1, 2, ..., 32190332, 32190334, 32190356]), 10, {'activation': 'logistic', 'alpha': array([ 1.00000000e-01, 1.00000000e-02, 1.0...0000000e-04, 1.00000000e-05, 1.00000000e-06]), 'hidden_layer_sizes': (10, 10, 10), 'learning_rate': 'constant'}), {'error_score': 'raise', 'fit_params': {}, 'return_n_test_samples': True, 'return_parameters': True, 'return_times': True, 'return_train_score': True})]
132
133 def __len__(self):
134 return self._size
135
...........................................................................
C:\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in <listcomp>(.0=<list_iterator object>)
126 def __init__(self, iterator_slice):
127 self.items = list(iterator_slice)
128 self._size = len(self.items)
129
130 def __call__(self):
--> 131 return [func(*args, **kwargs) for func, args, kwargs in self.items]
func = <function _fit_and_score>
args = (MLPClassifier(activation='logistic',
alph...on_fraction=0.1, verbose=False, warm_start=False), user_id order_number order_dow orde... 7.0
[32433710 rows x 5 columns], 0 196
1 14084
2 ...
Name: product_id, Length: 32433710, dtype: int64, <function _passthrough_scorer>, memmap([ 1606, 1610, 1618, ..., 32433707, 32433708, 32433709]), memmap([ 0, 1, 2, ..., 32190332, 32190334, 32190356]), 10, {'activation': 'logistic', 'alpha': array([ 1.00000000e-01, 1.00000000e-02, 1.0...0000000e-04, 1.00000000e-05, 1.00000000e-06]), 'hidden_layer_sizes': (10, 10, 10), 'learning_rate': 'constant'})
kwargs = {'error_score': 'raise', 'fit_params': {}, 'return_n_test_samples': True, 'return_parameters': True, 'return_times': True, 'return_train_score': True}
132
133 def __len__(self):
134 return self._size
135
...........................................................................
C:\Anaconda3\lib\site-packages\sklearn\model_selection\_validation.py in _fit_and_score(estimator=MLPClassifier(activation='logistic',
alph...on_fraction=0.1, verbose=False, warm_start=False), X= user_id order_number order_dow orde... 7.0
[32433710 rows x 5 columns], y=0 196
1 14084
2 ...
Name: product_id, Length: 32433710, dtype: int64, scorer=<function _passthrough_scorer>, train=memmap([ 1606, 1610, 1618, ..., 32433707, 32433708, 32433709]), test=memmap([ 0, 1, 2, ..., 32190332, 32190334, 32190356]), verbose=10, parameters={'activation': 'logistic', 'alpha': array([ 1.00000000e-01, 1.00000000e-02, 1.0...0000000e-04, 1.00000000e-05, 1.00000000e-06]), 'hidden_layer_sizes': (10, 10, 10), 'learning_rate': 'constant'}, fit_params={}, return_train_score=True, return_parameters=True, return_n_test_samples=True, return_times=True, error_score='raise')
233
234 try:
235 if y_train is None:
236 estimator.fit(X_train, **fit_params)
237 else:
--> 238 estimator.fit(X_train, y_train, **fit_params)
estimator.fit = <bound method BaseMultilayerPerceptron.fit of ML...n_fraction=0.1, verbose=False, warm_start=False)>
X_train = user_id order_number order_dow orde... 7.0
[21606079 rows x 5 columns]
y_train = 1606 17762
1610 17762
1618 ...
Name: product_id, Length: 21606079, dtype: int64
fit_params = {}
239
240 except Exception as e:
241 # Note fit time as time until error
242 fit_time = time.time() - start_time
...........................................................................
C:\Anaconda3\lib\site-packages\sklearn\neural_network\multilayer_perceptron.py in fit(self=MLPClassifier(activation='logistic',
alph...on_fraction=0.1, verbose=False, warm_start=False), X= user_id order_number order_dow orde... 7.0
[21606079 rows x 5 columns], y=1606 17762
1610 17762
1618 ...
Name: product_id, Length: 21606079, dtype: int64)
613
614 Returns
615 -------
616 self : returns a trained MLP model.
617 """
--> 618 return self._fit(X, y, incremental=False)
self._fit = <bound method BaseMultilayerPerceptron._fit of M...n_fraction=0.1, verbose=False, warm_start=False)>
X = user_id order_number order_dow orde... 7.0
[21606079 rows x 5 columns]
y = 1606 17762
1610 17762
1618 ...
Name: product_id, Length: 21606079, dtype: int64
619
620 @property
621 def partial_fit(self):
622 """Fit the model to data matrix X and target y.
...........................................................................
C:\Anaconda3\lib\site-packages\sklearn\neural_network\multilayer_perceptron.py in _fit(self=MLPClassifier(activation='logistic',
alph...on_fraction=0.1, verbose=False, warm_start=False), X= user_id order_number order_dow orde... 7.0
[21606079 rows x 5 columns], y=1606 17762
1610 17762
1618 ...
Name: product_id, Length: 21606079, dtype: int64, incremental=False)
320 if not hasattr(hidden_layer_sizes, "__iter__"):
321 hidden_layer_sizes = [hidden_layer_sizes]
322 hidden_layer_sizes = list(hidden_layer_sizes)
323
324 # Validate input parameters.
--> 325 self._validate_hyperparameters()
self._validate_hyperparameters = <bound method BaseMultilayerPerceptron._validate...n_fraction=0.1, verbose=False, warm_start=False)>
326 if np.any(np.array(hidden_layer_sizes) <= 0):
327 raise ValueError("hidden_layer_sizes must be > 0, got %s." %
328 hidden_layer_sizes)
329
...........................................................................
C:\Anaconda3\lib\site-packages\sklearn\neural_network\multilayer_perceptron.py in _validate_hyperparameters(self=MLPClassifier(activation='logistic',
alph...on_fraction=0.1, verbose=False, warm_start=False))
386 if not isinstance(self.shuffle, bool):
387 raise ValueError("shuffle must be either True or False, got %s." %
388 self.shuffle)
389 if self.max_iter <= 0:
390 raise ValueError("max_iter must be > 0, got %s." % self.max_iter)
--> 391 if self.alpha < 0.0:
self.alpha = array([ 1.00000000e-01, 1.00000000e-02, 1.0...0000000e-04, 1.00000000e-05, 1.00000000e-06])
392 raise ValueError("alpha must be >= 0, got %s." % self.alpha)
393 if (self.learning_rate in ["constant", "invscaling", "adaptive"] and
394 self.learning_rate_init <= 0.0):
395 raise ValueError("learning_rate_init must be > 0, got %s." %
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
如果self.alpha<0.0:
ValueError:包含多个元素的数组的真值不明确。使用a.any()或a.all()
上述异常是以下异常的直接原因:
TransportableException回溯(最后一次调用)
检索中的C:\Anaconda3\lib\site packages\sklearn\externals\joblib\parallel.py(self)
681如果getfullargspec(job.get.args)中的“超时”:
-->682 self.\u output.extend(job.get(timeout=self.timeout))
683其他:
get中的C:\Anaconda3\lib\multiprocessing\pool.py(self,超时)
643其他:
-->644提高自我价值
645
TransportableException:TransportableException
___________________________________________________________________________
ValueError 2017年8月16日星期三19:23:55
PID:18804 Python 3.6.2:C:\Anaconda3\Python.exe
...........................................................................
C:\Anaconda3\lib\site packages\sklearn\externals\joblib\parallel.py在调用中(self=)
126定义初始化(自、迭代器切片):
127 self.items=列表(迭代器_切片)
128自身尺寸=长度(自身项目)
129
130 def呼叫(自我):
-->131返回[func(*args,**kwargs),用于self.items中的func、args、kwargs]
self.items=[(,(MLPClassizer(activation='logistic'),
alph…on_分数=0.1,verbose=False,warm_开始=False),用户id顺序顺序顺序顺序顺序顺序顺序顺序顺序顺序顺序顺序…7.0
[32433710行x 5列],0 196
1 14084
2.
名称:product_id,长度:32433710,数据类型:int64,memmap([1606101618,…,32433707,32433708,32433709]),memmap([0,1,2,…,32190332,32190334,32190356]),10,{'activation':'logistic','alpha':数组([1.00000000e-01,1.00000000e-02,1.0…00000000e-04,1.00000000e-05,1.00000000e-06])),“隐藏层大小”:(10,10,10),“学习率”:“常数”}),{“错误分数”:“提高”,“拟合参数”:{},“返回测试样本”:True,“返回参数”:True,“返回次数”:True,“返回分数”:True)]
132
133定义长度(自):
134返回自我。\u尺寸
135
...........................................................................
C:\Anaconda3\lib\site packages\sklearn\externals\joblib\parallel.py in(.0=)
126定义初始化(自、迭代器切片):
127 self.items=列表(迭代器_切片)
128自身尺寸=长度(自身项目)
129
130 def呼叫(自我):
-->131返回[func(*args,**kwargs),用于self.items中的func、args、kwargs]
func=
args=(MLPClassizer(activation='logistic'),
alph…on_分数=0.1,verbose=False,warm_开始=False),用户id顺序顺序顺序顺序顺序顺序顺序顺序顺序顺序顺序顺序…7.0
[32433710行x 5列],0 196
1 14084
2.
名称:product_id,长度:32433710,数据类型:int64,memmap([1606101618,…,32433707,32433708,32433709]),memmap([0,1,2,…,32190332,32190334,32190356]),10,{'activation':'logistic','alpha':数组([1.00000000e-01,1.00000000e-02,1.0…00000000e-04,1.00000000e-05,1.00000000e-06])),“隐藏层大小”:(10,10,10),“学习率”:“常数”)
kwargs={'error_score':'raise','fit_params':{},'return_n_test_samples':True,'return_parameters':True,'return_times':True,'return_train_score':True}
132
133定义长度(自):
134返回自我。\u尺寸
135
...........................................................................
C:\Anaconda3\lib\site packages\sklearn\model\u selection\u validation.py in\u fit\u和\u score,
alph…on_分数=0.1,verbose=False,warm_开始=False),X=用户id顺序顺序顺序顺序顺序顺序顺序顺序顺序顺序顺序顺序顺序…7.0
[32433710行x 5列],y=0 196
1 14084
2.
名称:product_id,长度:32433710,数据类型:int64,scorer=,train=memmap([1606101618,…,32433707,32433708,32433709]),test=memmap([0,1,2,…,32190332,32190334,32190356]),verbose=10,参数={'activation':'logistic','alpha':数组([1.00000000e-01,1.00000000e-02,1.0…0000000e-04,1.00000000e-05,1.00000000e-06]),“隐藏层大小”:(10,10,10),“学习率”:“常数”},拟合参数={},返回序列分数=真,返回参数=真,返回测试样品=真,返回次数=真,错误分数=提高)
233
234尝试:
235如果y_列车无:
236估算器拟合(X列,**拟合参数)
237其他:
-->238估计值拟合(X_序列,y_序列,**拟合参数)
估计值.fit=
X\u火车=用户id订单号订单订单号订单订单号…7.0
[21606079行x 5列]
y_列=160617762
1610 17762
1618 ...
名称:product_id,长度:21606079,数据类型:int64
拟合参数={}
239
240除e以外的例外情况:
241#将拟合时间记为出错前的时间
242拟合时间=time.time()-开始时间
...........................................................................
C:\Anaconda3\lib\site packages\sklearn\neural\u network\multilayer\u perceptron.py-in-fit(self=mlpclassizer(activation='logistic'),
alph…on_分数=0.1,verbose=False,warm_开始=False),X=用户id顺序顺序顺序顺序顺序顺序顺序顺序顺序顺序顺序顺序顺序…7.0
[21606079行x 5列],y=160617762
1610 17762
1618