在Sklearn中获取变换方程
我有一个 Sklearn 管道模型,在其中我可以使用不同的预处理和线性模型来处理数据,以在最后近似多项式模型。训练后,我想获得模型的方程,其中包括应用的变换,并且在获得预测之前应该不需要进一步的努力来首先使用管道对新数据进行标准化。我了解如何提取模型系数和变量并生成多项式方程,但我很好奇我们是否可以访问变换方程并将变换以及最终方程中的相应参数包含在内?
例如,如果我的数据有两个特征,并且我使用带有线性一阶多项式模型的 Standardscaler,我想要一个如下所示的方程:
eq = a*((x1-mu1)/sigma1) + b*((x2-mu2)/sigma2) + c
其中 a、b 和 c 是模型的参数,mu1、mu2、sigma1、 sigma2 是标准缩放器参数,x1 和 x2 是我的特征。我希望以自动化的方式拥有它,这意味着,在不提供用户转换方程的情况下,我可以使用内置信息与其他预处理方法和模型形成这样的方程。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不。scikit-learn 中没有任何内容提供此类信息。您需要在符号级别上表示所有内容,这不是 scikit-learn 或任何其他标准库完成的。
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.