For prediction in muti model case, partition_columns argument may or may not be provided. If this argument is not provided, the partition columns and values are taken from training.
>>> opt_pred_m = opt_tr_m.predict(data=df_x_classif, label=df_y_classif, num_iteration=20) >>> opt_pred_m.head(3) partition_column_1 partition_column_2 col1 col2 col3 col4 label booster_predict_1 1 10 0.191240730419773 1.97100133015377 -0.298530178457708 0.890194110648821 1 0.9609170779776948 0 10 -1.16999138897268 0.354732459083604 -0.193563184945544 -0.35802804454994 1 0.9358935125840876 1 11 1.61885814289279 0.530672471352164 0.101599080962697 0.914093399898154 0 0.4503489139975592
Booster Wrapper object can be instantiated by passing arguments to the class as follows:
Passing model_file argument
The existing model needs to be saved to a file.
>>> opt_tr_s.save_model("model_file_single_partition") <lightgbm.basic.Booster object at 0x7f5553bbe250>
Instantiate Booster Wrapper object through model_file argument
>>> direct_obj = td_lightgbm.Booster(model_file="model_file_single_partition") >>> direct_obj <lightgbm.basic.Booster object at 0x7f5553c28580>
Use model_str argument if model is already present as string
>>> direct_obj1 = td_lightgbm.Booster(model_str = str_opt) >>> direct_obj1 <lightgbm.basic.Booster object at 0x7f5553b6c220>