Skip to main content

Trouble Calculating Exponential Value of a ColumnTransformerConstr Object

Answered

Comments

1 comment

  • Pierre Bonami
    Gurobi Staff Gurobi Staff

    Hi,

    I am not sure what you want to do but the lines of codes that you show are not supposed to work.

    The object `ColumnTransformerConstr` stores the data to embed a ColumnTransformer in a Gurobi model. That would be decision variables and constraints describing the column transformation. As such, it doesn't have values to which you could apply the exponential.

    After the model is solved with Gurobi, you could apply `np.exp` to the values of the input variables or output variables. That would be using `np.exp(pred_constr.input_values())` (resp. `np.exp(pred_constr.output_values()`).

    If you want to add to your model variables representing the exponential or logarithm of other variables, you should use general constraints (c.f. https://www.gurobi.com/documentation/10.0/refman/constraints.html#subsubsection:GenConstrFunction) to create those, but that's currently not done by Gurobi ML.

    I hope this helps. If you have a more detailed description maybe I can tell you more precisely if it is doable.

    Best regards,

    Pierre

    2

Please sign in to leave a comment.