mirror of
https://github.com/Doctorado-ML/Odte.git
synced 2025-07-11 00:02:30 +00:00
Update to latest tools
This commit is contained in:
parent
6d0262078d
commit
1eb786a76f
@ -9,4 +9,5 @@ exclude_lines =
|
|||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
if __name__ == .__main__.:
|
if __name__ == .__main__.:
|
||||||
ignore_errors = True
|
ignore_errors = True
|
||||||
omit =
|
omit =
|
||||||
|
odte/__init__.py
|
56
.github/workflows/codeql-analysis.yml
vendored
Normal file
56
.github/workflows/codeql-analysis.yml
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ master ]
|
||||||
|
schedule:
|
||||||
|
- cron: '16 17 * * 3'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: [ 'python' ]
|
||||||
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||||
|
# Learn more:
|
||||||
|
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
|
# By default, queries listed here will override any specified in a config file.
|
||||||
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||||
|
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||||
|
|
||||||
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
|
# 📚 https://git.io/JvXDl
|
||||||
|
|
||||||
|
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||||
|
# and modify them (or add more) to build your code if your project
|
||||||
|
# uses a compiled language
|
||||||
|
|
||||||
|
#- run: |
|
||||||
|
# make bootstrap
|
||||||
|
# make release
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v1
|
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@ -12,7 +12,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, ubuntu-latest]
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||||
python: [3.8]
|
python: [3.8]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -4,7 +4,7 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
exclude: ".virtual_documents"
|
exclude: ".virtual_documents"
|
||||||
language_version: python3.8
|
language_version: python3.9
|
||||||
- repo: https://gitlab.com/pycqa/flake8
|
- repo: https://gitlab.com/pycqa/flake8
|
||||||
rev: 3.8.4
|
rev: 3.8.4
|
||||||
hooks:
|
hooks:
|
||||||
|
50
Makefile
Normal file
50
Makefile
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
SHELL := /bin/bash
|
||||||
|
.DEFAULT_GOAL := help
|
||||||
|
.PHONY: coverage deps help lint push test doc build
|
||||||
|
|
||||||
|
coverage: ## Run tests with coverage
|
||||||
|
coverage erase
|
||||||
|
coverage run -m unittest -v odte.tests
|
||||||
|
coverage report -m
|
||||||
|
|
||||||
|
deps: ## Install dependencies
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
lint: ## Lint and static-check
|
||||||
|
black stree
|
||||||
|
flake8 stree
|
||||||
|
mypy stree
|
||||||
|
|
||||||
|
push: ## Push code with tags
|
||||||
|
git push && git push --tags
|
||||||
|
|
||||||
|
test: ## Run tests
|
||||||
|
python -m unittest -v odte.tests
|
||||||
|
|
||||||
|
doc: ## Update documentation
|
||||||
|
make -C docs --makefile=Makefile html
|
||||||
|
|
||||||
|
build: ## Build package
|
||||||
|
rm -fr dist/*
|
||||||
|
rm -fr build/*
|
||||||
|
python setup.py sdist bdist_wheel
|
||||||
|
|
||||||
|
doc-clean: ## Update documentation
|
||||||
|
make -C docs --makefile=Makefile clean
|
||||||
|
|
||||||
|
help: ## Show help message
|
||||||
|
@IFS=$$'\n' ; \
|
||||||
|
help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/:/'`); \
|
||||||
|
printf "%s\n\n" "Usage: make [task]"; \
|
||||||
|
printf "%-20s %s\n" "task" "help" ; \
|
||||||
|
printf "%-20s %s\n" "------" "----" ; \
|
||||||
|
for help_line in $${help_lines[@]}; do \
|
||||||
|
IFS=$$':' ; \
|
||||||
|
help_split=($$help_line) ; \
|
||||||
|
help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
|
||||||
|
help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
|
||||||
|
printf '\033[36m'; \
|
||||||
|
printf "%-20s %s" $$help_command ; \
|
||||||
|
printf '\033[0m'; \
|
||||||
|
printf "%s\n" $$help_info; \
|
||||||
|
done
|
@ -1,6 +1,9 @@
|
|||||||

|

|
||||||
[](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/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Doctorado-ML/Odte&utm_campaign=Badge_Grade)
|
||||||
|
[](https://badge.fury.io/py/Odte)
|
||||||
|

|
||||||
|
doi
|
||||||
|
|
||||||
# Odte
|
# Odte
|
||||||
|
|
||||||
|
10
codecov.yml
10
codecov.yml
@ -1,12 +1,12 @@
|
|||||||
overage:
|
coverage:
|
||||||
status:
|
status:
|
||||||
project:
|
project:
|
||||||
default:
|
default:
|
||||||
target: 90%
|
target: 100%
|
||||||
comment:
|
comment:
|
||||||
layout: "reach, diff, flags, files"
|
layout: "reach, diff, flags, files"
|
||||||
behavior: default
|
behavior: default
|
||||||
require_changes: false
|
require_changes: false
|
||||||
require_base: yes
|
require_base: yes
|
||||||
require_head: yes
|
require_head: yes
|
||||||
branches: null
|
branches: null
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
from .Odte import Odte
|
from .Odte import Odte
|
||||||
|
|
||||||
|
__version__ = "0.3.0"
|
||||||
|
|
||||||
|
__author__ = "Ricardo Montañana Gómez"
|
||||||
|
__copyright__ = "Copyright 2020-2021, Ricardo Montañana Gómez"
|
||||||
|
__license__ = "MIT License"
|
||||||
|
__author_email__ = "ricardo.montanana@alu.uclm.es"
|
||||||
|
|
||||||
__all__ = ["Odte"]
|
__all__ = ["Odte"]
|
||||||
|
@ -31,13 +31,13 @@ class Odte_test(unittest.TestCase):
|
|||||||
|
|
||||||
def test_initialize_max_feature(self):
|
def test_initialize_max_feature(self):
|
||||||
expected_values = [
|
expected_values = [
|
||||||
[6, 7, 8, 15],
|
[4, 7, 12, 14],
|
||||||
[3, 4, 5, 6, 10, 13],
|
[2, 4, 6, 7, 12, 14],
|
||||||
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
||||||
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
||||||
[6, 7, 8, 15],
|
[4, 7, 12, 14],
|
||||||
[6, 7, 8, 15],
|
[4, 7, 12, 14],
|
||||||
[6, 7, 8, 15],
|
[4, 7, 12, 14],
|
||||||
]
|
]
|
||||||
X, y = load_dataset(
|
X, y = load_dataset(
|
||||||
random_state=self._random_state, n_features=16, n_samples=10
|
random_state=self._random_state, n_features=16, n_samples=10
|
||||||
@ -122,7 +122,7 @@ class Odte_test(unittest.TestCase):
|
|||||||
|
|
||||||
def test_score(self):
|
def test_score(self):
|
||||||
X, y = load_dataset(self._random_state)
|
X, y = load_dataset(self._random_state)
|
||||||
expected = 0.9526666666666667
|
expected = 0.9513333333333334
|
||||||
tclf = Odte(
|
tclf = Odte(
|
||||||
random_state=self._random_state,
|
random_state=self._random_state,
|
||||||
max_features=None,
|
max_features=None,
|
||||||
@ -132,24 +132,40 @@ class Odte_test(unittest.TestCase):
|
|||||||
self.assertAlmostEqual(expected, computed)
|
self.assertAlmostEqual(expected, computed)
|
||||||
|
|
||||||
def test_score_splitter_max_features(self):
|
def test_score_splitter_max_features(self):
|
||||||
X, y = load_dataset(self._random_state, n_features=12, n_samples=150)
|
X, y = load_dataset(self._random_state, n_features=16, n_samples=500)
|
||||||
results = [
|
results = [
|
||||||
0.86,
|
0.948,
|
||||||
0.8933333333333333,
|
0.924,
|
||||||
0.9933333333333333,
|
0.926,
|
||||||
0.9933333333333333,
|
0.94,
|
||||||
|
0.932,
|
||||||
|
0.936,
|
||||||
|
0.962,
|
||||||
|
0.962,
|
||||||
|
0.962,
|
||||||
|
0.962,
|
||||||
|
0.962,
|
||||||
|
0.962,
|
||||||
|
0.962,
|
||||||
]
|
]
|
||||||
random.seed(self._random_state)
|
random.seed(self._random_state)
|
||||||
for max_features in ["auto", None]:
|
for max_features in ["auto", None]:
|
||||||
for splitter in ["best", "random"]:
|
for splitter in [
|
||||||
|
"best",
|
||||||
|
"random",
|
||||||
|
"trandom",
|
||||||
|
"mutual",
|
||||||
|
"iwss",
|
||||||
|
"cfs",
|
||||||
|
]:
|
||||||
tclf = Odte(
|
tclf = Odte(
|
||||||
base_estimator=Stree(),
|
base_estimator=Stree(),
|
||||||
random_state=self._random_state,
|
random_state=self._random_state,
|
||||||
max_features=max_features,
|
n_estimators=3,
|
||||||
n_estimators=10,
|
|
||||||
)
|
)
|
||||||
tclf.set_params(
|
tclf.set_params(
|
||||||
**dict(
|
**dict(
|
||||||
|
base_estimator__max_features=max_features,
|
||||||
base_estimator__splitter=splitter,
|
base_estimator__splitter=splitter,
|
||||||
base_estimator__random_state=self._random_state,
|
base_estimator__random_state=self._random_state,
|
||||||
)
|
)
|
||||||
|
@ -1,5 +1 @@
|
|||||||
numpy
|
stree
|
||||||
scikit-learn
|
|
||||||
pandas
|
|
||||||
ipympl
|
|
||||||
git+https://github.com/doctorado-ml/stree
|
|
28
setup.py
28
setup.py
@ -1,25 +1,35 @@
|
|||||||
import setuptools
|
import setuptools
|
||||||
|
|
||||||
__version__ = "0.2.0"
|
|
||||||
__author__ = "Ricardo Montañana Gómez"
|
|
||||||
|
|
||||||
|
|
||||||
def readme():
|
def readme():
|
||||||
with open("README.md") as f:
|
with open("README.md") as f:
|
||||||
return f.read()
|
return f.read()
|
||||||
|
|
||||||
|
|
||||||
|
def get_data(field):
|
||||||
|
item = ""
|
||||||
|
with open("stree/__init__.py") as f:
|
||||||
|
for line in f.readlines():
|
||||||
|
if line.startswith(f"__{field}__"):
|
||||||
|
delim = '"' if '"' in line else "'"
|
||||||
|
item = line.split(delim)[1]
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
raise RuntimeError(f"Unable to find {field} string.")
|
||||||
|
return item
|
||||||
|
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="Odte",
|
name="Odte",
|
||||||
version=__version__,
|
version=get_data("version"),
|
||||||
license="MIT License",
|
license=get_data("license"),
|
||||||
description="Oblique decision tree Ensemble",
|
description="Oblique decision tree Ensemble",
|
||||||
long_description=readme(),
|
long_description=readme(),
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
packages=setuptools.find_packages(),
|
packages=setuptools.find_packages(),
|
||||||
url="https://github.com/doctorado-ml/stree",
|
url="https://github.com/doctorado-ml/odte",
|
||||||
author=__author__,
|
author=get_data("author"),
|
||||||
author_email="ricardo.montanana@alu.uclm.es",
|
author_email=get_data("author_email"),
|
||||||
keywords="scikit-learn oblique-classifier oblique-decision-tree decision-\
|
keywords="scikit-learn oblique-classifier oblique-decision-tree decision-\
|
||||||
tree ensemble svm svc",
|
tree ensemble svm svc",
|
||||||
classifiers=[
|
classifiers=[
|
||||||
@ -30,7 +40,7 @@ setuptools.setup(
|
|||||||
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
||||||
"Intended Audience :: Science/Research",
|
"Intended Audience :: Science/Research",
|
||||||
],
|
],
|
||||||
install_requires=["scikit-learn", "numpy", "ipympl", "stree"],
|
install_requires=["stree"],
|
||||||
test_suite="odte.tests",
|
test_suite="odte.tests",
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user