Skip to content

Instantly share code, notes, and snippets.

@talperetz
Last active July 1, 2023 22:25
Show Gist options
  • Star 55 You must be signed in to star a gist
  • Fork 28 You must be signed in to fork a gist
  • Save talperetz/6030f4e9997c249b09409dcf00e78f91 to your computer and use it in GitHub Desktop.
Save talperetz/6030f4e9997c249b09409dcf00e78f91 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ralanburnett
Copy link

I am also getting the same error as billy-odera:
TypeError: cv() got an unexpected keyword argument 'metrics'
for both default_cb_optimizer.evaluate_model(), cb_optimal_values = cb_optimizer.optimize(params_space) and
one_cb_optimal_values = one_cb_optimizer.optimize(params_space, max_evals=40, n_random_starts=4)

@ralanburnett
Copy link

I got the Catboost portion of the code to run by removing metric = 'auc' in the evaluate_model method for CatboostOptimizer. However, this makes the score way out of whack (score on default params is 0.984 …).

@jhmenke
Copy link

jhmenke commented Jun 4, 2019

@talperetz: You are not passing the categorical_column_indices to your CatboostOptimizer instances

@akatasonov
Copy link

I got the Catboost portion of the code to run by removing metric = 'auc' in the evaluate_model method for CatboostOptimizer. However, this makes the score way out of whack (score on default params is 0.984 …).

The CatboostOptimizer class is not going to work with the recent version of Catboost as is. First test_scores = validation_scores.iloc[:, 2] should be changed to test_scores = validation_scores.iloc[:, 1] since the index 2 corresponds to the standard deviation of the metric, which we don't optimize for. Also, if your metric is not AUC (RMSE for example) then you need to replace best_metric = test_scores.max() with best_metric = test_scores.min() and return best_metric vs 1-best_metric since we're minimizing the RMSE and not the different between 1 and our AUC (which is almost always < 1)

@ralanburnett
Copy link

Can you explain where the 3-fold AUC data is coming from (how this is calculated)? I can figure out how to get AUC for validation data (for Catboost) but not for test data.

@iamrishabhjain25
Copy link

Hi. Could this code word for a dataset which has non numerical features like sex, city, profession ? And if yes, how ?

@talperetz
Copy link
Author

Sure thing. This dataset holds only categorical features.
You can see how I treat it here:
catboost.Pool(self.X_train, self.y_train, cat_features=self.categorical_columns_indices),
You can also take a look here at Catboost examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment