Skip to content

Commit

Permalink
Merge branch 'main' into remove-legacy-model_selection
Browse files Browse the repository at this point in the history
  • Loading branch information
fkiraly committed Sep 9, 2023
2 parents 7d55f04 + 0d8bd68 commit fac4c28
Show file tree
Hide file tree
Showing 102 changed files with 273 additions and 210 deletions.
23 changes: 16 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.4.0
hooks:
- id: check-added-large-files
args: ["--maxkb=1000"]
Expand All @@ -12,37 +12,46 @@ repos:
- id: end-of-file-fixer
exclude: "^docs/source/examples/"
- id: fix-encoding-pragma
args:
- --remove
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
hooks:
- id: pyupgrade
args:
- --py38-plus

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort

- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.7.0
hooks:
- id: black
language_version: python3
# args: [--line-length 79]

- repo: https://github.com/pycqa/flake8
rev: 4.0.1
rev: 6.1.0
hooks:
- id: flake8
exclude: docs/conf.py
additional_dependencies: [flake8-bugbear, flake8-print]

- repo: https://github.com/mgedmin/check-manifest
rev: "0.47"
rev: "0.49"
hooks:
- id: check-manifest
stages: [manual]

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.2.2
rev: 1.7.0
hooks:
- id: nbqa-black
args: [--nbqa-mutate, --nbqa-dont-skip-bad-cells]
Expand All @@ -55,15 +64,15 @@ repos:
additional_dependencies: [flake8==3.8.3]

- repo: https://github.com/pycqa/pydocstyle
rev: 6.1.1
rev: 6.3.0
hooks:
- id: pydocstyle
args: ["--config=setup.cfg"]

# We use the Python version instead of the original version which seems to require Docker
# https://github.com/koalaman/shellcheck-precommit
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.8.0.4
rev: v0.9.0.5
hooks:
- id: shellcheck
name: shellcheck
2 changes: 0 additions & 2 deletions build_tools/changelog.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""RestructuredText changelog generator."""

import os
Expand Down Expand Up @@ -140,7 +139,6 @@ def render_changelog(prs, assigned): # noqa


if __name__ == "__main__":

categories = [
{"title": "Enhancements", "labels": ["feature", "enhancement"]},
{"title": "Fixes", "labels": ["bug", "fix", "bugfix"]},
Expand Down
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# This file is execfile()d with the current directory set to its containing dir.
#
Expand Down
1 change: 0 additions & 1 deletion examples/parametric/bagging.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# LEGACY MODULE - TODO: remove or refactor
from sklearn.tree import DecisionTreeRegressor

Expand Down
1 change: 0 additions & 1 deletion examples/parametric/hyperparameters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# LEGACY MODULE - TODO: remove or refactor
from sklearn.datasets.base import load_diabetes
from sklearn.ensemble import RandomForestRegressor
Expand Down
1 change: 0 additions & 1 deletion examples/parametric/simple.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# LEGACY MODULE - TODO: remove or refactor
from sklearn.datasets.base import load_diabetes
from sklearn.ensemble import RandomForestRegressor
Expand Down
1 change: 0 additions & 1 deletion examples/parametric/workflow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# LEGACY MODULE - TODO: remove or refactor
from sklearn.ensemble import RandomForestRegressor
from sklearn.linear_model import LinearRegression
Expand Down
5 changes: 2 additions & 3 deletions extension_templates/regression.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Extension template for regressors."""
# todo: write an informative docstring for the file or module, remove the above
# todo: add an appropriate copyright notice for your estimator
Expand Down Expand Up @@ -55,8 +54,8 @@ def __init__(self, paramname, paramname2="paramname2default"):
self.paramname = paramname
self.paramname2 = "paramname2default"

# todo: change "ClassName" to the name of the class
super(ClassName, self).__init__()
# leave this as is
super().__init__()

# todo: optional, parameter checking logic (if applicable) should happen here
# if writes derived values to self, should *not* overwrite self.parama etc
Expand Down
1 change: 0 additions & 1 deletion skpro/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""skpro."""

__version__ = "2.0.0"
Expand Down
1 change: 0 additions & 1 deletion skpro/base/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Base module with base classes BaseObject, BaseEstimator."""
# copyright: skpro developers, BSD-3-Clause License (see LICENSE file)

