Repository: aeon-toolkit/aeon (python)

Issue:
[BUG] Inverse transform uses method that has been refactored
### Describe the bug

whilst writing a test for BaseCollectionTransformer realised inverse_transform calls

       X_inner = self.preprocess_collection(X)

instead of 
       X_inner = self._preprocess_collection(X)






### Steps/Code to reproduce the bug

```python
    d = _Dummy()
    x, _ = make_3d_test_data()
    d.fit(x)
    d.set_tags(**{"skip-inverse-transform": True})
    x2 = d.inverse_transform(x)
    assert_almost_equal(x, x2)


### Expected results

pass test

### Actual results

```python-traceback
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2022.2.2\plugins\python\helpers\pycharm\_jb_unittest_runner.py", line 35, in <module>
    sys.exit(main(argv=args, module=None, testRunner=unittestpy.TeamcityTestRunner, buffer=not JB_DISABLE_BUFFERING))
  File "C:\Users\Tony Bagnall\AppData\Local\Programs\Python\Python39\lib\unittest\main.py", line 100, in __init__
    self.parseArgs(argv)
  File "C:\Users\Tony Bagnall\AppData\Local\Programs\Python\Python39\lib\unittest\main.py", line 147, in parseArgs
    self.createTests()
  File "C:\Users\Tony Bagnall\AppData\Local\Programs\Python\Python39\lib\unittest\main.py", line 158, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames,
  File "C:\Users\Tony Bagnall\AppData\Local\Programs\Python\Python39\lib\unittest\loader.py", line 220, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "C:\Users\Tony Bagnall\AppData\Local\Programs\Python\Python39\lib\unittest\loader.py", line 220, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "C:\Users\Tony Bagnall\AppData\Local\Programs\Python\Python39\lib\unittest\loader.py", line 205, in loadTestsFromName
    test = obj()
  File "C:\Code\aeon\aeon\transformations\collection\tests\test_base.py", line 92, in test_inverse_transform
    x2 = d.inverse_transform(x)
  File "C:\Code\aeon\aeon\transformations\collection\base.py", line 198, in inverse_transform
    X_inner = self.preprocess_collection(X)
AttributeError: '_Dummy' object has no attribute 'preprocess_collection'

```

### Versions

_No response_

Pull request:
[ENH] Bug and coverage for BaseCollectionTransformer
#### Reference Issues/PRs

fixes #807 

#### What does this implement/fix? Explain your changes.
adds tests for inverse_transform, fixes an incorrect method call

#### Does your contribution introduce a new dependency? If yes, which one?

<!--
If your contribution does add a dependency, we may suggest adding it as an optional/soft dependency to keep external dependencies of the core aeon package to a minimum.
-->

#### What should a reviewer concentrate their feedback on?

<!--
This section is particularly useful if you have a pull request that is still in development. You can guide the reviews to focus on the parts that are ready for their comments. We suggest using bullets (indicated by * or -) and filled checkboxes [x] here
-->

#### Did you add any tests for the change?

<!--
This section is useful if you have added a test in addition to the existing ones. This will ensure that further changes to these files won't introduce the same kind of bug. It is considered good practice to add tests with newly added code to enforce the fact that the code actually works. This will reduce the chance of introducing logical bugs.
-->

#### Any other comments?

<!--
Please be aware that we are a loose team of volunteers so patience is necessary; assistance handling other issues is very welcome. We value all user contributions, no matter how minor they are. If we are slow to review, either the pull request needs some benchmarking, tinkering, convincing, etc. or more likely the reviewers are simply busy. In either case, we ask for your understanding during the review process.
-->

### PR checklist

<!--
Please go through the checklist below. Please feel free to remove points if they are not applicable.
-->

##### For all contributions
- [ ] I've added myself to the [list of contributors](https://github.com/aeon-toolkit/aeon/blob/main/.all-contributorsrc).
- [ ] Optionally, I've updated aeon's [CODEOWNERS](https://github.com/aeon-toolkit/aeon/blob/main/CODEOWNERS) to receive notifications about future changes to these files.
- [ ] The PR title starts with either [ENH], [MNT], [DOC], or [BUG] indicating whether the PR topic is related to enhancement, maintenance, documentation, or bug.
- [ ] For new estimators, I've added the estimator to the online documentation.


<!--
Thanks for contributing!
-->


Patch:
diff --git a/aeon/transformations/collection/base.py b/aeon/transformations/collection/base.py
index eed97f50..487b2d86 100644
--- a/aeon/transformations/collection/base.py
+++ b/aeon/transformations/collection/base.py
@@ -195,7 +195,7 @@ class BaseCollectionTransformer(
         self.check_is_fitted()
 
         # input check and conversion for X/y
-        X_inner = self.preprocess_collection(X)
+        X_inner = self._preprocess_collection(X)
         y_inner = y
 
         Xt = self._inverse_transform(X=X_inner, y=y_inner)


Test patch:
diff --git a/aeon/transformations/collection/tests/test_base.py b/aeon/transformations/collection/tests/test_base.py
index a9c2a72d..6573798a 100644
--- a/aeon/transformations/collection/tests/test_base.py
+++ b/aeon/transformations/collection/tests/test_base.py
@@ -1,9 +1,10 @@
 """Test input for the BaseCollectionTransformer."""
 
-__author__ = ["MatthewMiddlehurst"]
+__author__ = ["MatthewMiddlehurst", "TonyBagnall"]
 
 import numpy as np
 import pytest
+from numpy.testing import assert_almost_equal
 
 from aeon.datatypes import convert_to
 from aeon.transformations.collection import (
@@ -77,6 +78,24 @@ def test_collection_transformer_wrapper_collection(data_gen):
     assert Xt[0].ndim == 2
 
 
+def test_inverse_transform():
+    """Test inverse transform."""
+    d = _Dummy()
+    x, _ = make_3d_test_data()
+    d.fit(x)
+    d.set_tags(**{"skip-inverse-transform": True})
+    x2 = d.inverse_transform(x)
+    assert_almost_equal(x, x2)
+    d.set_tags(**{"skip-inverse-transform": False})
+    with pytest.raises(
+        NotImplementedError, match="does not implement " "inverse_transform"
+    ):
+        d.inverse_transform(x)
+    d.set_tags(**{"capability:inverse_transform": True})
+    x2 = d.inverse_transform(x)
+    assert_almost_equal(x, x2)
+
+
 class _Dummy(BaseCollectionTransformer):
     """Dummy transformer for testing.
 
@@ -97,3 +116,6 @@ class _Dummy(BaseCollectionTransformer):
         if isinstance(X, np.ndarray):
             return [x for x in X]
         return X
+
+    def _inverse_transform(self, X, y=None):
+        return X