Skip to content

Commit

Permalink
Merge pull request #3 from moldyn/improve_defaults
Browse files Browse the repository at this point in the history
Improve default values
  • Loading branch information
braniii authored Mar 8, 2024
2 parents c721d56 + 5f5a616 commit ddfb2fa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0


## [Unreleased]
#### API changes warning ⚠️:
- Changed default for invariant measure to `volume`
- Changed default for normalization method to `geometric`

#### Added Features and Improvements 🙌:
- Added an icon, thx to @gegabo


## [0.1.1] - 2023-11-07
Expand Down
8 changes: 4 additions & 4 deletions src/normi/_estimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ class NormalizedMI(BaseEstimator):
----------
n_dims : int, default=1
Dimensionality of input vectors.
normalize_method : str, default='joint'
normalize_method : str, default='geometric'
Determines the normalization factor for the mutual information:<br/>
- `'joint'` is the joint entropy<br/>
- `'max'` is the maximum of the individual entropies<br/>
- `'arithmetic'` is the mean of the individual entropies<br/>
- `'geometric'` is the square root of the product of the individual
entropies<br/>
- `'min'` is the minimum of the individual entropies
invariant_measure : str, default='radius'
invariant_measure : str, default='volume'
- `'radius'` normalizing by mean k-nn radius<br/>
- `'volume'` normalizing by mean k-nn volume<br/>
- `'kraskov'` no normalization
Expand Down Expand Up @@ -95,8 +95,8 @@ def __init__(
self,
*,
n_dims: PositiveInt = 1,
normalize_method: NormString = 'joint',
invariant_measure: InvMeasureString = 'radius',
normalize_method: NormString = 'geometric',
invariant_measure: InvMeasureString = 'volume',
k: PositiveInt = 5,
n_jobs: Int = -1,
verbose: bool = True,
Expand Down
10 changes: 5 additions & 5 deletions tests/test__estimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,25 +101,25 @@ def test__reset(normalize_method, X, kwargs):


@pytest.mark.parametrize('X, kwargs, result, error', [
(X1(), {}, X1_result('joint', 'radius'), None),
(X1(), {}, X1_result('geometric', 'volume'), None),
(
X1(),
{'normalize_method': 'joint', 'invariant_measure': 'radius'},
X1_result('joint', 'radius'),
None,
),
(X1(), {'normalize_method': 'max'}, X1_result('max', 'radius'), None),
(X1(), {'normalize_method': 'min'}, X1_result('min', 'radius'), None),
(X1(), {'normalize_method': 'max'}, X1_result('max', 'volume'), None),
(X1(), {'normalize_method': 'min'}, X1_result('min', 'volume'), None),
(
X1(),
{'normalize_method': 'arithmetic'},
X1_result('arithmetic', 'radius'),
X1_result('arithmetic', 'volume'),
None,
),
(
X1(),
{'normalize_method': 'geometric'},
X1_result('geometric', 'radius'),
X1_result('geometric', 'volume'),
None,
),
(
Expand Down

0 comments on commit ddfb2fa

Please sign in to comment.