Skip to content

Commit

Permalink
release 1.1.1
Browse files Browse the repository at this point in the history
release 1.1.1
  • Loading branch information
eonu authored Feb 1, 2023
2 parents f171310 + 4543ddc commit f31918e
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
# before PyInstaller builds the exe, so as to inject date/other infos into it
*.manifest
*.spec

Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Changelog


## [1.1.1](https://github.com/eonu/sequentia/releases/tag/v1.1.1)

#### Major changes

- Remove `scikit-learn` validation constraints from `IndependentFunctionTransformer`. ([#237](https://github.com/eonu/sequentia/pull/237))

#### Minor changes

- Change default `mean_filter`/`median_filter` width to 5. ([#238](https://github.com/eonu/sequentia/pull/238))
- Update repository documentation. ([#239](https://github.com/eonu/sequentia/pull/239))


## [1.1.0](https://github.com/eonu/sequentia/releases/tag/v1.1.0)

#### Major changes
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ characteristics above, including participants with disabilities.

### Reporting Issues

If you experience or witness unacceptable behavior—or have any other concerns—please report it by contacting us via [ed@eonu.net](mailto:ed@eonu.net). All reports will be handled with discretion. In your report please include:
If you experience or witness unacceptable behavior—or have any other concerns—please report it by contacting Edwin Onuonga via [ed@eonu.net](mailto:ed@eonu.net). All reports will be handled with discretion. In your report please include:

- Your contact information.
- Names (real, nicknames, or pseudonyms) of any individuals involved. If there are additional witnesses, please
Expand Down
7 changes: 3 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ If you intend to help contribute to Sequentia, you will need some additional dep
You can specify the `dev` extra when installing Sequentia to do this.

```console
pip install --pre sequentia[dev]
# from inside the sequentia repository folder
pip install -e .[dev]
```

If installing a Sequentia from a local directory, you can use `pip install -e .` from within that directory, or `pip install -e .[xxx]` to install with extras.

Note that on some shells you may have to use quote marks, e.g. `pip install -e ".[xxx]"`.
> **Note**: On some shells you may have to escape, e.g. `pip install -e ".[dev]"`
## License

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019-2023 Edwin Onuonga <ed@eonu.net>
Copyright (c) 2019-2023 Edwin Onuonga (eonu) <ed@eonu.net>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion lib/sequentia/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .utils import *

__name__ = "sequentia"
__version__ = "1.1.0"
__version__ = "1.1.1"
__author__ = "Edwin Onuonga"
__email__ = "ed@eonu.net"
__copyright__ = f"2019-2023, {__author__}"
42 changes: 11 additions & 31 deletions lib/sequentia/preprocessing/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,6 @@ class IndependentFunctionTransformer(Transform):
Xt = transform.transform(data.X, data.lengths)
"""

_parameter_constraints: dict = {
"func": [callable, None],
"inverse_func": [callable, None],
"validate": ["boolean"],
"check_inverse": ["boolean"],
"kw_args": [dict, None],
"inv_kw_args": [dict, None],
}

def __init__(
self,
Expand Down Expand Up @@ -146,19 +138,9 @@ def __init__(
self.kw_args: Optional[Dict[str, Any]] = kw_args
self.inv_kw_args: Optional[Dict[str, Any]] = inv_kw_args

def _check_input(self, X, lengths, *, reset):
def _check_input(self, X, lengths):
data = _BaseSequenceValidator(X=X, lengths=lengths)
X, lengths = data.X, data.lengths
if self.validate:
X = self._validate_data(X, reset=reset)
return X, lengths
elif reset:
# Set feature_names_in_ and n_features_in_ even if validate=False
# We run this only when reset==True to store the attributes but not
# validate them, because validate=False
self._check_n_features(X, reset=reset)
self._check_feature_names(X, reset=reset)
return X, lengths
return data.X, data.lengths

def _check_inverse_transform(self, X, lengths):
"""Check that func and inverse_func are the inverse."""
Expand Down Expand Up @@ -200,8 +182,7 @@ def fit(
:return: The fitted transformer.
"""
self._validate_params()
X, lengths = self._check_input(X, lengths, reset=True)
X, lengths = self._check_input(X, lengths)
if self.check_inverse and not (self.func is None or self.inverse_func is None):
self._check_inverse_transform(X, lengths)
return self
Expand All @@ -227,7 +208,7 @@ def transform(
:return: The transformed array.
"""
X, lengths = self._check_input(X, lengths, reset=False)
X, lengths = self._check_input(X, lengths)
return self._transform(X, lengths, func=self.func, kw_args=self.kw_args)

def inverse_transform(
Expand All @@ -251,8 +232,7 @@ def inverse_transform(
:return: The inverse transformed array.
"""
data = _BaseSequenceValidator(X=X, lengths=lengths)
X, lengths = data.X, data.lengths
X, lengths = self._check_input(X, lengths)
if self.validate:
X = check_array(X, accept_sparse=False)
return self._transform(X, lengths, func=self.inverse_func, kw_args=self.inv_kw_args)
Expand All @@ -272,7 +252,7 @@ def _more_tags(self):
return {"no_validation": not self.validate, "stateless": True}


def mean_filter(x: Array, k: PositiveInt = 3) -> Array:
def mean_filter(x: Array, k: PositiveInt = 5) -> Array:
"""Applies a mean filter of size ``k`` independently to each feature of the sequence,
retaining the original input shape by using appropriate padding.
Expand Down Expand Up @@ -300,10 +280,10 @@ def mean_filter(x: Array, k: PositiveInt = 3) -> Array:
# Apply the mean filter to the first sequence
x, _ = data[0]
xt = mean_filter(x, k=5)
xt = mean_filter(x, k=7)
# Create an independent mean filter transform
transform = IndependentFunctionTransformer(mean_filter, kw_args={"k": 5})
transform = IndependentFunctionTransformer(mean_filter, kw_args={"k": 7})
# Apply the transform to all sequences
Xt = transform.transform(data.X, data.lengths)
Expand All @@ -312,7 +292,7 @@ def mean_filter(x: Array, k: PositiveInt = 3) -> Array:
return convolve(data.X, np.ones((k, 1)) / k, mode="same")


def median_filter(x: Array, k: PositiveInt = 3) -> Array:
def median_filter(x: Array, k: PositiveInt = 5) -> Array:
"""Applies a median filter of size ``k`` independently to each feature of the sequence,
retaining the original input shape by using appropriate padding.
Expand All @@ -338,10 +318,10 @@ def median_filter(x: Array, k: PositiveInt = 3) -> Array:
# Apply the median filter to the first sequence
x, _ = data[0]
xt = median_filter(x, k=5)
xt = median_filter(x, k=7)
# Create an independent median filter transform
transform = IndependentFunctionTransformer(median_filter, kw_args={"k": 5})
transform = IndependentFunctionTransformer(median_filter, kw_args={"k": 7})
# Apply the transform to all sequences
Xt = transform.transform(data.X, data.lengths)
Expand Down

0 comments on commit f31918e

Please sign in to comment.