示例#1
0
文件: SVM.py 项目: himl/boson
def find_best_rbf_param(data, targets):
    param_grid = {'C': [1, 10, 100, 1e3, 5e3, 1e4, 5e4, 1e5],
                  'gamma': [0.0001, 0.0005, 0.001, 0.005, 0.01, 0.1], }
    estimator = GridSearchCV(svm.SVC(kernel='rbf'), param_grid)
    return cross_validation_for_grid(estimator, data, targets)
示例#2
0
文件: SVM.py 项目: himl/boson
def find_best_linear_param(data, targets):
    # param_grid = [{'C': [1, 10, 100, 1000]}]
    param_grid = [{'C': [1, 2, 3, 4, 5, 6, 7, 8, 9]}]
    estimator = GridSearchCV(svm.SVC(kernel='linear'), param_grid)
    return cross_validation_for_grid(estimator, data, targets)