scipy-optimize-minimize

How to minimize a real function with only integer input

北战南征 提交于 2021-02-11 15:33:03
问题 Which optimization algorithms work for integer input, float output? One thought is just using Brent search but making up a method that interpolates two nearest points to fake a real number input as opposed to an integer input. My second thought is that seems like such a common need, there must already be something in scipy to do it and/or an algorithm more suited for it? Bisect certainly works for this, but for huge inputs, its convergence time could be improved. Something hybrid like Brent

Multi-class Logistic Regression from scratch

这一生的挚爱 提交于 2021-02-10 14:18:14
问题 I am trying to implement from scratch the multiclass logistic regression but my implementation returns bad results. I believe the definition of the gradient function and the cost function is fine. Maybe there is a problem with how these functions are interacting with the minimize function. I have tried it but I could not find out what is wrong. Could you please cast some light? You can add the estimator 'myLR': myLR(**par_dict), with paramters par_dict= {'alpha': 0.1, 'maxit': 2000, 'opt

Multi-class Logistic Regression from scratch

我只是一个虾纸丫 提交于 2021-02-10 14:15:48
问题 I am trying to implement from scratch the multiclass logistic regression but my implementation returns bad results. I believe the definition of the gradient function and the cost function is fine. Maybe there is a problem with how these functions are interacting with the minimize function. I have tried it but I could not find out what is wrong. Could you please cast some light? You can add the estimator 'myLR': myLR(**par_dict), with paramters par_dict= {'alpha': 0.1, 'maxit': 2000, 'opt

Scipy minimisation optimisation row-wise on DataFrame

不羁岁月 提交于 2021-01-29 18:41:12
问题 TYPO FIXEDD I need to perform a minimization optimisation for each timestep in my timeseries. The optimisation sets the price based on values in different columns across the row and a series of inequality constraints. My Dataframe has the following columns across time series of 48 years: ['CAPEX_TOT', 'CAPEX_R', 'CAPEX_WS', 'debt_BP', 'principal','interest', 'debt_service', 'debt_EP', 'OPEX', 'OPEX_R', 'OPEX_WS', 'DELIVERY_BAWSCA', 'DELIVERY_OTHER_DEMAND', 'DELIVERY_SAN_FRANCISCO_CITY',

passing a function with multiple independent variables and multiple arguments to scipy optimize minimize

戏子无情 提交于 2020-03-03 13:59:36
问题 Following this question, I want to make my question as specific as possible focusing on the part that I can not solve. Consider a very simple function of: def foo(x, y, a, b, c): return a * x**4 + b * y**2 + c now I want to use the scipy.optimize.minimize or any of other existing functions to find the x and y (i.e., parameters) to minimize foo given the constants a , b , and c (i.e., args). If I had only one parameter and multiples arguments then from this page I could do: def foo(x, *args):