-
Notifications
You must be signed in to change notification settings - Fork 25
Closed
Description
Hello, as I have seen in example pysensor supports sklearn based parameters optimization. In the example, it is shown how the parameter tuning is performed for SSPOR. However, I would like to perform it for SSPOC, but for now I was unable to do so. At the end of optimization it throws me an error: ValueError: w must be a 1D vector; received a vector of dimension 0 which is implemented in pysensors\utils\_optimizers.py. Furthermore, scores which are calculated during grid search are all nan values.
I am attaching simple code snippet in case anyone could help. I hope I will not have to code grid search manually.
model_clf = LinearDiscriminantAnalysis()
model_cs = SSPOC(classifier=model_clf)
param_grid = {
"basis": [ps.basis.Identity(), ps.basis.SVD(), ps.basis.RandomProjection()],
"basis__n_basis_modes": [1,2,3,4,5],
"n_sensors": [5,2,3]
}
cross_val = RepeatedStratifiedKFold(n_splits=5, n_repeats=3, random_state=1)
search = GridSearchCV(estimator = model_cs,
param_grid = param_grid,
scoring = "balanced_accuracy",
n_jobs = -1,
cv = cross_val,
refit = True,
verbose = 0,
)
search.fit(X_train, y_train)
print("---------------------------------------")
print("Best parameters:")
for k, v in search.best_params_.items():
print(f"{k}: {v}")
print("")Metadata
Metadata
Assignees
Labels
No labels