mirror of
https://github.com/Doctorado-ML/Odte.git
synced 2025-07-11 08:12:06 +00:00
Merge pull request #2 from Doctorado-ML/sklearn024
Fix scikit-learn 0.24 classifier validation (#1)
This commit is contained in:
commit
addbcd8048
47
.github/workflows/main.yml
vendored
Normal file
47
.github/workflows/main.yml
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, ubuntu-latest]
|
||||||
|
python: [3.8]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Python ${{ matrix.python }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python }}
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
pip install -q --upgrade pip
|
||||||
|
pip install -q -r requirements.txt
|
||||||
|
pip install -q --upgrade codecov coverage black flake8 codacy-coverage
|
||||||
|
- name: Lint
|
||||||
|
run: |
|
||||||
|
black --check --diff stree
|
||||||
|
flake8 --count stree
|
||||||
|
- name: Tests
|
||||||
|
run: |
|
||||||
|
coverage run -m unittest -v odte.tests
|
||||||
|
coverage xml
|
||||||
|
- name: Upload coverage to Codecov
|
||||||
|
uses: codecov/codecov-action@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
files: ./coverage.xml
|
||||||
|
- name: Run codacy-coverage-reporter
|
||||||
|
if: runner.os == 'Linux'
|
||||||
|
uses: codacy/codacy-coverage-reporter-action@master
|
||||||
|
with:
|
||||||
|
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
||||||
|
coverage-reports: coverage.xml
|
@ -1,18 +1,27 @@
|
|||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/ambv/black
|
- repo: https://github.com/ambv/black
|
||||||
rev: stable
|
rev: 20.8b1
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
|
exclude: ".virtual_documents"
|
||||||
language_version: python3.8
|
language_version: python3.8
|
||||||
- repo: https://gitlab.com/pycqa/flake8
|
- repo: https://gitlab.com/pycqa/flake8
|
||||||
rev: 3.8.3
|
rev: 3.8.4
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
|
exclude: ".virtual_documents"
|
||||||
# - repo: https://github.com/pre-commit/mirrors-mypy
|
# - repo: https://github.com/pre-commit/mirrors-mypy
|
||||||
# rev: '' # Use the sha / tag you want to point at
|
# rev: "v0.790" # Use the sha / tag you want to point at
|
||||||
# hooks:
|
# hooks:
|
||||||
# - id: mypy
|
# - id: mypy
|
||||||
# args: [--strict, --ignore-missing-imports]
|
# # args: [--strict, --ignore-missing-imports]
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v3.4.0
|
||||||
|
hooks:
|
||||||
|
- id: trailing-whitespace
|
||||||
|
- id: check-case-conflict
|
||||||
|
- id: check-ast
|
||||||
|
- id: trailing-whitespace
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: unittest
|
- id: unittest
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
[](https://app.codeship.com/projects/399830)
|

|
||||||
[](https://codecov.io/gh/Doctorado-ML/odte)
|
[](https://codecov.io/gh/Doctorado-ML/odte)
|
||||||
[](https://www.codacy.com/gh/Doctorado-ML/Odte?utm_source=github.com&utm_medium=referral&utm_content=Doctorado-ML/Odte&utm_campaign=Badge_Grade)
|
[](https://www.codacy.com/gh/Doctorado-ML/Odte?utm_source=github.com&utm_medium=referral&utm_content=Doctorado-ML/Odte&utm_campaign=Badge_Grade)
|
||||||
|
|
||||||
# Odte
|
# Odte
|
||||||
|
|
||||||
Oblique Decision Tree Ensemble
|
Oblique Decision Tree Ensemble
|
||||||
|
@ -33,15 +33,11 @@ class Odte(BaseEnsemble, ClassifierMixin): # type: ignore
|
|||||||
max_samples: Optional[Union[int, float]] = None,
|
max_samples: Optional[Union[int, float]] = None,
|
||||||
n_estimators: int = 100,
|
n_estimators: int = 100,
|
||||||
):
|
):
|
||||||
base_estimator = (
|
|
||||||
Stree(random_state=random_state)
|
|
||||||
if base_estimator is None
|
|
||||||
else base_estimator
|
|
||||||
)
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
base_estimator=base_estimator,
|
base_estimator=base_estimator,
|
||||||
n_estimators=n_estimators,
|
n_estimators=n_estimators,
|
||||||
)
|
)
|
||||||
|
self.base_estimator = base_estimator
|
||||||
self.n_jobs = n_jobs
|
self.n_jobs = n_jobs
|
||||||
self.n_estimators = n_estimators
|
self.n_estimators = n_estimators
|
||||||
self.random_state = random_state
|
self.random_state = random_state
|
||||||
|
@ -6,6 +6,7 @@ import warnings
|
|||||||
from sklearn.exceptions import ConvergenceWarning
|
from sklearn.exceptions import ConvergenceWarning
|
||||||
|
|
||||||
from odte import Odte
|
from odte import Odte
|
||||||
|
from stree import Stree
|
||||||
from .utils import load_dataset
|
from .utils import load_dataset
|
||||||
|
|
||||||
|
|
||||||
@ -86,7 +87,10 @@ class Odte_test(unittest.TestCase):
|
|||||||
X, y = [[1, 2], [5, 6], [9, 10], [16, 17]], [0, 1, 1, 2]
|
X, y = [[1, 2], [5, 6], [9, 10], [16, 17]], [0, 1, 1, 2]
|
||||||
expected = [0, 1, 1, 2]
|
expected = [0, 1, 1, 2]
|
||||||
tclf = Odte(
|
tclf = Odte(
|
||||||
random_state=self._random_state, n_estimators=10, n_jobs=-1
|
base_estimator=Stree(),
|
||||||
|
random_state=self._random_state,
|
||||||
|
n_estimators=10,
|
||||||
|
n_jobs=-1,
|
||||||
)
|
)
|
||||||
tclf.set_params(
|
tclf.set_params(
|
||||||
**dict(
|
**dict(
|
||||||
@ -103,6 +107,7 @@ class Odte_test(unittest.TestCase):
|
|||||||
X, y = load_dataset(self._random_state)
|
X, y = load_dataset(self._random_state)
|
||||||
expected = y
|
expected = y
|
||||||
tclf = Odte(
|
tclf = Odte(
|
||||||
|
base_estimator=Stree(),
|
||||||
random_state=self._random_state,
|
random_state=self._random_state,
|
||||||
max_features=1.0,
|
max_features=1.0,
|
||||||
max_samples=0.1,
|
max_samples=0.1,
|
||||||
@ -138,6 +143,7 @@ class Odte_test(unittest.TestCase):
|
|||||||
for max_features in ["auto", None]:
|
for max_features in ["auto", None]:
|
||||||
for splitter in ["best", "random"]:
|
for splitter in ["best", "random"]:
|
||||||
tclf = Odte(
|
tclf = Odte(
|
||||||
|
base_estimator=Stree(),
|
||||||
random_state=self._random_state,
|
random_state=self._random_state,
|
||||||
max_features=max_features,
|
max_features=max_features,
|
||||||
n_estimators=10,
|
n_estimators=10,
|
||||||
|
6
setup.py
6
setup.py
@ -1,6 +1,6 @@
|
|||||||
import setuptools
|
import setuptools
|
||||||
|
|
||||||
__version__ = "0.1.0"
|
__version__ = "0.2.0"
|
||||||
__author__ = "Ricardo Montañana Gómez"
|
__author__ = "Ricardo Montañana Gómez"
|
||||||
|
|
||||||
|
|
||||||
@ -25,12 +25,12 @@ setuptools.setup(
|
|||||||
classifiers=[
|
classifiers=[
|
||||||
"Development Status :: 4 - Beta",
|
"Development Status :: 4 - Beta",
|
||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
"Programming Language :: Python :: 3.7",
|
"Programming Language :: Python :: 3.8",
|
||||||
"Natural Language :: English",
|
"Natural Language :: English",
|
||||||
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
||||||
"Intended Audience :: Science/Research",
|
"Intended Audience :: Science/Research",
|
||||||
],
|
],
|
||||||
install_requires=["scikit-learn>=0.23.0", "numpy", "ipympl", "stree"],
|
install_requires=["scikit-learn", "numpy", "ipympl", "stree"],
|
||||||
test_suite="odte.tests",
|
test_suite="odte.tests",
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user