Repository navigation
BUG: Fix scalar hidden layer sizes #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -822,3 +822,23 @@ def test_gh_85_classifiers(hidden_layer_sizes, classifier): | |
| clf = classifier(hidden_layer_sizes=hidden_layer_sizes, seed=0) | ||
| with pytest.raises(ValueError, match="must be > 0"): | ||
| clf.fit(X, y) | ||
|
|
||
| @pytest.mark.parametrize( | ||
| "Classifier", | ||
| [GFDLClassifier, EnsembleGFDLClassifier], | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that the target issue concerns |
||
| ) | ||
| def test_scalar_hidden_layer_sizes(Classifier): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is helpful to reference the issue you are writing a test for, i.e., |
||
| X, y = make_classification( | ||
| n_samples=60, | ||
| n_features=10, | ||
| n_informative=5, | ||
| random_state=42, | ||
| ) | ||
|
|
||
| model = Classifier(hidden_layer_sizes=3, seed=0) | ||
| model.fit(X, y) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose if we're being really thorough, we should also test |
||
|
|
||
| predictions = model.predict(X[:5]) | ||
| assert predictions.shape == (5,) | ||
|
|
||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are some |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that, here and elsewhere, you can simplify the call to remove
np.asarray()sinceatleast_1dshould call something similar for array coercion under the hood.