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:
|
||||
- repo: https://github.com/ambv/black
|
||||
rev: stable
|
||||
rev: 20.8b1
|
||||
hooks:
|
||||
- id: black
|
||||
exclude: ".virtual_documents"
|
||||
language_version: python3.8
|
||||
- repo: https://gitlab.com/pycqa/flake8
|
||||
rev: 3.8.3
|
||||
rev: 3.8.4
|
||||
hooks:
|
||||
- id: flake8
|
||||
# - repo: https://github.com/pre-commit/mirrors-mypy
|
||||
# rev: '' # Use the sha / tag you want to point at
|
||||
# hooks:
|
||||
# - id: mypy
|
||||
# args: [--strict, --ignore-missing-imports]
|
||||
exclude: ".virtual_documents"
|
||||
# - repo: https://github.com/pre-commit/mirrors-mypy
|
||||
# rev: "v0.790" # Use the sha / tag you want to point at
|
||||
# hooks:
|
||||
# - id: mypy
|
||||
# # 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
|
||||
hooks:
|
||||
- id: unittest
|
||||
|
@ -1,6 +1,7 @@
|
||||
[](https://app.codeship.com/projects/399830)
|
||||

|
||||
[](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
|
||||
|
||||
Oblique Decision Tree Ensemble
|
||||
|
@ -33,15 +33,11 @@ class Odte(BaseEnsemble, ClassifierMixin): # type: ignore
|
||||
max_samples: Optional[Union[int, float]] = None,
|
||||
n_estimators: int = 100,
|
||||
):
|
||||
base_estimator = (
|
||||
Stree(random_state=random_state)
|
||||
if base_estimator is None
|
||||
else base_estimator
|
||||
)
|
||||
super().__init__(
|
||||
base_estimator=base_estimator,
|
||||
n_estimators=n_estimators,
|
||||
)
|
||||
self.base_estimator = base_estimator
|
||||
self.n_jobs = n_jobs
|
||||
self.n_estimators = n_estimators
|
||||
self.random_state = random_state
|
||||
|
@ -6,6 +6,7 @@ import warnings
|
||||
from sklearn.exceptions import ConvergenceWarning
|
||||
|
||||
from odte import Odte
|
||||
from stree import Stree
|
||||
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]
|
||||
expected = [0, 1, 1, 2]
|
||||
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(
|
||||
**dict(
|
||||
@ -103,6 +107,7 @@ class Odte_test(unittest.TestCase):
|
||||
X, y = load_dataset(self._random_state)
|
||||
expected = y
|
||||
tclf = Odte(
|
||||
base_estimator=Stree(),
|
||||
random_state=self._random_state,
|
||||
max_features=1.0,
|
||||
max_samples=0.1,
|
||||
@ -138,6 +143,7 @@ class Odte_test(unittest.TestCase):
|
||||
for max_features in ["auto", None]:
|
||||
for splitter in ["best", "random"]:
|
||||
tclf = Odte(
|
||||
base_estimator=Stree(),
|
||||
random_state=self._random_state,
|
||||
max_features=max_features,
|
||||
n_estimators=10,
|
||||
|
6
setup.py
6
setup.py
@ -1,6 +1,6 @@
|
||||
import setuptools
|
||||
|
||||
__version__ = "0.1.0"
|
||||
__version__ = "0.2.0"
|
||||
__author__ = "Ricardo Montañana Gómez"
|
||||
|
||||
|
||||
@ -25,12 +25,12 @@ setuptools.setup(
|
||||
classifiers=[
|
||||
"Development Status :: 4 - Beta",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Natural Language :: English",
|
||||
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
||||
"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",
|
||||
zip_safe=False,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user