Skip to content

Commit

Permalink
Add references and test case for partial_fit
Browse files Browse the repository at this point in the history
  • Loading branch information
jmyrberg committed Dec 19, 2020
1 parent 5c7853f commit 88dc468
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ X_obs_nc = aakr.transform(X_obs)

## References

* [Assessment of Statistical and Classification Models For Monitoring EDF’s Assets”](https://link.springer.com/chapter/10.1007/978-0-85729-320-6_52)

* [A modified Auto Associative Kernel Regression method for robust signal reconstruction in nuclear power plant components](https://www.researchgate.net/publication/292538769_A_modified_Auto_Associative_Kernel_Regression_method_for_robust_signal_reconstruction_in_nuclear_power_plant_components)

---
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.1dev5
0.0.1dev6
24 changes: 19 additions & 5 deletions aakr/_aakr.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,33 @@


class AAKR(TransformerMixin, BaseEstimator):
"""Auto Associative Kernel Regressor.
Please see the :ref:`Getting started <readme.rst>` documentation for more
information.
"""Auto Associative Kernel Regression.
Parameters
----------
metric : str, default='euclidean'
Metric for calculating kernel distances.
Metric for calculating kernel distances, see available metrics from
`sklearn.metrics.pairwise_distances <https://scikit-learn.org/stable/modules/generated/sklearn.metrics.pairwise_distances.html>`_.
bw : float, default=1.0
Kernel bandwith parameter.
n_jobs : int, default=-1
The number of jobs to run in parallel.
Attributes
----------
X_ : ndarray of shape (n_samples, n_features)
Historical normal condition examples given as an array.
References
----------
.. [1] Chevalier R., Provost D., and Seraoui R., 2009,
“Assessment of Statistical and Classification Models For Monitoring
EDF’s Assets”, Sixth American Nuclear Society International
Topical Meeting on Nuclear Plant Instrumentation.
.. [2] Baraldi P., Di Maio F., Turati P., Zio E., 2014,
"A modified Auto Associative Kernel Regression method for robust
signal reconstruction in nuclear power plant components", European
Safety and Reliability Conference ESREL.
"""
def __init__(self, metric='euclidean', bw=1, n_jobs=-1):
self.metric = metric
Expand Down
10 changes: 8 additions & 2 deletions tests/test_aakr.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_aakr(data):
assert_allclose(X_nc, X[:3])


def test_aakr_input_shape_mismatch(data):
def test_aakr_fit_input_shape_mismatch(data):
X = data[0]
aakr = AAKR().fit(X)
assert aakr.X_.shape[1] == X.shape[1]
Expand All @@ -37,4 +37,10 @@ def test_aakr_input_shape_mismatch(data):
aakr.transform(X[:3, :-1])


# TODO: Test partial_fit
def test_aakr_partial_fit_input_shape_mismatch(data):
X = data[0]
aakr = AAKR().partial_fit(X)
assert aakr.X_.shape[1] == X.shape[1]

with pytest.raises(ValueError, match='Shape of input is different'):
aakr.partial_fit(X[:, :-1])

0 comments on commit 88dc468

Please sign in to comment.