Advertisement
Guest User

Untitled

a guest
Apr 10th, 2018
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.63 KB | None | 0 0
  1. TypeError Traceback (most recent call last)
  2. <ipython-input-16-6d428d99dd54> in <module>()
  3. ----> 1 cross_validate(clf, x_train, y_train, scoring='accuracy', return_train_score = True)
  4.  
  5. C:\ProgramData\Anaconda3\lib\site-packages\sklearn\model_selection\_validation.py in cross_validate(estimator, X, y, groups, scoring, cv, n_jobs, verbose, fit_params, pre_dispatch, return_train_score)
  6. 204 fit_params, return_train_score=return_train_score,
  7. 205 return_times=True)
  8. --> 206 for train, test in cv.split(X, y, groups))
  9. 207
  10. 208 if return_train_score:
  11.  
  12. C:\ProgramData\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in __call__(self, iterable)
  13. 777 # was dispatched. In particular this covers the edge
  14. 778 # case of Parallel used with an exhausted iterator.
  15. --> 779 while self.dispatch_one_batch(iterator):
  16. 780 self._iterating = True
  17. 781 else:
  18.  
  19. C:\ProgramData\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in dispatch_one_batch(self, iterator)
  20. 623 return False
  21. 624 else:
  22. --> 625 self._dispatch(tasks)
  23. 626 return True
  24. 627
  25.  
  26. C:\ProgramData\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in _dispatch(self, batch)
  27. 586 dispatch_timestamp = time.time()
  28. 587 cb = BatchCompletionCallBack(dispatch_timestamp, len(batch), self)
  29. --> 588 job = self._backend.apply_async(batch, callback=cb)
  30. 589 self._jobs.append(job)
  31. 590
  32.  
  33. C:\ProgramData\Anaconda3\lib\site-packages\sklearn\externals\joblib\_parallel_backends.py in apply_async(self, func, callback)
  34. 109 def apply_async(self, func, callback=None):
  35. 110 """Schedule a func to be run"""
  36. --> 111 result = ImmediateResult(func)
  37. 112 if callback:
  38. 113 callback(result)
  39.  
  40. C:\ProgramData\Anaconda3\lib\site-packages\sklearn\externals\joblib\_parallel_backends.py in __init__(self, batch)
  41. 330 # Don't delay the application, to avoid keeping the input
  42. 331 # arguments in memory
  43. --> 332 self.results = batch()
  44. 333
  45. 334 def get(self):
  46.  
  47. C:\ProgramData\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in __call__(self)
  48. 129
  49. 130 def __call__(self):
  50. --> 131 return [func(*args, **kwargs) for func, args, kwargs in self.items]
  51. 132
  52. 133 def __len__(self):
  53.  
  54. C:\ProgramData\Anaconda3\lib\site-packages\sklearn\externals\joblib\parallel.py in <listcomp>(.0)
  55. 129
  56. 130 def __call__(self):
  57. --> 131 return [func(*args, **kwargs) for func, args, kwargs in self.items]
  58. 132
  59. 133 def __len__(self):
  60.  
  61. C:\ProgramData\Anaconda3\lib\site-packages\sklearn\model_selection\_validation.py in _fit_and_score(estimator, X, y, scorer, train, test, verbose, parameters, fit_params, return_train_score, return_parameters, return_n_test_samples, return_times, error_score)
  62. 486 fit_time = time.time() - start_time
  63. 487 # _score will return dict if is_multimetric is True
  64. --> 488 test_scores = _score(estimator, X_test, y_test, scorer, is_multimetric)
  65. 489 score_time = time.time() - start_time - fit_time
  66. 490 if return_train_score:
  67.  
  68. C:\ProgramData\Anaconda3\lib\site-packages\sklearn\model_selection\_validation.py in _score(estimator, X_test, y_test, scorer, is_multimetric)
  69. 521 """
  70. 522 if is_multimetric:
  71. --> 523 return _multimetric_score(estimator, X_test, y_test, scorer)
  72. 524 else:
  73. 525 if y_test is None:
  74.  
  75. C:\ProgramData\Anaconda3\lib\site-packages\sklearn\model_selection\_validation.py in _multimetric_score(estimator, X_test, y_test, scorers)
  76. 551 score = scorer(estimator, X_test)
  77. 552 else:
  78. --> 553 score = scorer(estimator, X_test, y_test)
  79. 554
  80. 555 if hasattr(score, 'item'):
  81.  
  82. C:\ProgramData\Anaconda3\lib\site-packages\sklearn\metrics\scorer.py in __call__(self, estimator, X, y_true, sample_weight)
  83. 99 super(_PredictScorer, self).__call__(estimator, X, y_true,
  84. 100 sample_weight=sample_weight)
  85. --> 101 y_pred = estimator.predict(X)
  86. 102 if sample_weight is not None:
  87. 103 return self._sign * self._score_func(y_true, y_pred,
  88.  
  89. C:\ProgramData\Anaconda3\lib\site-packages\sklearn\ensemble\voting_classifier.py in predict(self, X)
  90. 223 lambda x: np.argmax(
  91. 224 np.bincount(x, weights=self._weights_not_none)),
  92. --> 225 axis=1, arr=predictions)
  93. 226
  94. 227 maj = self.le_.inverse_transform(maj)
  95.  
  96. C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\shape_base.py in apply_along_axis(func1d, axis, arr, *args, **kwargs)
  97. 130 except StopIteration:
  98. 131 raise ValueError('Cannot apply_along_axis when any iteration dimensions are 0')
  99. --> 132 res = asanyarray(func1d(inarr_view[ind0], *args, **kwargs))
  100. 133
  101. 134 # build a buffer for storing evaluations of func1d.
  102.  
  103. C:\ProgramData\Anaconda3\lib\site-packages\sklearn\ensemble\voting_classifier.py in <lambda>(x)
  104. 222 maj = np.apply_along_axis(
  105. 223 lambda x: np.argmax(
  106. --> 224 np.bincount(x, weights=self._weights_not_none)),
  107. 225 axis=1, arr=predictions)
  108. 226
  109.  
  110. TypeError: Cannot cast array data from dtype('float64') to dtype('int64') according to the rule 'safe'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement