Compare commits

..

6 Commits

Author SHA1 Message Date
cb80e8606b Add ask wiki link and init depth 2025-06-24 18:48:04 +02:00
c93d3fbcc7 Fix scikit-learn version in requirements for tests 2025-05-20 11:31:51 +02:00
f4ca4bbd5b Update comment and readme 2025-03-21 09:51:39 +01:00
e676ddbfcc Update python min version in Readme 2024-08-16 13:14:38 +02:00
Ricardo Montañana Gómez
dc637018e8 Rtd update (#58)
* Update read the docs config

*Update copyright year in docs

* Update python version

* Change build configuration

* Change version read in config

* Refactor config files

* Refactor api config
2024-08-15 11:49:38 +02:00
517013be09 Update readthedocs config place
Refactor __call__ method to do nothing as needed by sklearn
2024-08-14 16:37:36 +02:00
12 changed files with 37 additions and 32 deletions

View File

@@ -3,8 +3,12 @@ version: 2
sphinx: sphinx:
configuration: docs/source/conf.py configuration: docs/source/conf.py
build:
os: ubuntu-22.04
tools:
python: "3.12"
python: python:
version: 3.8
install: install:
- requirements: requirements.txt - requirements: requirements.txt
- requirements: docs/requirements.txt - requirements: docs/requirements.txt

View File

@@ -1,16 +1,18 @@
# STree
![CI](https://github.com/Doctorado-ML/STree/workflows/CI/badge.svg) ![CI](https://github.com/Doctorado-ML/STree/workflows/CI/badge.svg)
[![CodeQL](https://github.com/Doctorado-ML/STree/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/Doctorado-ML/STree/actions/workflows/codeql-analysis.yml) [![CodeQL](https://github.com/Doctorado-ML/STree/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/Doctorado-ML/STree/actions/workflows/codeql-analysis.yml)
[![codecov](https://codecov.io/gh/doctorado-ml/stree/branch/master/graph/badge.svg)](https://codecov.io/gh/doctorado-ml/stree) [![codecov](https://codecov.io/gh/doctorado-ml/stree/branch/master/graph/badge.svg)](https://codecov.io/gh/doctorado-ml/stree)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/35fa3dfd53a24a339344b33d9f9f2f3d)](https://www.codacy.com/gh/Doctorado-ML/STree?utm_source=github.com&utm_medium=referral&utm_content=Doctorado-ML/STree&utm_campaign=Badge_Grade) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/35fa3dfd53a24a339344b33d9f9f2f3d)](https://www.codacy.com/gh/Doctorado-ML/STree?utm_source=github.com&utm_medium=referral&utm_content=Doctorado-ML/STree&utm_campaign=Badge_Grade)
[![PyPI version](https://badge.fury.io/py/STree.svg)](https://badge.fury.io/py/STree) [![PyPI version](https://badge.fury.io/py/STree.svg)](https://badge.fury.io/py/STree)
![https://img.shields.io/badge/python-3.8%2B-blue](https://img.shields.io/badge/python-3.8%2B-brightgreen) ![https://img.shields.io/badge/python-3.11%2B-blue](https://img.shields.io/badge/python-3.11%2B-brightgreen)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/Doctorado-ML/STree)
[![DOI](https://zenodo.org/badge/262658230.svg)](https://zenodo.org/badge/latestdoi/262658230) [![DOI](https://zenodo.org/badge/262658230.svg)](https://zenodo.org/badge/latestdoi/262658230)
# STree ![Stree](https://raw.github.com/doctorado-ml/stree/master/example.png)
Oblique Tree classifier based on SVM nodes. The nodes are built and splitted with sklearn SVC models. Stree is a sklearn estimator and can be integrated in pipelines, grid searches, etc. Oblique Tree classifier based on SVM nodes. The nodes are built and splitted with sklearn SVC models. Stree is a sklearn estimator and can be integrated in pipelines, grid searches, etc.
![Stree](https://raw.github.com/doctorado-ml/stree/master/example.png)
## Installation ## Installation

View File

@@ -1,9 +1,10 @@
Siterator Siterator
========= =========
.. automodule:: Splitter .. automodule:: stree
.. autoclass:: Siterator .. autoclass:: Siterator
:members: :members:
:undoc-members: :undoc-members:
:private-members: :private-members:
:show-inheritance: :show-inheritance:
:noindex:

View File

@@ -1,9 +1,9 @@
Snode Snode
===== =====
.. automodule:: Splitter .. autoclass:: stree.Splitter.Snode
.. autoclass:: Snode
:members: :members:
:undoc-members: :undoc-members:
:private-members: :private-members:
:show-inheritance: :show-inheritance:
:noindex:

View File

@@ -1,9 +1,10 @@
Splitter Splitter
======== ========
.. automodule:: Splitter .. automodule:: stree.Splitter
.. autoclass:: Splitter .. autoclass:: Splitter
:members: :members:
:undoc-members: :undoc-members:
:private-members: :private-members:
:show-inheritance: :show-inheritance:
:noindex:

View File

@@ -7,3 +7,4 @@ Stree
:undoc-members: :undoc-members:
:private-members: :private-members:
:show-inheritance: :show-inheritance:
:noindex:

View File

@@ -6,26 +6,21 @@
# -- Path setup -------------------------------------------------------------- # -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys import sys
from stree._version import __version__ from pathlib import Path
sys.path.insert(0, os.path.abspath("../../stree/")) sys.path.insert(0, str(Path(__file__).parent.parent.parent))
import stree
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
project = "STree" project = "STree"
copyright = "2020 - 2022, Ricardo Montañana Gómez" copyright = "2020 - 2024, Ricardo Montañana Gómez"
author = "Ricardo Montañana Gómez" author = "Ricardo Montañana Gómez"
# The full version, including alpha/beta/rc tags # The full version, including alpha/beta/rc tags
version = __version__ version = release = stree.__version__
release = version
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------

View File

@@ -5,7 +5,6 @@ Welcome to STree's documentation!
:caption: Contents: :caption: Contents:
:titlesonly: :titlesonly:
stree stree
install install
hyperparameters hyperparameters

View File

@@ -1,2 +1,3 @@
scikit-learn>0.24 scikit-learn==1.5.2
coverage
mufs mufs

View File

@@ -746,7 +746,7 @@ class Splitter:
Train time - True / Test time - False Train time - True / Test time - False
""" """
# data contains the distances of every sample to every class hyperplane # data contains the distances of every sample to every class hyperplane
# array of (m, nc) nc = # classes # array of (m, nc) nc = k if ovr, nc = k*(k-1)/2 if ovo
data = self._distances(node, samples) data = self._distances(node, samples)
if data.shape[0] < self._min_samples_split: if data.shape[0] < self._min_samples_split:
# there aren't enough samples to split # there aren't enough samples to split

View File

@@ -168,16 +168,17 @@ class Stree(BaseEstimator, ClassifierMixin):
self.splitter = splitter self.splitter = splitter
self.normalize = normalize self.normalize = normalize
self.multiclass_strategy = multiclass_strategy self.multiclass_strategy = multiclass_strategy
self.depth_ = 0
@staticmethod @staticmethod
def version() -> str: def version() -> str:
"""Return the version of the package.""" """Return the version of the package."""
return __version__ return __version__
def __call__(self) -> str: def __call__(self) -> None:
"""Only added to comply with scikit-learn base sestimator for ensembles """Only added to comply with scikit-learn base sestimator for
""" ensembles"""
return self.version() pass
def _more_tags(self) -> dict: def _more_tags(self) -> dict:
"""Required by sklearn to supply features of the classifier """Required by sklearn to supply features of the classifier

View File

@@ -728,7 +728,7 @@ class Stree_test(unittest.TestCase):
def test_call(self) -> None: def test_call(self) -> None:
"""Check call method.""" """Check call method."""
clf = Stree() clf = Stree()
self.assertEqual(__version__, clf()) self.assertIsNone(clf())
def test_graph(self): def test_graph(self):
"""Check graphviz representation of the tree.""" """Check graphviz representation of the tree."""