Hey all - I am trying to figure out how to manually set the coefficients of
a model, but am encountering some inconsistencies in whether this is
possible with sklearn. It seems that some models allow you to do this,
while others don't.

My use case is that I'm fitting a ton of models, and cross-validating each
one 10 times. So I have a 3-D matrix of n_models X n_cvs X n_coef_per_model.

What I want to do is now average across all the CVs, then run another set
of predictions with each model.

I have tried doing this by simply storing a 3-D matrix of coefficient data
from each fit, and another matrix of the intercept of each fit. I then
create an object for the model I want to predict and manually set its
attributes. E.g., model.coef_ = this_coef, model.intercept_ =
this_intercept.

Sometimes this works, but sometimes it doesn't. For example, if I use
LinearSVC as my model, then setting .coef_ works fine. However, if I use
SVC(kernel='linear'), then I get an attribute error when I try to set any
attribute.

Can someone explain the inconsistency in behavior here? Is there a better
way to do things like this in sklearn?

Thanks,
Chris


-- 
_____________________________________

PhD Candidate in Neuroscience | UC Berkeley <http://hwni.org/>
Editor and Web Master | Berkeley Science Review
<http://sciencereview.berkeley.edu/>
_____________________________________
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to