Cross-validation

Cross-validation in ScikitLearn.jl is the same as in scikit-learn:

julia> using ScikitLearn.CrossValidation: cross_val_score

julia> cross_val_score(LogisticRegression(max_iter=150), X, y; cv=5)  # 5-fold
5-element Array{Float64,1}:
 0.9666666666666667
 1.0
 0.9333333333333333
 0.9666666666666667
 1.0

See ?cross_val_score and the user guide for details.

We support all the scikit-learn cross-validation iterators (KFold, StratifiedKFold, etc.) For example:

julia> ScikitLearn.CrossValidation.KFold(10, n_folds=3)
3-element Array{Tuple{Array{Int64,1},Array{Int64,1}},1}:
 ([5, 6, 7, 8, 9, 10], [1, 2, 3, 4])
 ([1, 2, 3, 4, 8, 9, 10], [5, 6, 7])
 ([1, 2, 3, 4, 5, 6, 7], [8, 9, 10])

These iterators can be passed to cross_val_score's cv argument.

Note: the most common iterators have been translated to Julia. The others still require scikit-learn (python) to be installed.

Examples

Cross-validated predictions

cross_val_predict performs cross-validation and returns the test-set predicted values. Documentation here

Examples