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:
configuration: docs/source/conf.py
build:
os: ubuntu-22.04
tools:
python: "3.12"
python:
version: 3.8
install:
- requirements: requirements.txt
- requirements: docs/requirements.txt

View File

@@ -1,16 +1,18 @@
# STree
![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)
[![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)
[![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)
# 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.
![Stree](https://raw.github.com/doctorado-ml/stree/master/example.png)
## Installation

View File

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

View File

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

View File

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

View File

@@ -6,4 +6,5 @@ Stree
:members:
:undoc-members:
:private-members:
:show-inheritance:
:show-inheritance:
:noindex:

View File

@@ -6,26 +6,21 @@
# -- 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
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 = "STree"
copyright = "2020 - 2022, Ricardo Montañana Gómez"
copyright = "2020 - 2024, Ricardo Montañana Gómez"
author = "Ricardo Montañana Gómez"
# The full version, including alpha/beta/rc tags
version = __version__
release = version
version = release = stree.__version__
# -- General configuration ---------------------------------------------------

View File

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

View File

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

View File

@@ -746,7 +746,7 @@ class Splitter:
Train time - True / Test time - False
"""
# 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)
if data.shape[0] < self._min_samples_split:
# there aren't enough samples to split

View File

@@ -168,16 +168,17 @@ class Stree(BaseEstimator, ClassifierMixin):
self.splitter = splitter
self.normalize = normalize
self.multiclass_strategy = multiclass_strategy
self.depth_ = 0
@staticmethod
def version() -> str:
"""Return the version of the package."""
return __version__
def __call__(self) -> str:
"""Only added to comply with scikit-learn base sestimator for ensembles
"""
return self.version()
def __call__(self) -> None:
"""Only added to comply with scikit-learn base sestimator for
ensembles"""
pass
def _more_tags(self) -> dict:
"""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:
"""Check call method."""
clf = Stree()
self.assertEqual(__version__, clf())
self.assertIsNone(clf())
def test_graph(self):
"""Check graphviz representation of the tree."""