Mojmal
Mojmal

Reputation: 33

Get transformation equation in Sklearn

I have a Sklearn pipelined model in which I can process the data using different preprocessing and a linear model to approximate a polynomial model at the end. After training, I'd like to obtain the model's equation, which includes the applied transformations, and there should be no further effort required to first normalize the new data with the pipeline before obtaining the prediction. I understand how to extract the model coefficients and variables and generate the polynomial equation, but I'm curious whether we can access the transformation equation and include the transformation along with the corresponding parameters within the final equation?

For example, if my data has two features and I use the Standardscaler with a linear first order polynomial model, I want an equation that looks like this:

eq = a*((x1-mu1)/sigma1) + b*((x2-mu2)/sigma2) + c

where a, b, and c are the model's parameters, and mu1, mu2, sigma1, sigma2 are the standard scaler parameters, and x1 and x2 are my features. I would like to have it in an automated fashion, which means, without providing the equation of the transformation by a user, I can use the built-in information to form equations like this with other preprocessing methods and models.

Upvotes: 0

Views: 256

Answers (1)

lejlot
lejlot

Reputation: 66815

No. Nothing in scikit-learn provides such information. You would need to represent everything on symbolic level, which is not done by scikit-learn or any other standard library.

Upvotes: 0

Related Questions