Fix scikit-learn 0.24 classifier validation (#1)

Add github actions CI
update python version and odte version in setup
This commit is contained in:
Ricardo Montañana Gómez 2021-01-20 01:09:57 +01:00
parent ca773d3537
commit 24b91962f0
Signed by: rmontanana
GPG Key ID: 46064262FD9A7ADE
6 changed files with 77 additions and 18 deletions

47
.github/workflows/main.yml vendored Normal file
View 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

View File

@ -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

View File

@ -1,6 +1,7 @@
[![Codeship Status for Doctorado-ML/Odte](https://app.codeship.com/projects/c279cef0-8f1b-0138-f3d2-5e67174268f2/status?branch=master)](https://app.codeship.com/projects/399830)
![CI](https://github.com/Doctorado-ML/Odte/workflows/CI/badge.svg)
[![codecov](https://codecov.io/gh/Doctorado-ML/odte/branch/master/graph/badge.svg)](https://codecov.io/gh/Doctorado-ML/odte)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/c85f935ac6a0482ab67d3ebed4611459)](https://www.codacy.com/gh/Doctorado-ML/Odte?utm_source=github.com&utm_medium=referral&utm_content=Doctorado-ML/Odte&utm_campaign=Badge_Grade)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/c85f935ac6a0482ab67d3ebed4611459)](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

View File

@ -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

View File

@ -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,

View File

@ -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,
)