0
$\begingroup$

I trained a decision tree with weights using RandomizedSearchCV:

skf = StratifiedKFold(n_splits=5, shuffle=True, random_state=2019)
grid = RandomizedSearchCV(tree, params,
                          n_iter=100, scoring="average_precision",
                          cv=skf, verbose=1,
                          n_jobs=-1, random_state=2019)
grid.fit(X_train, y_train, weights)

Then I used

model = grid.best_estimator_
y_pred = model.predict(X_test)

to check model performance on test set. However, when I refitted best estimator:

model = grid.best_estimator_
model.fit(X_train, y_train, weights)

and set the threshold to 0.999, I saw an improvement by almost 10%. My question: Is that aproach correct? Do I have to retrain the model when using weights or is there a way to do it automatically?

$\endgroup$
0
$\begingroup$

You don't have to refit it twice. It's enough if you do it once.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.