Skip to content

Commit

Permalink
fix: remove None| and update test_regressor
Browse files Browse the repository at this point in the history
  • Loading branch information
Spencer Sun authored and hmgomes committed May 24, 2024
1 parent 2c2a89d commit 2cc3ba5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/capymoa/stream/_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def __init__(
dataset_name="No_Name",
feature_names=None,
target_name=None,
target_type: None | str = None, # numeric or categorical
target_type: str = None, # numeric or categorical
):
"""Construct a NumpyStream object from a numpy array.
Expand Down Expand Up @@ -417,7 +417,7 @@ def stream_from_file(
path_to_csv_or_arff: str = None,
dataset_name: str = "NoName",
class_index: int = -1,
target_type: None | str = None, # "numeric" or "categorical"
target_type: str = None, # "numeric" or "categorical"
) -> Stream:
"""Create a datastream from a csv or arff file.
Expand Down Expand Up @@ -463,7 +463,7 @@ def _numpy_to_ARFF(
dataset_name: str ="No_Name",
feature_names: str =None,
target_name: str =None,
target_type: None | str = None,
target_type: str = None,
):
"""Converts a numpy X and y into a ARFF format. The code first check if the user has specified the type of the
target values, if not, the code infers whether it is a categorical or numeric target by _target_is_categorical
Expand Down Expand Up @@ -595,7 +595,7 @@ def __init__(
class_index: int = -1,
values_for_class_label: list = None,
target_attribute_name=None,
target_type: None | str = None,
target_type: str = None,
skip_header: bool = False,
delimiter=",",
):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_regressors.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_regressor(learner_constructor, rmse, win_rmse):

def test_none_predict():
"""Test that a prediction of None is handled."""
schema = Schema.from_custom(feature_names=["x"], target_attribute_name="y", enforce_regression=True)
schema = Schema.from_custom(feature_names=["x"], target_attribute_name="y", target_type='numeric')
evaluator = RegressionEvaluator(schema=schema)
win_evaluator = RegressionWindowedEvaluator(schema=schema, window_size=100)
evaluator.update(1.0, None)
Expand Down

0 comments on commit 2cc3ba5

Please sign in to comment.