Expand Down
1 change: 0 additions & 1 deletion skpro/base/_base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Base class and template for regressors and transformers."""
from skbase.base import BaseEstimator as _BaseEstimator
from skbase.base import BaseMetaEstimator as _BaseMetaEstimator
Expand Down
1 change: 0 additions & 1 deletion skpro/base/old_base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# LEGACY MODULE - TODO: remove or refactor
import abc
import functools
Expand Down
1 change: 0 additions & 1 deletion skpro/benchmarking/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# -*- coding: utf-8 -*-
"""Benchmarking and evaluation."""
2 changes: 0 additions & 2 deletions skpro/benchmarking/evaluate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# copyright: skpro developers, BSD-3-Clause License (see LICENSE file)
"""Utility for benchmark evaluation of probabilistic regression models."""
# based on the sktime utility of the same name
Expand All @@ -18,7 +17,6 @@


def _split(X, y, train, test):

# split data according to cv
X_train, X_test = X.iloc[train], X.iloc[test]

Expand Down
1 change: 0 additions & 1 deletion skpro/benchmarking/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# -*- coding: utf-8 -*-
"""Tests for benchmarking and evaluation."""
1 change: 0 additions & 1 deletion skpro/benchmarking/tests/test_evaluate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Tests for evaluate utility."""
# copyright: skpro developers, BSD-3-Clause License (see LICENSE file)
# based on the sktime tests of the same name
Expand Down
1 change: 0 additions & 1 deletion skpro/datatypes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Module exports: data type definitions, checks, validation, fixtures, converters."""
# this module has been adapted from sktime
# it is largely copy-pasting the Proba and Table parts
Expand Down
3 changes: 1 addition & 2 deletions skpro/datatypes/_check.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# copyright: skpro developers, BSD-3-Clause License (see LICENSE file)
"""Machine type checkers for scitypes.
Expand Down Expand Up @@ -41,7 +40,7 @@

def _check_scitype_valid(scitype: str = None):
"""Check validity of scitype."""
valid_scitypes = list(set([x[1] for x in check_dict.keys()]))
valid_scitypes = list({x[1] for x in check_dict.keys()})

if not isinstance(scitype, str):
raise TypeError(f"scitype should be a str but found {type(scitype)}")
Expand Down
1 change: 0 additions & 1 deletion skpro/datatypes/_common.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# copyright: skpro developers, BSD-3-Clause License (see LICENSE file)
"""Common private utilities for checkers and converters."""

Expand Down
5 changes: 2 additions & 3 deletions skpro/datatypes/_convert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# copyright: skpro developers, BSD-3-Clause License (see LICENSE file)
"""Machine type converters for scitypes.
Expand Down Expand Up @@ -281,8 +280,8 @@ def _conversions_defined(scitype: str):
0 if conversion from i to j is not defined
"""
pairs = [(x[0], x[1]) for x in list(convert_dict.keys()) if x[2] == scitype]
cols0 = set([x[0] for x in list(convert_dict.keys()) if x[2] == scitype])
cols1 = set([x[1] for x in list(convert_dict.keys()) if x[2] == scitype])
cols0 = {x[0] for x in list(convert_dict.keys()) if x[2] == scitype}
cols1 = {x[1] for x in list(convert_dict.keys()) if x[2] == scitype}
cols = sorted(list(cols0.union(cols1)))

mat = np.zeros((len(cols), len(cols)), dtype=int)
Expand Down
1 change: 0 additions & 1 deletion skpro/datatypes/_convert_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# -*- coding: utf-8 -*-
"""Conversion auxiliary utilities."""
2 changes: 0 additions & 2 deletions skpro/datatypes/_convert_utils/_coerce.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Conercion utilities for mtypes."""

__author__ = ["fkiraly"]
Expand All @@ -7,7 +6,6 @@


def _is_nullable_numeric(dtype):

return dtype in ["Int64", "Float64", "boolean"]


Expand Down
3 changes: 1 addition & 2 deletions skpro/datatypes/_convert_utils/_convert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Conversion utilities for mtypes."""

__author__ = ["fkiraly"]
Expand Down Expand Up @@ -64,7 +63,7 @@ def _extend_conversions(mtype, anchor_mtype, convert_dict, mtype_universe=None):
scitype = list(keys)[0][2]

if mtype_universe is None:
mtype_universe = set([x[1] for x in list(keys)])
mtype_universe = {x[1] for x in list(keys)}
mtype_universe = mtype_universe.union([x[0] for x in list(keys)])

