使用重采样方法调整超参数的包
tuneRs的Python项目详细描述
超参数调谐器
tuners是一个小软件包,用于使用重采样方法而不是常规交叉验证来调整超参数。使用重采样方法估计模型精度比使用k倍交叉验证要快得多——尽管重采样往往比交叉验证更低估精度。然而,重采样低估了consistent方式的准确性,这仍然使得它对于调整超参数很有价值。由于它的一致性,选择基于集合样本的超参数仍然在最大的邻域内,但速度快得多。这是一个帮助你到达目的地的包裹。
gridsearchresample使用网格搜索方法优化超参数。
randomSearchResample使用随机搜索方法优化超参数。
当前版本是v0.55
此软件包目前处于初级阶段,非常简单
安装
使用包管理器pip安装调谐器。
pip install tuneRs
用法
这两个类都是为了模拟scikit学习调谐器(在一定程度上)。一个简单的例子是:
import tuneRs
model = SVC(kernel='rbf')
parameters = {["gamma": [0.001, 0.01, 0.1, 1.0, 10.0],
"C": [0.01, 0.1, 1.0, 10.0, 100.0, 1000.0]}
# Set up for a random hyperparameter search
tuner = tuneRs.RandomSearchResample(model, parameters, num_iters=300, sample_size=0.3, num_samples=12)
# Fit the tuner
tuner.fit(X_train, y_train)
# Display the best parameters found
tuner.best_params_
# Display the aggregate resample score of the best parameters <br/>
tuner.best_score_
# Define our new model
model = tuner.best_estimator_
# Plot the resample accuracy distribution for the model with best hyperparameters <br/>
tuner.plot_best()
未来计划
目前计划添加多个调谐器。下一个是贝叶斯搜索方法。网格搜索和随机搜索的动态版本目前正在开发中,它在数据空间越来越小的区域上迭代多次。
许可证
哈哈