Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

sklearn cross validation score

from sklearn.model_selection import cross_val_score
scores = cross_val_score(classifier_logreg, X_train, y_train, cv = 5, scoring='accuracy')
print('Cross-validation scores:{}'.format(scores))
print('Average cross-validation score: {}'.format(scores.mean()))
Comment

sklearn cross validation score

from sklearn.linear_model import RidgeClassifier
from sklearn.model_selection import cross_val_score

clf = RidgeClassifier() # estimator
score = cross_val_score(clf, X, y, cv=5)

# By default, the score computed at each CV iteration is the score
# method of the estimator. It is possible to change this by using 
# the scoring parameter:

scores = cross_val_score(clf, X, y, cv=5, scoring='f1_macro')
Comment

cross validation sklearn

>>> clf = svm.SVC(kernel='linear', C=1)
>>> scores = cross_validation.cross_val_score(
...    clf, iris.data, iris.target, cv=5)
...
>>> scores                                              
array([ 0.96...,  1.  ...,  0.96...,  0.96...,  1.        ])
Comment

PREVIOUS NEXT
Code Example
Python :: python tkinter frame title 
Python :: python requests with login 
Python :: how to make a radio in python 
Python :: python flask mail 
Python :: how to separate a string or int with comma in python 
Python :: python dictionary to csv 
Python :: scrfoll with selenium python 
Python :: string to datetime python 
Python :: drop nulll python 
Python :: sort dictionary 
Python :: python initialise dataframe 
Python :: hello world py 
Python :: django making a custom 403 page 
Python :: Get the Type 
Python :: python export multiple dataframes to excel 
Python :: discord.py check if message has certain reaction 
Python :: pandas append index ignore 
Python :: adding numbers using python function 
Python :: python smtp email 
Python :: discord.py send messages 
Python :: python program to print prime numbers in an interval 
Python :: python async await 
Python :: numpy generate random 2d array 
Python :: Issue Pandas TypeError: no numeric data to plot 
Python :: plt change grid color 
Python :: ignoring warnings 
Python :: find the first occurrence of item in a list in python 
Python :: python get input from console 
Python :: python get address of object 
Python :: how to save a neural network pytorch 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =