// create a segment learning pipeline
width = 100
est = KerasClassifier(build_fn=crnn_model, epochs = 5, batch_size = 256, verbose = 0)pipe = SegPipe(est)
// create a parameter dictionary using the SegPipe API - which is similar to the sklearn API
//
// parameters passed to an estimator in the ``feed`` pipeline are keyed ``f$estimator__parameter``
// parameters passed to an estimator in the ``est`` pipeline are keyed ``e$estimator__parameter``
//
// when the ``feed`` or ``est`` pipeline is not a pipeline, but just a single estimator
// the parameter would be keyed f$parameter or e$parameter respectively
//
// you can also set a parameter to be always equal to another parameter, by setting its value to
// parameter name to track
//
// note that if you want to set a parameter to a single value, it will still need to be as a list
par_grid = {"s$width" : [50,100,200],
"s$overlap" : [0.],
"width" : ["s$width"]}
clf = GridSearchCV(pipe, par_grid, cv=cv)
clf.fit(Xs, ys)
scores = clf.cv_results_["mean_test_score"]
stds = clf.cv_results_["std_test_score"]
plt.plot(par_grid["s$width"], scores, "-o")
plt.title("Grid Search Scores")
After Change
// create a segment learning pipeline
width = 100
pipe = Pype([("seg", SegmentX()),
("crnn", KerasClassifier(build_fn=crnn_model, epochs = 5, batch_size = 256, verbose = 0))])
// create a parameter dictionary using the sklearn API
//
// you can also set a parameter to be always equal to another parameter, by setting its value to
// parameter name to track (this is an extension from sklearn)
//
// note that if you want to set a parameter to a single value, it will still need to be as a list
par_grid = {"seg__width" : [50,100,200],
"seg__overlap" : [0.],
"crnn__width" : ["seg__width"]}
clf = GridSearchCV(pipe, par_grid, cv=cv)
clf.fit(Xs, ys)
scores = clf.cv_results_["mean_test_score"]
stds = clf.cv_results_["std_test_score"]
plt.plot(par_grid["seg__width"], scores, "-o")
plt.title("Grid Search Scores")