Python learning_curve function

Source: Internet
Author: User

This function needs to refer to the Sklearn package

Import Sklearn  from Import Learning_curve

The calling format for this function is:

Learning_curve (estimator, X, Y, Train_sizes=array ([0.1  ,  0.325,  0.55,  0.775,  1.   ]), cv= None, Scoring=none, Exploit_incremental_learning=false, N_jobs=1, pre_dispatch='all' , Verbose=0)

The function is: for different sizes of training sets, determine the cross-validation training and test scores. A cross-validation generator divides the entire data set into K-times, dividing it into training sets and test sets. A subset of the different size training sets will be used to train the evaluator and a score will be generated for each training subset of the size, and then the score of the test set is calculated. Then, for each subset of training, all of the scores after running K will be averaged.

Estimator: the classifier used

X: Array-like, Shape (n_samples, N_features)

Training vectors, N_samples is the number of samples, N_features is the number of features

y: array-like, Shape (n_samples) or (N_samples, n_features), optional

Target relative to x classification or regression

train_sizes: Array-like, Shape (n_ticks,), dtype float or int

The relative or absolute numbers of the training samples, the samples of these quantities will generate learning curve. If Dtype is a float, he will be considered part of the maximum number of training sets (this is determined by the authentication method chosen). Otherwise, he will be considered the absolute size of the training set. It is important to note that for classification, the size of the sample must be large enough to contain at least one sample for each classification.

CV: int, cross-validation generator or an iterable, optional

Determine the separation strategy for cross-validation

--none, using the default 3-fold cross-validation,

--integer, make sure it's a few fold cross-validation

--an object that acts as a cross-validation generator

--an iterator that is applied to the training/test separation

Verbose:integer, optional

Control redundancy: The higher, the more information

return value:

train_sizes_abs: Array, shape = (n_unique_ticks,), Dtype int

The number of samples used to generate the training set for learning curve. Because duplicate input will be deleted, ticks may be less than n_ticks.

train_scores : Array, shape (n_ticks, N_cv_folds)

The score on the training set

test_scores : Array, shape (n_ticks, N_cv_folds)

The score on the test set

Python learning_curve function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.