hyperparameters

Writing a custom 'scoring' function for sklearns cross validation

Writing a custom 'scoring' function for sklearns cross validation Question: I’m trying to perform hyperparameter optimisation (Tree Parzen Estimation) for a multilabel classification problem. My output class or target feature is a set of 14 bits each of which can be on or off. The output features are also not balanced and hence I’m trying …

Total answers: 1

sklearn pipeline and grid search

sklearn pipeline and grid search Question: from sklearn.linear_model import LogisticRegression pipe4 = Pipeline([(‘ss’, StandardScaler()), (‘clf’, knn)]) grid2 = GridSearchCV(pipe4, {‘clf’:[ knn, LogisticRegression()]}) grid2.fit(X_train, y_train) pd.DataFrame(grid2.cv_results_).T I made a knn classifier and logistic regression model and wanted to check which model is better through pipeline method. as you can see the code above I put the …

Total answers: 1

Ray | AttributeError: 'BroadModel' object has no attribute 'model'

Ray | AttributeError: 'BroadModel' object has no attribute 'model' Question: I am using ray tune to find to optimal hyperparameters value for this model: class BroadModel(tune.Trainable): os.environ[‘TF_CPP_MIN_LOG_LEVEL’] = ‘3’ def build_model(self, config): global convB2, drop2, convA2, poolA, poolB window_size = 200 self.x_gyro, self.x_acc, x_mag, q = load_data_train() self.Att_quat = Att_q(q) self.x_gyro_t, self.x_acc_t, x_mag_t, q_t = …

Total answers: 2

Is there a way for Optuna `suggest_categorical`to return multiple choices from list?

Is there a way for Optuna `suggest_categorical`to return multiple choices from list? Question: I am using Optuna for hyperparametrization of my model. And I have a field where I want to test multiple combinations from a list. For example: I have ["lisa","adam","test"] and I want suggest_categorical to return not just one, but a random combination: …

Total answers: 1

Optuna hyperparameter search not reproducible with interrupted / resumed studies

Optuna hyperparameter search not reproducible with interrupted / resumed studies Question: For big ML models with many parameters, it is helpful if one can interrupt and resume the hyperparameter optimization search. Optuna allows doing that with the RDB backend, which stores the study in a SQlite database (https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/001_rdb.html#sphx-glr-tutorial-20-recipes-001-rdb-py). However, when interrupting and resuming a study, …

Total answers: 1

How to find the optimum number of estimators using "OOB" method in sklearn boosting?

How to find the optimum number of estimators using "OOB" method in sklearn boosting? Question: The gbm package in R has a function gbm.perf to find the optimum number of trees for the model using different methods like "Out-of-Bag" or "Cross-Validation" error, which helps to avoid over-fitting. Does Gradientboosting inScikit learn library in python also …

Total answers: 1

Store user attributes in Optuna Sweeper plugin for Hydra

Store user attributes in Optuna Sweeper plugin for Hydra Question: How can I store additional information in an optuna trial when using it via the Hydra sweep plugin? My use case is as follows: I want to optimize a bunch of hyperparameters. I am storing all reproducibility information of all experiments (i.e., trials) in a …

Total answers: 1

How to optimize for multiple metrics in Optuna

How to optimize for multiple metrics in Optuna Question: How do I optimize for multiple metrics simultaneously inside the objective function of Optuna. For example, I am training an LGBM classifier and want to find the best hyperparameter set for all common classification metrics like F1, precision, recall, accuracy, AUC, etc. def objective(trial): # Train …

Total answers: 1

How to perform hyper-paramter tunning for SVC?

How to perform hyper-paramter tunning for SVC? Question: I am trying to perform hyper-parameter tuning of my model but this error keeps showing error : Invalid parameter svc_c for estimator SVC(). Check the list of available parameters with `estimator.get_params().keys() I am using the following code : param_grid = {‘svc_c’: [5, 10, 100], ‘svc_gamma’: [1,0.1,0.01,0.001], ‘svc_dgree’: …

Total answers: 2

How to set hyperparameters with a dictionary

How to set hyperparameters with a dictionary Question: model = lightgbm.LGBMClassifier() hyperparameter_dictionary = {‘boosting_type’: ‘goss’, ‘num_leaves’: 25, ‘n_estimators’: 184, …} How do I set the model’s hyperparameters with the dictionary? Thanks! Asked By: Roc || Source Answers: pass the hyperparam dictionary to the model constructor, adding ** to the dict to pass each dict item …

Total answers: 2