简体   繁体   English

我可以在Scipy中使用SQP(顺序二次规划)进行神经网络回归优化吗?

[英]Can I use SQP(Sequential quadratic programming) in scipy for neural network regression optimization?

As title, after training and testing my neural network model in python. 作为标题,在训练和测试我的Python神经网络模型之后。

Can I use SQP function in scipy for neural network regression problem optimization? 我可以在scipy使用SQP函数来优化神经网络回归问题吗?

For example, I am using temperature,humid,wind speed ,these three feature for input,predicting energy usage in some area. 例如,我使用温度,湿度,风速这三个功能进行输入,从而预测某些区域的能耗。

So I use neural network to model these input and output's relationship, now I wanna know some energy usage lowest point, what input feature are(ie what temperature,humid,wind seed are).This just example so may sound unrealistic. 因此,我使用神经网络对这些输入和输出之间的关系进行建模,现在我想知道一些能源使用的最低点,什么输入功能(即什么温度,湿度,风能)。这只是一个例子,听起来似乎不切实际。

Because as far as I know, not so many people just use scipy for neural network optimization. 因为据我所知,没有多少人只是将scipy用于神经网络优化。 But in some limitation , scipy is the most ideal optimization tool what I have by now(ps: I can't use cvxopt ). 但是在某些限制下, scipy是我目前拥有的最理想的优化工具(ps:我不能使用cvxopt )。

Can someone give me some advice? 有人可以给我一些建议吗? I will be very appreciate! 我将不胜感激!

Sure, that's possible, but your question is too broad to give a complete answer as all details are missing. 当然可以,但是由于缺少所有细节,您的问题过于笼统,无法给出完整的答案。

But: SLSQP is not the right tool! 但是:SLSQP不是正确的工具!

  • There is a reason, NN training is dominated by first-order methods like SGD and all it's variants 有一个原因, NN训练主要由 SGD等一阶方法及其所有变体主导
    • Fast calculation of gradients and easy to do in mini-batch mode (not paying for the full gradient; less memory) 快速计算梯度,并且易于在小批量模式下进行(不支付全部梯度;更少的内存)
    • Very different convergence theory for Stochastic-Gradient-Descent which is usually much better for large-scale problems 随机梯度下降的收敛理论大不相同,通常对于大规模问题而言更好
    • In general: fast iteration speed (eg time per epoch) while possibly needing more epochs (for full convergence) 通常:迭代速度快(例如每个时期的时间),同时可能需要更多的时期(用于完全收敛)
  • NN is unconstrained continuous optimization NN是无约束的连续优化
    • SLSQP is a very general optimization able to tackle constraints and you will pay for that (performance and robustness) SLSQP是一种非常通用的优化,能够解决约束,您将为此付出代价(性能和健壮性)
    • LBFGS is actually the only tool (which i saw) sometimes used to do that (and also available in scipy) LBFGS实际上是有时用来做到这一点的唯一工具(我见过)(也可以在scipy中使用)
      • It's a bound-constrained optimizer (no general constraints as SLSQP) 这是一个受限约束的优化器(没有像SLSQP这样的一般约束)
      • It approximates the inverse-hessian and therefore memory-usage is greatly reduced compared to BFGS and also SLSQP 与BFGS以及SLSQP相比,它近似于逆荷西式,因此大大减少了内存使用
    • Both methods are full-batch methods (opposed to the online/minibatch nature of S GD 两种方法都是全批次方法(与S GD的在线/小批量性质相反)
      • They are also using Line-searches or something similar which results less hyper-parameters to tune: no learning-rates! 他们还使用线搜索或类似的方法来减少需要调整的超参数:没有学习率!

I think you should stick to SGD and it's variants. 我认为您应该坚持使用SGD及其变体。

If you want to go for the second-order approach: learn from sklearn's implementation using LBFGS 如果您想采用二阶方法: 从sklearn的LBFGS实现中学习

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM