Skip to content

Commit

Permalink
Hyperparameters tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
SiddhanthM8055 committed Dec 5, 2021
1 parent 2450346 commit cf1cc1e
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions paraTuning.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from sklearn.model_selection import GridSearchCV

def SGD_tuning(model,X,Y):
params = {
"loss" : ["hinge", "log", "squared_hinge", "modified_huber"],
"alpha" : [0.0001, 0.001, 0.01, 0.1],
"penalty" : ["l2", "l1", "none"],
}

clf = GridSearchCV(model, param_grid=params)

clf.fit(X, Y)
print(clf.best_score_)
print(clf.best_estimator_)

def PAC_tuning(model,X,Y):
params = {
"C" : [1,0.1,0.01,0.001,0.00001,0.000001]
}

clf = GridSearchCV(model,param_grid=params)

clf.fit(X,Y)
print(clf.best_score_)
print(clf.best_estimator_)

def MLP_tuning(model,X,Y):
params = {
"activation" : ["logistic","relu","tanh"],
"alpha" : [0.001,0.0001,0.00001],
"solver" : ["adam","lbfgs","sgd"],
"learning_rate" :["constant","adaptive"]
}

clf = GridSearchCV(model,param_grid=params)

clf.fit(X,Y)
print(clf.best_score_)
print(clf.best_estimator_)

0 comments on commit cf1cc1e

Please sign in to comment.