我可以将机器学习模型用作优化问题中的目标函数吗? [英] Can I use a machine learning model as the objective function in an optimization problem?

查看:64
本文介绍了我可以将机器学习模型用作优化问题中的目标函数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据集,我使用Sklearn决策树回归机器学习包为该数据集构建了一个用于预测目的的模型.随后,我尝试利用scipy.optimize包基于给定的约束来求解最小化的解决方案.但是,我不确定是否可以将决策树模型作为优化问题的目标函数.在这种情况下应该采取什么方法?过去,我曾尝试使用线性回归模型(例如LarsCV),但效果很好.但是在线性回归模型中,您基本上可以从模型中提取系数和截点.

I have a data set for which I use Sklearn Decision Tree regression machine learning package to build a model for prediction purposes. Subsequently, I am trying to utilize scipy.optimize package to solve for the minimized solution based on a given constraint. However, I am not sure if I can take the decision tree model as the objective function for the optimization problem. What should be the approach in a situation like this? I have tried linear regression models such as LarsCV in the past and they worked just fine. But in a linear regression model, you can essentially extract the coefficients and interception point from the model.

推荐答案

是;线性回归模型是系数的直接线性函数(其中之一是截距"或偏差").

Yes; a linear regression model is a straightforward linear function of coefficients (one of which is the "intercept" or "bias").

您现在遇到的问题是,更复杂的模型不是那么简单.您需要将模型加载到适当的引擎中.要调用"模型,请向引擎提供输入向量(参数列表的关联),然后等待模型返回预测.

The problem you have now is that a more complex model isn't quite so simple. You need to load the model into an appropriate engine. To "call" the model, you feed that engine the input vector (the cognate of a list of arguments), and wait for the model to return the prediction.

您需要将此过程包装在一个函数调用中,这可能是作为外部系统/Shell命令发出模型加载和处理,并将结果返回到主程序的函数调用.一些应用程序足够大,以至于可以使用侦听器和报告器来实现全口径数据流来处理吞吐量.

You need to wrap this process in a function call, perhaps one that issues the model load and processing as external system / shell commands, and returns the results to your main program. Some applications are large enough that it makes sense to implement a full-bore data stream with listener and reporter to handle the throughput.

这会让你动起来吗?

这篇关于我可以将机器学习模型用作优化问题中的目标函数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