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

Release v0.4.0 #267

Merged
merged 59 commits into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
2b90b04
fixed link to sktime-dl
mloning Jan 23, 2020
0e8f850
new community contributions management
mloning Jan 27, 2020
b1bd281
fixed link
mloning Jan 27, 2020
accf745
minor changes
mloning Jan 27, 2020
a0cc2bb
deleted previous estimator overview file|
mloning Jan 27, 2020
7663ec4
further comments in PR template
mloning Jan 27, 2020
0921688
typo
mloning Jan 27, 2020
896ee4c
Merge pull request #219 from alan-turing-institute/policy
mloning Jan 27, 2020
b697071
Update PULL_REQUEST_TEMPLATE.md
mloning Jan 27, 2020
d02b29f
Update README.rst
mloning Jan 27, 2020
2e77ab9
fixes #221
mloning Jan 30, 2020
5085716
Merge pull request #222 from alan-turing-institute/rise_example_fix
mloning Jan 30, 2020
7e9df75
updated openml compile error msg
mloning Jan 30, 2020
107ba09
Merge branch 'dev' of https://github.com/alan-turing-institute/sktime…
mloning Jan 30, 2020
6591425
introduced our own NotFittedError, update check_is_fitted, minor updates
mloning Jan 31, 2020
841797d
compiled existing estimators in ESTIMATOR_OVERVIEW ... finally
fkiraly Feb 1, 2020
9c0af99
Merge pull request #225 from alan-turing-institute/estimator_taxonomy
mloning Feb 3, 2020
61b2643
udpated setup
mloning Feb 4, 2020
98fe79d
updated README
mloning Feb 5, 2020
6452281
updated link to paper
mloning Feb 5, 2020
11727ea
Update README.rst
mloning Mar 10, 2020
edee5dc
Adds ROCKET (transform only) to sktime. (#204)
angus924 Mar 13, 2020
30d07d1
Add Mr-SEQL time series classifier (#211)
lnthach Mar 18, 2020
78170b2
Implementing tsfresh transformer (#231)
mloning Mar 19, 2020
80816fc
enforcing unique index
mloning Mar 19, 2020
7fd9587
Fixed the conflicted values in TimeSeriesForestClassifier. (#233)
ninfueng Mar 22, 2020
ab16d46
Update build/CI (#241)
mloning Apr 23, 2020
8763f9f
simplified requirements file
mloning Apr 23, 2020
26ab7bb
Updated forecast API (#218)
mloning Apr 25, 2020
a51bed4
added __init__ file for mrseql test (#249)
mloning Apr 28, 2020
a944d60
fixed pmdarima in-sample test error
mloning May 5, 2020
fbc11a6
Merge branch 'dev' of https://github.com/alan-turing-institute/sktime…
mloning May 5, 2020
98593f5
Package refactoring (#246)
mloning May 27, 2020
724403a
Improve documentation (#238)
mloning May 29, 2020
8cb91cf
sync with master
mloning May 29, 2020
2bd1e5b
added BaseTimeSeriesForest (#268)
Ayushmaanseth May 30, 2020
2ccb82c
Added release drafter app (#269)
mloning May 30, 2020
374447b
fixed release-drafter
mloning May 30, 2020
d206475
fixed release-drafter
mloning May 30, 2020
b0f295b
Update release-drafter.yml
mloning May 30, 2020
3bd42db
removed release-drafter app
mloning May 30, 2020
cb1e459
removed release-drafter app
mloning May 30, 2020
6db9e7d
make tsfresh relevant feature extractor tests morerobust
mloning May 30, 2020
2a1080e
Add feature importance graph to modular TSF (#250)
HYang1996 May 31, 2020
a666daa
added contributors
mloning Jun 1, 2020
8b5ea5b
Add license info to files (#274)
mloning Jun 1, 2020
2fa007b
fix speed issue for MrSEQL (#275)
lnthach Jun 1, 2020
d300758
update license info
mloning Jun 1, 2020
7f5f31e
Merge branch 'dev' of https://github.com/alan-turing-institute/sktime…
mloning Jun 1, 2020
9867a28
Update example notebooks (#273)
mloning Jun 2, 2020
c545afe
Release drafter (#270)
mloning Jun 2, 2020
ca6375f
Added resizing transformer and tutorial for use and problem it solves…
DmitriyValetov Jun 2, 2020
abaf202
added Mo-Saif for finding bug
mloning Jun 2, 2020
afe283e
Merge branch 'dev' of https://github.com/alan-turing-institute/sktime…
mloning Jun 2, 2020
c785aec
added Amaia as contributor
mloning Jun 3, 2020
d3e70f0
Merge branch 'master' into dev
mloning Jun 3, 2020
2580b6b
Minor fixes to documentation (#279)
mloning Jun 3, 2020
c21821a
bumped version to 0.4.0
mloning Jun 4, 2020
0e26851
Merge branch 'dev' of https://github.com/alan-turing-institute/sktime…
mloning Jun 4, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
introduced our own NotFittedError, update check_is_fitted, minor updates
  • Loading branch information
mloning committed Jan 31, 2020
commit 65914252c822ee8843b6b40c6b42f8a5fca793ac
16 changes: 8 additions & 8 deletions sktime/classifiers/compose/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@
__all__ = ["TimeSeriesForestClassifier"]
__author__ = "Markus Löning"


from warnings import warn
from warnings import catch_warnings
from warnings import simplefilter
from warnings import warn

import numpy as np
from joblib import Parallel, delayed
from sklearn.ensemble.base import _partition_estimators
from sklearn.ensemble.forest import ForestClassifier
from sklearn.ensemble.forest import MAX_INT
from sklearn.ensemble.forest import _generate_sample_indices
from sklearn.ensemble.forest import _generate_unsampled_indices
from sklearn.ensemble.forest import _get_n_samples_bootstrap
from sklearn.ensemble.base import _partition_estimators
from sklearn.utils._joblib import Parallel, delayed
from sklearn.exceptions import DataConversionWarning
from sklearn.tree import DecisionTreeClassifier
from sklearn.tree._tree import DOUBLE
from sklearn.utils import check_random_state
from sklearn.utils import check_array
from sklearn.utils import check_random_state
from sklearn.utils import compute_sample_weight
from sklearn.utils.validation import check_is_fitted
from sklearn.exceptions import DataConversionWarning
from sklearn.tree import DecisionTreeClassifier

from sktime.pipeline import Pipeline
from sktime.transformers.summarise import RandomIntervalFeatureExtractor
from sktime.utils.time_series import time_series_slope
from sktime.utils.validation import check_is_fitted
from sktime.utils.validation.supervised import validate_X_y, check_X_is_univariate, validate_X


Expand Down
2 changes: 1 addition & 1 deletion sktime/classifiers/distance_based/time_series_neighbors.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from sklearn.model_selection import GridSearchCV, LeaveOneOut
from sklearn.utils import gen_even_slices
from sklearn.utils.multiclass import check_classification_targets
from sklearn.utils.validation import check_is_fitted
from sktime.utils.validation import check_is_fitted
from sklearn.utils import Parallel, delayed, effective_n_jobs
from sklearn.utils._joblib import __version__ as joblib_version
from sklearn.exceptions import DataConversionWarning
Expand Down
3 changes: 2 additions & 1 deletion sktime/contrib/rotation_forest/rotation_forest_reworked.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
from sklearn.exceptions import DataConversionWarning
from sklearn.preprocessing import StandardScaler
from sklearn.tree import DecisionTreeClassifier
from sklearn.utils.validation import check_X_y, check_array, check_random_state, check_is_fitted
from sklearn.utils.validation import check_X_y, check_array, check_random_state
from sktime.utils.validation import check_is_fitted


class RotationForestClassifier(ForestClassifier):
Expand Down
16 changes: 16 additions & 0 deletions sktime/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python3 -u
# coding: utf-8

__author__ = "Markus Löning"
__all__ = ["NotFittedError"]


class NotFittedError(ValueError, AttributeError):
"""Exception class to raise if estimator is used before fitting.
This class inherits from both ValueError and AttributeError to help with
exception handling and backward compatibility.

References
----------
..[1] Based on scikit-learn's NotFittedError
"""
4 changes: 2 additions & 2 deletions sktime/regressors/tsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from sklearn.utils import check_array
from sklearn.utils import check_random_state
from sklearn.utils._joblib import Parallel, delayed
from sklearn.utils.validation import check_is_fitted
from sktime.utils.validation import check_is_fitted

from sktime.classifiers.compose.ensemble import _parallel_build_trees
from sktime.transformers.summarise import RandomIntervalFeatureExtractor
Expand Down Expand Up @@ -400,7 +400,7 @@ def decision_path(self, X):

@property
def feature_importances_(self):
raise NotImplementedError
raise NotImplementedError()

def _set_oob_score(self, X, y):
raise NotImplementedError()
2 changes: 1 addition & 1 deletion sktime/transformers/compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pandas as pd
from scipy import sparse
from sklearn.compose import ColumnTransformer as skColumnTransformer
from sklearn.utils.validation import check_is_fitted
from sktime.utils.validation import check_is_fitted

from sktime.transformers.base import BaseTransformer
from sktime.utils.data_container import concat_nested_arrays
Expand Down
2 changes: 1 addition & 1 deletion sktime/transformers/forecasting.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
import pandas as pd
from sklearn.utils.validation import check_is_fitted
from sktime.utils.validation import check_is_fitted
from statsmodels.tsa.seasonal import seasonal_decompose

from sktime.transformers.base import BaseTransformer
Expand Down
2 changes: 1 addition & 1 deletion sktime/transformers/pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import pandas as pd

from sklearn.utils.validation import check_is_fitted
from sktime.utils.validation import check_is_fitted
from sklearn.decomposition import PCA

from sktime.transformers.base import BaseTransformer
Expand Down
2 changes: 1 addition & 1 deletion sktime/transformers/segment.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import pandas as pd
from sklearn.utils import check_random_state
from sklearn.utils.validation import check_is_fitted
from sktime.utils.validation import check_is_fitted

from sktime.transformers.base import BaseTransformer
from sktime.utils.data_container import check_equal_index, tabularize, concat_nested_arrays
Expand Down
2 changes: 1 addition & 1 deletion sktime/transformers/summarise.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
import pandas as pd
from sklearn.utils.validation import check_is_fitted
from sktime.utils.validation import check_is_fitted

from sktime.transformers.base import BaseTransformer
from sktime.transformers.segment import RandomIntervalSegmenter
Expand Down
2 changes: 1 addition & 1 deletion sktime/transformers/tests/test_PCATransformer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from sklearn.decomposition import PCA
from sklearn.exceptions import NotFittedError
from sktime.exceptions import NotFittedError
from sktime.transformers.pca import PCATransformer
from sktime.utils.testing import generate_df_from_array
from sktime.utils.data_container import tabularize, detabularize, get_time_index
Expand Down
75 changes: 75 additions & 0 deletions sktime/utils/validation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
__all__ = ["check_is_fitted"]
__author__ = "Markus Löning"

from inspect import isclass
from sktime.exceptions import NotFittedError


def check_is_fitted(estimator, attributes=None, msg=None, all_or_any=all):
"""Perform is_fitted validation for estimator.

Checks if the estimator is fitted by verifying the presence of
fitted attributes (ending with a trailing underscore) and otherwise
raises a NotFittedError with the given message.

This utility is meant to be used internally by estimators themselves,
typically in their own predict / transform methods.

Parameters
----------
estimator : estimator instance.
estimator instance for which the check is performed.

attributes : str, list or tuple of str, default=None
Attribute name(s) given as string or a list/tuple of strings
Eg.: ``["coef_", "estimator_", ...], "coef_"``

If `None`, `estimator` is considered fitted if there exist an
attribute that ends with a underscore and does not start with double
underscore.

msg : string
The default error message is, "This %(name)s instance is not fitted
yet. Call 'fit' with appropriate arguments before using this
estimator."

For custom messages if "%(name)s" is present in the message string,
it is substituted for the estimator name.

Eg. : "Estimator, %(name)s, must be fitted before sparsifying".

all_or_any : callable, {all, any}, default all
Specify whether all or any of the given attributes must exist.

Returns
-------
None

Raises
------
NotFittedError
If the attributes are not found.

References
----------
..[1] Based on scikit-learn's `check_is_fitted` function
"""
if isclass(estimator):
raise TypeError("{} is a class, not an instance.".format(estimator))
if msg is None:
msg = ("This %(name)s instance is not fitted yet. Call 'fit' with "
"appropriate arguments before using this estimator.")

if not hasattr(estimator, 'fit'):
raise TypeError("%s is not an estimator instance." % (estimator))

if attributes is not None:
if not isinstance(attributes, (list, tuple)):
attributes = [attributes]
attrs = all_or_any([hasattr(estimator, attr) for attr in attributes])
else:
attrs = [v for v in vars(estimator)
if v.endswith("_") and not v.startswith("__")]

if not attrs:
raise NotFittedError(msg % {'name': type(estimator).__name__})