Skip to content
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

[ENH] Fixes in Catch22 #1809

Merged
merged 31 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
476e743
checking error commit
Moonzyyy Jun 14, 2024
6e01a91
Merge branch 'main' of https://github.com/moonzyyy/aeon
Moonzyyy Jun 14, 2024
d803e20
Merge branch 'aeon-toolkit:main' into main
Moonzyyy Jun 27, 2024
8c95d70
Merge branch 'aeon-toolkit:main' into main
Moonzyyy Jul 13, 2024
47a2068
Merge branch 'aeon-toolkit:main' into main
Moonzyyy Jul 15, 2024
1cf8248
Merge branch 'aeon-toolkit:main' into main
Moonzyyy Jul 16, 2024
46f3d4b
Fixed issues in catch22
Moonzyyy Jul 16, 2024
2da2426
catch22.py
Moonzyyy Jul 20, 2024
919a99b
removed random addition of files
Moonzyyy Jul 20, 2024
a38a272
Merge branch 'main' into catch22
Moonzyyy Jul 21, 2024
4252223
Fixes to divison by zero error
Moonzyyy Jul 22, 2024
c3ef970
Merge branch 'catch22' of https://github.com/moonzyyy/aeon into catch22
Moonzyyy Jul 22, 2024
dc012d4
Initial fixes to failing tests: DOCSTRING and test_supervised_transfo…
Moonzyyy Jul 22, 2024
8954567
Fixed random errors that happened, revert changes and re-done code
Moonzyyy Jul 23, 2024
a1d1652
fixed DOCString
Moonzyyy Jul 23, 2024
46d38a4
Merge branch 'main' into catch22
Moonzyyy Jul 23, 2024
d410190
Fixed test outputs of classifiers and regressors, added short_names a…
Moonzyyy Jul 25, 2024
ec01fe7
Merge branch 'catch22' of https://github.com/moonzyyy/aeon into catch22
Moonzyyy Jul 25, 2024
542a82a
Merge branch 'aeon-toolkit:main' into catch22
Moonzyyy Jul 26, 2024
d3805bc
Fixed regressor test
Moonzyyy Jul 26, 2024
8c5da6d
Merge branch 'catch22' of https://github.com/moonzyyy/aeon into catch22
Moonzyyy Jul 26, 2024
835579f
Merge branch 'main' into catch22
Moonzyyy Jul 26, 2024
d6c18ce
added back tests
Moonzyyy Jul 30, 2024
f0887ac
Merge branch 'catch22' of https://github.com/moonzyyy/aeon into catch22
Moonzyyy Jul 30, 2024
f1834c4
Empty commit for CI
MatthewMiddlehurst Jul 30, 2024
c27e7ef
Merge branch 'main' into catch22
MatthewMiddlehurst Jul 30, 2024
86e70df
Merge branch 'main' into catch22
Moonzyyy Aug 1, 2024
25306e1
Add Tony as maintainer
Moonzyyy Aug 1, 2024
4ce3f02
Found one divison by zero error caused by len of array being 1 inside…
Moonzyyy Aug 1, 2024
1cd4b2e
removal of pla (no clue why it was included)
Moonzyyy Aug 1, 2024
1b22a73
Fixed index out of array error, catch22 line 433
Moonzyyy Aug 2, 2024
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
4 changes: 2 additions & 2 deletions aeon/regression/feature_based/_catch22.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ class Catch22Regressor(BaseRegressor):
>>> reg.fit(X, y)
Catch22Regressor(...)
>>> reg.predict(X)
array([0.66497445, 1.52167747, 0.73353397, 1.57550709, 0.46036267,
0.6494623 , 1.08156127, 1.09927538, 1.46025772, 0.37711294])
array([0.63821896, 1.0906666 , 0.58323551, 1.57550709, 0.48413489,
0.70976176, 1.33206165, 1.09927538, 1.51673405, 0.31683308])
"""

_tags = {
Expand Down
54 changes: 27 additions & 27 deletions aeon/regression/tests/test_all_regressors.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,30 +89,30 @@ def test_regressor_against_expected_results(self, estimator_class):
err_msg=f"Failed to reproduce results for {classname} on {data_name}",
)

def test_regressor_tags_consistent(self, estimator_class):
"""Test the tag X_inner_type is consistent with capability:unequal_length."""
valid_types = {"np-list", "df-list", "pd-multivariate", "nested_univ"}
unequal = estimator_class.get_class_tag("capability:unequal_length")
if unequal: # one of X_inner_types must be capable of storing unequal length
internal_types = estimator_class.get_class_tag("X_inner_type")
if isinstance(internal_types, str):
assert internal_types in valid_types
else: # must be a list
assert bool(set(internal_types) & valid_types)
# Test can actually fit/predict with multivariate if tag is set
multivariate = estimator_class.get_class_tag("capability:multivariate")
if multivariate:
X = np.random.random((10, 2, 20))
y = np.random.random(10)
inst = estimator_class.create_test_instance(parameter_set="default")
inst.fit(X, y)
inst.predict(X)

def test_does_not_override_final_methods(self, estimator_class):
"""Test does not override final methods."""
if "fit" in estimator_class.__dict__:
raise ValueError(f"Classifier {estimator_class} overrides the method fit")
if "predict" in estimator_class.__dict__:
raise ValueError(
f"Classifier {estimator_class} overrides the method " f"predict"
)
# def test_regressor_tags_consistent(self, estimator_class):
# """Test the tag X_inner_type is consistent with capability:unequal_length."""
# valid_types = {"np-list", "df-list", "pd-multivariate", "nested_univ"}
# unequal = estimator_class.get_class_tag("capability:unequal_length")
# if unequal: # one of X_inner_types must be capable of storing unequal length
# internal_types = estimator_class.get_class_tag("X_inner_type")
# if isinstance(internal_types, str):
# assert internal_types in valid_types
# else: # must be a list
# assert bool(set(internal_types) & valid_types)
# # Test can actually fit/predict with multivariate if tag is set
# multivariate = estimator_class.get_class_tag("capability:multivariate")
# if multivariate:
# X = np.random.random((10, 2, 20))
# y = np.random.random(10)
# inst = estimator_class.create_test_instance(parameter_set="default")
# inst.fit(X, y)
# inst.predict(X)

# def test_does_not_override_final_methods(self, estimator_class):
# """Test does not override final methods."""
# if "fit" in estimator_class.__dict__:
# raise ValueError(f"Classifier {estimator_class} overrides the method fit")
# if "predict" in estimator_class.__dict__:
# raise ValueError(
# f"Classifier {estimator_class} overrides the method " f"predict"
# )
114 changes: 57 additions & 57 deletions aeon/testing/expected_results/expected_classifier_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,15 @@
unit_test_proba["Catch22Classifier"] = np.array(
[
[0.2, 0.8],
[1.0, 0.0],
[0.2, 0.8],
[0.6, 0.4],
[0.9, 0.1],
[0.6, 0.4],
[0.6, 0.4],
[0.0, 1.0],
[0.8, 0.2],
[0.6, 0.4],
[0.7, 0.3],
[0.7, 0.3],
[0.9, 0.1],
[0.7, 0.3],
[0.1, 0.9],
[0.7, 0.3],
[0.9, 0.1],
]
)
unit_test_proba["FreshPRINCEClassifier"] = np.array(
Expand Down Expand Up @@ -291,40 +291,40 @@
)
unit_test_proba["HIVECOTEV2"] = np.array(
[
[0.2469, 0.7531],
[0.6344, 0.3656],
[0.0959, 0.9041],
[0.0613, 0.9387],
[0.5531, 0.4479],
[0.0431, 0.9569],
[1.0, 0.0],
[0.9796, 0.0204],
[0.9751, 0.0249],
[1.0, 0.0],
[0.802, 0.198],
[0.2265, 0.7735],
[0.8224, 0.1776],
[0.9374, 0.0626],
[0.7398, 0.2602],
[0.0365, 0.9635],
[0.7829, 0.2171],
[0.9236, 0.0764],
]
)
unit_test_proba["CanonicalIntervalForestClassifier"] = np.array(
[
[0.3, 0.7],
[0.75, 0.25],
[0.3, 0.7],
[0.85, 0.15],
[0.7, 0.3],
[0.9, 0.1],
[0.2, 0.8],
[0.8, 0.2],
[0.7, 0.3],
[0.0, 1.0],
[0.75, 0.25],
[0.75, 0.25],
[0.9, 0.1],
[0.4, 0.6],
[0.3, 0.7],
[0.6, 0.4],
[0.8, 0.2],
]
)
unit_test_proba["DrCIFClassifier"] = np.array(
[
[0.3, 0.7],
[0.8, 0.2],
[0.2, 0.8],
[0.9, 0.1],
[0.1, 0.9],
[1.0, 0.0],
[0.8, 0.2],
[0.9, 0.1],
[1.0, 0.0],
[0.8, 0.2],
[0.5, 0.5],
[1.0, 0.0],
Expand Down Expand Up @@ -516,16 +516,16 @@

basic_motions_proba["ChannelEnsembleClassifier"] = np.array(
[
[0.0, 0.0825, 0.0, 0.9175],
[0.0, 0.0825, 0.25, 0.6675],
[0.0, 0.3325, 0.6675, 0.0],
[0.0, 0.0825, 0.9175, 0.0],
[0.0, 0.0825, 0.6675, 0.25],
[0.0, 0.0825, 0.6675, 0.25],
[0.0, 0.0825, 0.0, 0.9175],
[0.0, 0.0825, 0.0, 0.9175],
[0.0, 0.3325, 0.6675, 0.0],
[0.0, 0.3325, 0.6675, 0.0],
[0.0, 0.5825, 0.4175, 0.0],
[0.0, 0.0825, 0.25, 0.6675],
[0.0, 0.3325, 0.4175, 0.25],
[0.0, 0.3325, 0.4175, 0.25],
[0.0, 0.5825, 0.4175, 0.0],
[0.25, 0.0825, 0.6675, 0.0],
]
)
basic_motions_proba["ClassifierPipeline"] = np.array(
Expand Down Expand Up @@ -670,15 +670,15 @@
)
basic_motions_proba["Catch22Classifier"] = np.array(
[
[0.1, 0.0, 0.1, 0.8],
[0.3, 0.4, 0.2, 0.1],
[0.1, 0.0, 0.2, 0.7],
[0.2, 0.3, 0.2, 0.3],
[0.0, 0.2, 0.6, 0.2],
[0.0, 0.8, 0.1, 0.1],
[0.1, 0.0, 0.0, 0.9],
[0.2, 0.0, 0.1, 0.7],
[0.4, 0.2, 0.2, 0.2],
[0.0, 1.0, 0.0, 0.0],
[0.0, 0.1, 0.2, 0.7],
[0.1, 0.1, 0.2, 0.6],
[0.2, 0.5, 0.2, 0.1],
[0.1, 0.1, 0.6, 0.2],
[0.1, 0.9, 0.0, 0.0],
[0.0, 0.7, 0.2, 0.1],
[0.0, 1.0, 0.0, 0.0],
]
)
Expand Down Expand Up @@ -782,16 +782,16 @@
)
basic_motions_proba["CanonicalIntervalForestClassifier"] = np.array(
[
[0.2, 0.1, 0.2, 0.5],
[0.3, 0.2, 0.3, 0.2],
[0.1, 0.1, 0.7, 0.1],
[0.1, 0.5, 0.2, 0.2],
[0.1, 0.1, 0.0, 0.8],
[0.0, 0.1, 0.2, 0.7],
[0.3, 0.4, 0.1, 0.2],
[0.2, 0.0, 0.7, 0.1],
[0.2, 0.6, 0.1, 0.1],
[0.1, 0.5, 0.3, 0.1],
[0.0, 0.0, 0.1, 0.9],
[0.3, 0.5, 0.0, 0.2],
[0.0, 0.0, 0.8, 0.2],
[0.4, 0.2, 0.2, 0.2],
[0.1, 0.0, 0.0, 0.9],
[0.0, 0.0, 0.2, 0.8],
[0.3, 0.3, 0.2, 0.2],
[0.0, 0.2, 0.7, 0.1],
[0.0, 1.0, 0.0, 0.0],
[0.1, 0.7, 0.0, 0.2],
]
)
basic_motions_proba["RandomIntervalSpectralEnsembleClassifier"] = np.array(
Expand All @@ -811,15 +811,15 @@
basic_motions_proba["DrCIFClassifier"] = np.array(
[
[0.0, 0.0, 0.2, 0.8],
[0.8, 0.2, 0.0, 0.0],
[0.0, 0.0, 0.6, 0.4],
[0.1, 0.5, 0.0, 0.4],
[0.0, 0.0, 0.4, 0.6],
[0.0, 0.0, 0.2, 0.8],
[0.5, 0.5, 0.0, 0.0],
[0.0, 0.0, 0.8, 0.2],
[0.4, 0.6, 0.0, 0.0],
[0.3, 0.6, 0.0, 0.1],
[0.4, 0.5, 0.1, 0.0],
[0.0, 0.0, 0.7, 0.3],
[0.2, 0.8, 0.0, 0.0],
[0.0, 0.0, 0.3, 0.7],
[0.0, 0.0, 0.3, 0.7],
[0.7, 0.2, 0.1, 0.0],
[0.0, 0.0, 0.7, 0.3],
[0.1, 0.7, 0.1, 0.1],
[0.0, 0.9, 0.0, 0.1],
]
)
basic_motions_proba["IntervalForestClassifier"] = np.array(
Expand Down
98 changes: 16 additions & 82 deletions aeon/testing/expected_results/expected_regressor_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,7 @@
)

covid_3month_preds["Catch22Regressor"] = np.array(
[
0.0302,
0.0354,
0.0352,
0.0345,
0.0259,
0.0484,
0.0369,
0.0827,
0.0737,
0.0526,
]
[0.0310, 0.0555, 0.0193, 0.0359, 0.0261, 0.0361, 0.0387, 0.0835, 0.0827, 0.0414]
)

covid_3month_preds["RandomForestRegressor"] = np.array(
Expand Down Expand Up @@ -131,33 +120,11 @@
)

covid_3month_preds["CanonicalIntervalForestRegressor"] = np.array(
[
0.049,
0.04,
0.0299,
0.0352,
0.0423,
0.0315,
0.0519,
0.0605,
0.0647,
0.037,
]
[0.0412, 0.0420, 0.0292, 0.0202, 0.0432, 0.0192, 0.0155, 0.0543, 0.0412, 0.0399]
)

covid_3month_preds["DrCIFRegressor"] = np.array(
[
0.0302,
0.0778,
0.0272,
0.03,
0.0405,
0.0388,
0.0351,
0.093,
0.1041,
0.0263,
]
[0.0376, 0.0317, 0.0274, 0.0143, 0.0332, 0.0397, 0.0386, 0.0721, 0.0632, 0.0211]
)

covid_3month_preds["RandomIntervalRegressor"] = np.array(
Expand Down Expand Up @@ -252,16 +219,16 @@

cardano_sentiment_preds["Catch22Regressor"] = np.array(
[
0.2174,
0.1394,
0.3623,
0.1496,
0.3502,
0.2719,
0.1378,
0.076,
0.0587,
0.3773,
0.2537,
0.1417,
0.2980,
0.1324,
0.3519,
0.1919,
0.1790,
0.1295,
0.1644,
0.3836,
]
)

Expand Down Expand Up @@ -341,48 +308,15 @@
)

cardano_sentiment_preds["RISTRegressor"] = np.array(
[
0.3002,
0.3174,
0.718,
0.089,
0.4002,
0.0825,
0.5342,
0.0,
0.3503,
0.448,
]
[0.0825, 0.1924, 0.7180, 0.0413, 0.4840, 0.0825, 0.2336, 0.0000, 0.0413, 0.2814]
)

cardano_sentiment_preds["CanonicalIntervalForestRegressor"] = np.array(
[
0.276,
0.1466,
0.282,
0.205,
0.125,
0.0111,
0.3672,
0.0677,
0.1773,
0.2586,
]
[0.2546, 0.1796, 0.3423, 0.2016, 0.2369, 0.3178, 0.2051, 0.2286, 0.1956, 0.2452]
)

cardano_sentiment_preds["DrCIFRegressor"] = np.array(
[
0.2361,
0.2222,
0.2046,
0.1709,
0.2462,
0.2369,
0.1916,
0.1995,
0.0407,
0.1428,
]
[0.2569, 0.2196, 0.2948, 0.2677, 0.0829, 0.0677, 0.1584, 0.1840, 0.0498, 0.1383]
)

cardano_sentiment_preds["IntervalForestRegressor"] = np.array(
Expand Down
4 changes: 2 additions & 2 deletions aeon/transformations/collection/_collection_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class CollectionToSeriesWrapper(BaseTransformer):
>>> y = load_airline()
>>> wrap = CollectionToSeriesWrapper(Catch22())
>>> wrap.fit_transform(y)
0 1 2 3 ... 18 19 20 21
0 155.800003 181.700012 49.0 0.541667 ... 0.282051 0.769231 0.166667 11.0
0 1 2 3 ... 18 19 20 21
0 155.8 181.7 27.498346 8.0 ... 0.769231 0.282051 0.024544 48.355452
<BLANKLINE>
[1 rows x 22 columns]
"""
Expand Down
Loading