The following example shows how to create the LGBRegressor object, set parameters, train the model, predict the values, and access attributes.
Create LGBMRegressor object
>>> obj = td_lightgbm.LGBMRegressor(num_leaves=5, n_estimators=15, learning_rate=0.01) >>> obj LGBMRegressor(learning_rate=0.01, n_estimators=15, num_leaves=5)
Set/update parameters
>>> obj.set_params(n_estimators=10) LGBMRegressor(learning_rate=0.01, n_estimators=10, num_leaves=5)
Train the model
>>> obj.fit(df_x_reg, df_y_reg, callbacks=[td_lightgbm.log_evaluation()]) LGBMRegressor(learning_rate=0.01, n_estimators=10, num_leaves=5)
Predict the values
>>> obj.predict(X=df_x_reg) col1 col2 col3 col4 lgbmregressor_predict_1 0.994394391315499 -0.27567053456055 -0.70972796584688 1.73887267745451 -12.0 0.978567297446043 0.025385604406459 0.610391764305413 0.28601252697811 0.0 -1.18468659041155 -0.85172919725359 1.822723600123796 -0.5215796779933 7.0 1.5363770542458 -0.11054065723247 1.020172711715805 -0.6920498477843 7.0 -2.73967716718956 -0.13010695419370 0.093953229385568 0.94304608732251 -3.0 0.378162519602174 1.532779214358461 1.469358769900291 0.15494742569691 7.0 -1.82691137830452 0.917221542115856 -0.05704286766218 0.87672677369045 0.0 -0.37522240076067 0.434807957731158 0.540094460524806 0.73242400975487 0.0 -0.52118931230111 1.364531848102473 -0.68944918454993 -0.6522935999350 -12.0 -0.76157338825655 -2.36417381714118 0.020334181705243 -1.3479254226291 -7.0
Access attributes
>>> obj.feature_importances_ array([ 0, 10, 30, 0], dtype=int32) >>> obj.objective_ 'regression'