Hello, I am trying to implement my own estimator. It currently seems to be working. My fit() function is of the form
def fit(self, X, y=None): .... # iteratively tune the params .... return self I would like to modify my fit() so that it can print out validation costs as it iterates: def fit(self, X, y=None, X_valid=None, y_valid=None): .... # iteratively tune the params #occasionally print out the cost on the validation set (X_test, y_test) .... return self How would I go about passing the validation set when using a pipeline? I currently have something like this: my_model = MY_MODEL() pipe = Pipeline(steps=[("imputer", imputer), ("scaler", scaler), ('my_model', my_model)]) my_params = dict(my_model__n_epochs = [10, 20]) estimator = GridSearchCV(pipe, my_params, verbose=5, cv=5) estimator.fit(x_train, y_train) If I instead try estimator.fit(x_train, y_train, x_valid, y_valid) then I get an error telling me that fit() does not accept the last two parameters. How can this be done? Thanks
------------------------------------------------------------------------------
_______________________________________________ Scikit-learn-general mailing list Scikit-learn-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/scikit-learn-general