Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ jobs:
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
2 changes: 1 addition & 1 deletion fastcan/narx/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class NARX(MultiOutputMixin, RegressorMixin, BaseEstimator):
... delay_ids=delay_ids).fit(X, y, coef_init="one_step_ahead")
>>> print_narx(narx)
| yid | Term | Coef |
=======================================
|-----|--------------------|----------|
| 0 | Intercept | 1.008 |
| 0 | y_hat[k-1,0] | 0.498 |
| 0 | X[k-2,0] | 0.701 |
Expand Down
6 changes: 3 additions & 3 deletions fastcan/narx/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def print_narx(
>>> X, y = load_diabetes(return_X_y=True)
>>> print_narx(NARX().fit(X, y), term_space=10, coef_space=5, float_precision=0)
| yid | Term |Coef |
========================
|-----|----------|-----|
| 0 |Intercept | 152 |
| 0 | X[k,0] | -10 |
| 0 | X[k,1] |-240 |
Expand Down Expand Up @@ -102,7 +102,7 @@ def _get_term_str(term_feat_ids, term_delay_ids):
+ f"|{'Term':^{term_space}}"
+ f"|{'Coef':^{coef_space}}|"
)
print("=" * (yid_space + term_space + coef_space + 4))
print(f"|{'-'*yid_space}|{'-'*term_space}|{'-'*coef_space}|")
for i in range(narx.n_outputs_):
print(
f"|{i:^{yid_space}}|"
Expand Down Expand Up @@ -246,7 +246,7 @@ def make_narx(
0.0289
>>> print_narx(narx)
| yid | Term | Coef |
=======================================
|-----|--------------------|----------|
| 0 | Intercept | 1.050 |
| 0 | y_hat[k-1,0] | 0.484 |
| 0 | X[k,0]*X[k,0] | 0.306 |
Expand Down
2 changes: 2 additions & 0 deletions fastcan/narx/tests/test_narx.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@ def test_print_narx(capsys):
captured = capsys.readouterr()
# Check if the header is present in the output
assert "| yid | Term | Coef |" in captured.out
# Check if the separator line is present
assert "|-----|--------------------|----------|" in captured.out
# Check if the intercept line for yid 0 is present
assert "| 0 | Intercept |" in captured.out
# Check if the intercept line for yid 1 is present
Expand Down
Loading
Loading