Python Forum
Optimizing a model output (Y) with some (X) parameters defined
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Optimizing a model output (Y) with some (X) parameters defined
Hi Everyone,
(Disclaimer: I am quite a beginner onPython and Data Science in general… Smile )

I have designed and published my 1st kernel on Kaggle (here:, 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:
[[-0.33660127 0.61050275 -0.19441589 -0.1988209 0.3357553 0.16947863 0.11750669 -0.09867687 0.29995688 0.03718947]]
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:
[[-0.3 (defined) X2? X3? X4? X5? 0.2 (defined) X7? X8? 0.4 (defined) 0.05(defined)]]
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?

Possibly Related Threads…
Thread Author Replies Views Last Post
  Making a Basic Keras Model - Input Shape and Parameters MattKahn13 0 849 Aug-16-2020, 04:36 PM
Last Post: MattKahn13

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020