Skip to content

Instantly share code, notes, and snippets.

@drorata
Created July 25, 2017 11:44
Show Gist options
  • Select an option

  • Save drorata/f3f8632f4b0f16dbfb861d791936e182 to your computer and use it in GitHub Desktop.

Select an option

Save drorata/f3f8632f4b0f16dbfb861d791936e182 to your computer and use it in GitHub Desktop.
Minimal example of using
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.4)
parameters = {
'clf__C': [0.01, 0.1, 1, 2, 5, 10, 50, 100],
'clf__class_weight': [
{0: 1, 1: 1},
{0: 2, 1: 1}, {0:1, 1:2},
{0: 5, 1: 1}, {0:1, 1:5}]
}
clf = GridSearchCV(estimator, parameters, cv=15, scoring=make_scorer(recall_score), n_jobs=-1)
clf.fit(X_train, Y_train)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment