ORSpecialist
ORSpecialist

Reputation: 401

Object of type CustomScaler is not registered/supported with gurobi_ml

I have built a CustomScaler to scale my data in sklearn.pipeline.make_pipeline. It contained transform and inversetransform function. When I used gurobipy to optimise the regression model, I got the title error. It is not categorically mentioned on Gurobi document that they do not accept CustomScaler, but mentioned many places they accept StandardScalar. Do I need to use different approach to formulate my problem or I can use CustomScalar in gurobipy_ml?

I took the simplest approach and use StandardScalar but used as CustomeScalar, and got

NotRegistred: Object of type CustomScaler is not registered/supported with gurobi_ml.
class CustomScaler(BaseEstimator, TransformerMixin):
    def __init__(self):
        self.scaler = StandardScaler()

    def fit(self, X, y=None):
        return self.scaler.fit(X)

    def transform(self, X):
        return self.scaler.transform(X)

    def inverse_transform(self, X):
        return self.scaler.inverse_transform(X)

Upvotes: 0

Views: 32

Answers (0)

Related Questions