-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from AutoResearch/159-feat-bms-return-variabl…
…e-number-of-models 159 feat bms return variable number of models
- Loading branch information
Showing
5 changed files
with
36 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,4 +70,4 @@ dmypy.json | |
site/ | ||
|
||
# Jupyter Notebook load data | ||
.ipynb_checkpoints | ||
.ipynb_checkpoints |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import numpy as np | ||
import pytest | ||
|
||
from autora.skl.bms import BMSRegressor | ||
from autora.theorist.bms import Tree | ||
|
||
|
||
@pytest.fixture | ||
def curve_to_fit(): | ||
x = np.linspace(-10, 10, 100).reshape(-1, 1) | ||
y = (x**3.0) + (2.0 * x**2.0) + (17.0 * x) - 1 | ||
return x, y | ||
|
||
|
||
def test_bms_models(curve_to_fit): | ||
x, y = curve_to_fit | ||
regressor = BMSRegressor(epochs=100) | ||
|
||
regressor.fit(x, y) | ||
|
||
print(regressor.models_) | ||
|
||
assert len(regressor.models_) == len(regressor.ts) # Currently hardcoded | ||
for model in regressor.models_: | ||
assert isinstance(model, Tree) |