Category : lightgbm

It is possible to access the nodes and trees of Light GBM using model._Booster.dump_model()["tree_info"] (see that question Access trees and nodes from LightGBM model). However, for linear_tree=True (https://lightgbm.readthedocs.io/en/latest/Parameters.html#linear_tree), at each leaf of each tree a linear model is trained. How can I get the coefficiens and the offset of these linear models? Source: Python..

Read more

I have written the following code to perform RandomizedSearchCV on LightGBM Classifier Model, but I am getting the following error. ValueError: For early stopping, at least one dataset and eval metric is required for evaluation Code import lightgbm as lgb fit_params={"early_stopping_rounds":30, "eval_metric" : ‘f1’, "eval_set" : [(X_val,y_val)], ‘eval_names’: [‘valid’], ‘verbose’: 100, # ‘categorical_feature’: ‘auto’ } ..

Read more

I am referring to this link for implementing custom_f1 eval_metric but somehow not successful. f1_score metric in lightgbm My code is : def lgb_f1_score(label, preds): #y_true = data.get_label() label= val_y.ravel() #preds = neigh.predict_proba(val_x) preds = preds.reshape(-1, 1) preds = preds.argmax(axis = 1) y_hat = np.where(preds < 0.5, 0, 1) # scikits f1 doesn’t like probabilities ..

Read more

I am new to machine learning and I have checked the answers online but didnt found the exact solution. from math import sqrt from sklearn.metrics import mean_squared_log_error import lightgbm as lgb train_data = lgb.Dataset(X_train, label=y_train) test_data = lgb.Dataset(X_cv, label=y_cv) param = {‘objective’: ‘regression’, ‘boosting’: ‘gbdt’, ‘num_iterations’: 3000, ‘learning_rate’: 0.06, ‘num_leaves’: 40, ‘max_depth’: 24, ‘min_data_in_leaf’:11, ‘max_bin’: ..

Read more

I am getting the error [LightGBM] [Fatal] Check failed: (train_data->num_features()) > (0) for my dataset X with shape (40,7). I am trying to run a gradient boosting for custom loss function Would be grateful for any solution or hints. The error comes up on the line gbm.fit( X_train, y_train, eval_set=[(X_valid, y_valid)], eval_metric=custom_asymmetric_valid, verbose=False, ) Here ..

Read more

Im trying to train a lightGBM model on a dataset consisting of numerical, Categorical and Textual data. However, during the training phase, i get the following error: pipeline.fit(X_train, y_train) and the error is: TypeError: Unknown type of parameter:boosting_type, got:dict Here’s my pipeline: I basically have two textual features, both are some form of names on ..

Read more