Optimizing a model output (Y) with some (X) parameters defined - Printable Version +- Python Forum ( https://python-forum.io)+-- Forum: Python Coding ( https://python-forum.io/forum-7.html)+--- Forum: Data Science ( https://python-forum.io/forum-44.html)+--- Thread: Optimizing a model output (Y) with some (X) parameters defined ( /thread-19130.html) |

Optimizing a model output (Y) with some (X) parameters defined - pierrelouisbescond - Jun-14-2019
Hi Everyone, (Disclaimer: I am quite a beginner onPython and Data Science in general… ) I have designed and published my 1st kernel on Kaggle (here: https://www.kaggle.com/plbescond/quality-prediction-r-0-81-mse-0-12), based on a nice industrial Kaggle dataset (and this is not for a specific competition, just for fun). So I now have a model which I can run to to predict a "Y" (%silicate rate) according to 10 parameters (Xs). Note: the Xs input is an array like this: Now I would like to:1/ find a way to define the values of the 10 Xs to reach a specific Y value 2/ find a way to set values for some Xs (let's say 4 out of 10), set my Y target… and get the corresponding values for the remaining Xs, like this: I have tried to convert the model into a function and optimize it but it does not get me anywhere (probably by a lack of knowledge), like this:filename = 'mining_model.sav' gbr = pickle.load(open(filename, 'rb')) # Parameters Optimization def gbr_function(x): y = gbr.predict(x) return y … and then I tried some different optimization algorithms from "scipy.optimize" with no luck…Anyone who could guide me a bit on how to do that? Thanks, Pierre-Louis |