Time taken to execute an embedded ML constraint
OngoingHi,
I am embedding a trained random forest regressor into a non-convex MIQCP optimization model. I need to do multiple runs of this optimization model with different inputs to the ML embedded constraint. To give more details on the complexity of the model, one particular instance has 63491 continuous, 84936 integer (83472 binary) variables and 3 quadratic constraints and 60795 general constraints. It takes about 10 hours to just execute the following ML constraint for a specific run:
add_random_forest_regressor_constr(or_model, rfg_model, X_input, d_r)
Is there a way to improve the overall runtime of the or model?
Thanks!
-
Hi,
Thanks for your interest in Gurobi ML. Sorry to hear that it is taking so long.
We sometime had cases where generating the models for random forest or gradient boosting regressions would take some time but never this dramatic.
Could you please share the size of the random forest model (number of estimators and the maximal size of the estimators) and the size of the \(\texttt{X_input}\) array?
There are two optional parameters to \(\texttt{add_random_forest_regressor_constr}\) that may be of some help. With \(\texttt{verbose=True}\) you will at lest have some output during the construction of the models (if the model is large it will be a lot of output). With \(\texttt{no_debug=True}\), the package will skip giving name to variable for each estimator.
Best regards and thanks for reporting your issue.
0 -
Hi Pierre,
Thank you for responding. I can share the statistics for another instance that I ran which took 3hrs and 35 mins. It embeds a trained random forest regressor constraint into the OR model. The n_estimators is 1000 and max_features = 5. The X_input array shape is (11, 1321).
I will try the two optional parameters in the add_random_forest_regressor_constr.
Thanks!
Neha.
0 -
Hi,
Can someone help with this problem?
Thank you!
Neha.
0
Please sign in to leave a comment.
Comments
3 comments