交叉验证(Cross Validation)和网格搜索(Grid Search)在python sklearn里的应用

Theory

  • clearly explain the theory of grid search and cross-validation, with an example about DecisionTree 决策树预测乳腺癌
    ML 入门:交叉验证与网格搜索算法

sklearn - GridSearchCV

  • offical document about extimators
    Developing scikit-learn estimators
  • [recommand] theroy with code!!!
    Python机器学习笔记 Grid SearchCV(网格搜索)
  • clear introduce the GridSearchCV parameters
    • python机器学习库sklearn——参数优化(网格搜索GridSearchCV、随机搜索RandomizedSearchCV、hyperopt)
    • sklearn-GridSearchCV,CV调节超参使用方法
  • also a clear inroduction
    python机器学习库sklearn——参数优化(网格搜索GridSearchCV、随机搜索RandomizedSearchCV、hyperopt)
  • [recommand] including using .pickle to store data!!
    关于sklearn的网格搜索GridSearchCV寻找最优超参数
from sklearn.externals import joblib
# store model
joblib.dump(grid_search.best_estimator_, '/home/yummy/sklearn_model/xxx.pickle')
# load model
model = joblib.load('/home/yummy/sklearn_modle/xxx.pickle')
y_pred = model.predict(X_test)
  • using n_jobs = -1 for parallel computation, so fast!!
elm_gcv = GridSearchCV(elm_model, elm_param_grid, cv=5, scoring='neg_mean_squared_error', verbose = 1, n_jobs = -1)

Example

  • example of DecisionTree
    交叉驗證(Cross Validation)與網格搜尋(Grid Search)的原理及實證分析
  • sklearn中的GridSearchCV()!python中模型里各种参数取值有它方便多了

你可能感兴趣的:(Python,机器学习)