Parenthesis error in the estimators list?
estimators = [('my_regressor', myRegressor(blahblah)),
...]
On 19 May 2015 at 15:47, Pagliari, Roberto <rpagli...@appcomsci.com> wrote:
> I'm trying to add a custom regressor to a pipeline.
> For debugging purposes I commented everything out.
>
> class myRegressor(BaseEstimator, TransformerMixin):
> def __init__(self, k=0, njobs=1, cv=6, nestimators=50):
> pass
>
> def fit(self, X, y=None):
> return self
>
> def transform(self, X):
> return X
>
>
> # main here with some code
> estimators = [('my_regressor'), myRegressor(k=args.k, cv=args.cv),
> ('scaler', preprocessing.StandardScaler()),
> ('rbf', svm.SVC(class_weight='auto',
> kernel='rbf',
> random_state=i))]
> try:
> clf_pipeline = Pipeline(estimators)
> parameters = dict(rbf__C=c_range,
> rbf__gamma=gamma_range)
> clf = grid_search.GridSearchCV(clf_pipeline,
> param_grid=parameters,
> cv=args.cv,
> n_jobs=args.njobs)
> clf.fit(x_train, y_train)
> except Exception, e:
> print "Could not complete grid search (rbf SVM)"
> print str(e)
> sys.exit(1)
>
> With the code below, I'm getting:
> Could not complete grid search (rbf SVM)
> dictionary update sequence element #0 has length 18; 2 is required
>
> The problem seems to be myRegressor, because gridsearch does complete
> without it in the pipeline.
>
> I've done this before and I'm not sure what I'm doing wrong here.
>
> Thank you,
>
>
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general