Home > other >  Corss_val_score scoring='accuracy' can perform, use other parameter error
Corss_val_score scoring='accuracy' can perform, use other parameter error

Time:10-07

C: \ Users \ WWWWWW> python
Python 3.6.1 | Anaconda 4.4.0 (64 - bit) | (default, May 11, 2017, 13:25:24) [MSC v. 1900 64 - bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
> the from sklearn. Model_selection import cross_val_score
> the from sklearn. Datasets import load_iris
> the from sklearn. The ensemble import RandomForestClassifier
> forest=RandomForestClassifier (n_estimators=100, random_state=1)
> cross_val_score (forest, load_iris (). The data, load_iris (). The target, scoring='accuracy' , CV=5) [/color]
Array ([0.96666667, 0.96666667, 0.93333333, 0.96666667, 1])
> cross_val_score (forest, load_iris () data, load_iris (). The target, scoring='precision' , CV=5)
Traceback (the most recent call last) :
The File ", line 1, the in the
The File "E: \ DSJ - software \ Anaconda3-4.4.0 \ lib \ site - packages \ sklearn \ model_selection \ _validation py", line 140, in cross_val_score
For train and test the in cv_iter)
The File "E: \ DSJ - software \ Anaconda3-4.4.0 \ lib \ site - packages \ sklearn \ externals \ joblib \ parallel py", line 758, in __call__
While the self. Dispatch_one_batch (iterator) :
The File "E: \ DSJ - software \ Anaconda3-4.4.0 \ lib \ site - packages \ sklearn \ externals \ joblib \ parallel py", line 608, in dispatch_one_batch
Self. _dispatch (tasks)
The File "E: \ DSJ - software \ Anaconda3-4.4.0 \ lib \ site - packages \ sklearn \ externals \ joblib \ parallel py", line 571, in _dispatch
Job=self. _backend. Apply_async batch, the callback=(cb)
The File "E: \ DSJ - software \ Anaconda3-4.4.0 \ lib \ site - packages \ sklearn \ externals \ joblib \ _parallel_backends py", line 109, in apply_async
Result=ImmediateResult (func)
The File "E: \ DSJ - software \ Anaconda3-4.4.0 \ lib \ site - packages \ sklearn \ externals \ joblib \ _parallel_backends py", line 326, in __init__
The self. The results=batch ()
The File "E: \ DSJ - software \ Anaconda3-4.4.0 \ lib \ site - packages \ sklearn \ externals \ joblib \ parallel py", line 131, in __call__
Return [func (* args, * * kwargs) for func, args, kwargs in self. Items]
The File "E: \ DSJ - software \ Anaconda3-4.4.0 \ lib \ site - packages \ sklearn \ externals \ joblib \ parallel py", line 131, in the
Return [func (* args, * * kwargs) for func, args, kwargs in self. Items]
The File "E: \ DSJ - software \ Anaconda3-4.4.0 \ lib \ site - packages \ sklearn \ model_selection \ _validation py", line 260, in _fit_and_score
Test_score=_score (estimator, X_test y_test, scorer)
The File "E: \ DSJ - software \ Anaconda3-4.4.0 \ lib \ site - packages \ sklearn \ model_selection \ _validation py", line 288, in _score
Score=scorer (estimator, X_test y_test)
The File "E: \ DSJ - software \ Anaconda3-4.4.0 \ lib \ site - packages \ sklearn \ metrics \ scorer py", line 98, in __call__
* * self. _kwargs)
The File "E: \ DSJ - software \ Anaconda3-4.4.0 \ lib \ site - packages \ sklearn \ metrics \ classification py", line 1239, in precision_score
Sample_weight=sample_weight)
The File "E: \ DSJ - software \ Anaconda3-4.4.0 \ lib \ site - packages \ sklearn \ metrics \ classification py", line 1018, in precision_recall_fscore_support
"Choose another business setting." % y_type)
ValueError: Target is multiclass but business='binary'. Both Please choose another business setting.
>
  • Related