providing the search space for model_parameter_search

User 1765 | 4/15/2015, 12:42:41 PM

I want to start by apologizing for what is a very dumb question :smile:

I'm optimizing a boosted tree classifier. I saw in the help page of the method that I can provide it with the different values of each parameter that I want to vary individually: something like <i class="Italic"><i class="Italic">opt = gl.toolkits.modelparametersearch(gl.boostedtreesclassifier.create, train, test, target = 'label', maxdepth = [5, 10, 20], minchildweight = [1, 5, 10], stepsize = [0.0005, 0.005, 0.05])</i></i>. Is there any way to, instead of doing this, giving the method something like a dict, <i class="Italic"><i class="Italic">searchspace = maxdepth = [5, 10, 20], minchildweight = [1, 5, 10], step_size = [0.0005, 0.005, 0.05]</i></i>, and then passing the dict into the method? I saw something like it on the blog post <a href="">Using Gradient Boosted Trees to Predict Bike Sharing Demand</a>, but somehow am not able to do it myself. :neutral:


User 19 | 4/20/2015, 2:28:27 AM


Yes, you can. If you have <code>searchspace = {maxdepth: [5, 10, 20], minchildweight: [1, 5, 10], stepsize: [0.0005, 0.005, 0.05]} </code> then you should be able to "unpack" the dictionary to have them used as keyword arguments by using the following: <code>gl.toolkits.modelparametersearch(gl.boostedtreesclassifier.create, train, test, **searchspace) </code> See <a href="">this StackOverflow question</a> for more details on this syntax.

Please let me know if you have any trouble with this.