Optimization without an algebraic equation in python? [closed]

I am really new to this topic of optimization. My question is, if this is actually something that can be done in python.

Let´s say i am using a Data Mining tool in the background, doing complex regressions that cannot be described in an algebraic equation. Python is used to get the estimated result of an dependent variable for a given set of independent variables. So python does not hold the data but it receives the data for a query (this part of my program is working)

Easiest Example:

y=amount of icecream consumed= f(Temperature, Income,...)


so for a dataset i send to the data mining tool (20°C, 1000$) it will return me an estimated value for the amount of icecream consumed. The actual problem is much more complicated. I am unsure which packages, docs and examples could help me to get this started in python. Imagine something similar to the Excel Solver. Which packages in python could be used to answer questions like: find valid values for the other independent variables (Income,...): constraints: y >= 200g T<= 20°C How high must be the income(etc...) of an average person to consume 200g of icecream on a day with a Temperature less than 20°C  1 Answer You may find the scipy.optimize package helpful. It has several routines that can be used to find values$x$for which an arbitrary user defined function$F(x)=0$. If you are able to cleverly reframe your problem such that you are able to define a function$F(x)\$ which becomes equal to zero when the input values (e.g., Income or whatever) attain the desired value which satisfies your other desired constraints, then this package will probably work for you.

Please note that scipy and numpy (a dependency) are not technically part of the standard Python library and are yet well supported in Python 3.x. If you want to use them with 3.x, you will likely have to jump through some hoops with regard to your Python installation, in order to be able to do so. In practice, most people who use scipy/numpy seem to still be using Python 2.7.x. You can obtain a branded version of Python 2.7.x which installs easily and has numpy/scipy conveniently bundled together here. There may also be other competitors providing a similar product as well.

• i am using numpy for the the query to the data-mining tool, i heard of scipy ,but i am not sure if i can "define" a function - do you mean by making a fit? I think this is not possible in my case... i have 16 input variables... but i will give it a try in the next days. Commented Dec 19, 2013 at 23:11