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

Add VAMP, CKTests (MSM and VAMP) #25

Merged
merged 31 commits into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
18f2535
[vamp] added vamp, test_vamp
marscher Aug 27, 2019
f696909
wip
marscher Aug 27, 2019
7920e9b
some refactoring
marscher Aug 28, 2019
e2b1278
add Estimator.fetch_model(copy_flag)
marscher Aug 28, 2019
756f240
ck works
marscher Aug 28, 2019
6dc5fc5
added doublewell test data
marscher Aug 28, 2019
24dec2d
use sktime dw test data
marscher Aug 28, 2019
942845e
[vamp] fix ck
marscher Aug 28, 2019
c9a45d5
be explicit in type annotation
marscher Aug 28, 2019
180f49e
wip
marscher Aug 29, 2019
227ee74
ck fixes, 2 failing tests remain.
marscher Sep 10, 2019
ed81086
[model] revert copy flag addition from fetch_model
marscher Sep 10, 2019
a417d21
fixes #20
marscher Sep 11, 2019
188011a
[laggedmodelvalidator] take copy of test model to avoid side-effects.
marscher Sep 12, 2019
350834f
remove duped code
marscher Sep 12, 2019
c0d2d60
minor changes
marscher Sep 12, 2019
058776f
[lagged model validator] process models in seperate loops (cache miss…
marscher Sep 12, 2019
4ee3910
store lagtimes in LaggedModelValidation
marscher Sep 12, 2019
0cc548c
[LaggedModelvalidator] avoid side-effects by copying test_estimator
marscher Sep 12, 2019
0ea8cfb
[test-cktest msm] needed to lower precision for estimates comparision
marscher Sep 12, 2019
dff789f
[ci] use strict channel priority
marscher Sep 12, 2019
301c8a5
[base] create a new model instance upon fit calls.
marscher Sep 17, 2019
c885538
adopt test cases to new model instances upon fit.
marscher Sep 17, 2019
bd312f9
model estimator cleanup
marscher Sep 17, 2019
7d58953
[lagged model validator] set input lag time on construction. Warn for…
marscher Sep 17, 2019
26fa043
mdot iterative
marscher Sep 17, 2019
0b2e370
[lagged model validators] disallow mlag=0
marscher Sep 17, 2019
1b3565b
fix cktests for removed mlag=0 case.
marscher Sep 17, 2019
68032ed
fix cktest msm
marscher Sep 24, 2019
3a9163f
[cktest] do not copy model (guaranteed by estimator-fit() new model i…
marscher Sep 24, 2019
7cc8380
[test-ck] use same precision as in pyemma.
marscher Sep 24, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- checkout
- run: conda config --add channels conda-forge
- run: conda config --set always_yes true
- run: conda config --set channel_priority strict
- run: conda config --set quiet true
- run: conda install conda-build conda-verify -c defaults
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
Expand Down
20 changes: 18 additions & 2 deletions sktime/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
from sklearn.base import _pprint as pprint_sklearn


class _base_methods_mixin(object):
class _base_methods_mixin(object, metaclass=abc.ABCMeta):
""" defines common methods used by both Estimator and Model classes.
marscher marked this conversation as resolved.
Show resolved Hide resolved
"""

def __repr__(self):
name = '{cls}-{id}:'.format(id=id(self), cls=self.__class__.__name__)
Expand Down Expand Up @@ -89,10 +91,19 @@ def copy(self):
class Estimator(_base_methods_mixin):

def __init__(self, model=None):
self._model = model if model is not None else self._create_model()
# we only need to create a default model in case the subclassing Estimator provides the partial_fit interface.
if hasattr(self.__class__, 'partial_fit') and model is None:
clonker marked this conversation as resolved.
Show resolved Hide resolved
self._model = self._create_model()
# TODO: not tested (e.g. by partially fitted models.
elif model is not None:
self._model = model

@abc.abstractmethod
def fit(self, data):
""" performs a fit of this estimator with data. Creates a new model instance by default.
:param data:
:return: self
"""
pass

def fetch_model(self) -> Model:
Expand All @@ -102,6 +113,11 @@ def fetch_model(self) -> Model:
def _create_model(self):
pass

def __getattribute__(self, item):
if item == 'fit':
self._model = self._create_model()
return super(_base_methods_mixin, self).__getattribute__(item)


class Transformer(object):

Expand Down
10 changes: 5 additions & 5 deletions sktime/decomposition/tica.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,19 +266,19 @@ class TICA(Estimator, Transformer):
"""
def __init__(self, lagtime, epsilon=1e-6, reversible=True, dim=0.95,
scaling='kinetic_map', ncov=5):
super(TICA, self).__init__()
# tica parameters
self._model.epsilon = epsilon
self._model.dim = dim
self._model.scaling = scaling
self.epsilon = epsilon
self.dim = dim
self.scaling = scaling

# online cov parameters
self.reversible = reversible
self._covar = OnlineCovariance(lagtime=lagtime, compute_c00=True, compute_c0t=True, compute_ctt=False, remove_data_mean=True,
reversible=self.reversible, bessels_correction=False, ncov=ncov)
super(TICA, self).__init__()
marscher marked this conversation as resolved.
Show resolved Hide resolved

def _create_model(self) -> TICAModel:
return TICAModel()
return TICAModel(scaling=self.scaling, dim=self.dim, epsilon=self.epsilon)

def transform(self, data):
r"""Projects the data onto the dominant independent components.
Expand Down