for tp in set(mtype_universe).difference([mtype, anchor_mtype]):
Expand Down
1 change: 0 additions & 1 deletion skpro/datatypes/_examples.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# copyright: skpro developers, BSD-3-Clause License (see LICENSE file)
"""Example fixtures for mtypes/scitypes.
Expand Down
1 change: 0 additions & 1 deletion skpro/datatypes/_proba/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Type checkers, converters and mtype inference for probabilistic return types."""

from skpro.datatypes._proba._check import check_dict as check_dict_Proba
Expand Down
3 changes: 0 additions & 3 deletions skpro/datatypes/_proba/_check.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Machine type checkers for Series scitype.
Exports checkers for Series scitype:
Expand Down Expand Up @@ -48,7 +47,6 @@


def check_pred_quantiles_proba(obj, return_metadata=False, var_name="obj"):

metadata = dict()

# check if the input is a dataframe
Expand Down Expand Up @@ -103,7 +101,6 @@ def check_pred_quantiles_proba(obj, return_metadata=False, var_name="obj"):


def check_pred_interval_proba(obj, return_metadata=False, var_name="obj"):

metadata = dict()

# check if the input is a dataframe
Expand Down
4 changes: 0 additions & 4 deletions skpro/datatypes/_proba/_convert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Machine type converters for Series scitype.
Exports conversion and mtype dictionary for Series scitype:
Expand Down Expand Up @@ -44,7 +43,6 @@


def convert_identity(obj, store=None):

return obj


Expand Down Expand Up @@ -109,7 +107,6 @@ def convert_pred_interval_to_quantiles(y_pred, inplace=False):


def convert_interval_to_quantiles(obj: pd.DataFrame, store=None) -> pd.DataFrame:

return convert_pred_interval_to_quantiles(y_pred=obj)


Expand Down Expand Up @@ -169,7 +166,6 @@ def convert_pred_quantiles_to_interval(y_pred, inplace=False):


def convert_quantiles_to_interval(obj: pd.DataFrame, store=None) -> pd.DataFrame:

return convert_pred_quantiles_to_interval(y_pred=obj)


Expand Down
1 change: 0 additions & 1 deletion skpro/datatypes/_proba/_examples.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Example generation for testing.
Exports dict of examples, useful for testing as fixtures.
Expand Down
1 change: 0 additions & 1 deletion skpro/datatypes/_registry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# copyright: skpro developers, BSD-3-Clause License (see LICENSE file)
"""Registry of mtypes and scitypes.
Expand Down
1 change: 0 additions & 1 deletion skpro/datatypes/_table/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Module exports: Series type checkers, converters and mtype inference."""

from skpro.datatypes._table._check import check_dict as check_dict_Table
Expand Down
6 changes: 0 additions & 6 deletions skpro/datatypes/_table/_check.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Machine type checkers for Table scitype.
Exports checkers for Table scitype:
Expand Down Expand Up @@ -49,7 +48,6 @@


def check_pddataframe_table(obj, return_metadata=False, var_name="obj"):

metadata = dict()

if not isinstance(obj, pd.DataFrame):
Expand Down Expand Up @@ -79,7 +77,6 @@ def check_pddataframe_table(obj, return_metadata=False, var_name="obj"):


def check_pdseries_table(obj, return_metadata=False, var_name="obj"):

metadata = dict()

if not isinstance(obj, pd.Series):
Expand Down Expand Up @@ -112,7 +109,6 @@ def check_pdseries_table(obj, return_metadata=False, var_name="obj"):


def check_numpy1d_table(obj, return_metadata=False, var_name="obj"):

metadata = dict()

if not isinstance(obj, np.ndarray):
Expand Down Expand Up @@ -142,7 +138,6 @@ def check_numpy1d_table(obj, return_metadata=False, var_name="obj"):


def check_numpy2d_table(obj, return_metadata=False, var_name="obj"):

metadata = dict()

if not isinstance(obj, np.ndarray):
Expand Down Expand Up @@ -171,7 +166,6 @@ def check_numpy2d_table(obj, return_metadata=False, var_name="obj"):


def check_list_of_dict_table(obj, return_metadata=False, var_name="obj"):

metadata = dict()

if not isinstance(obj, list):
Expand Down
Loading

0 comments on commit fac4c28

Please sign in to comment.