Ricardo Montañana 9b3c7ccdfa Add Hyperparameters description to README
Comment get_subspace method
Add environment info for binder (runtime.txt)
2021-01-13 11:39:47 +01:00
2020-11-03 11:36:05 +01:00
2020-06-27 18:29:40 +02:00
2020-06-11 13:45:24 +02:00
2020-05-09 23:01:30 +02:00
2020-06-14 14:00:21 +02:00
2021-01-11 13:46:30 +01:00

CI codecov Codacy Badge

Stree

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

Installation

pip install git+https://github.com/doctorado-ml/stree

Examples

Jupyter notebooks

  • Binder Benchmark

  • Test Benchmark

  • Test2 Test features

  • Adaboost Adaboost

  • Gridsearch Gridsearch

  • Test Graphics Test Graphics

Hyperparameters

Hyperparameter used
in
scikit
Values Default Meaning
C Yes 1.0 Regularization parameter. The strength of the regularization is inversely proportional to C. Must be strictly positive.
kernel Yes {"linear", "poly", "rbf"} linear Specifies the kernel type to be used in the algorithm. It must be one of linear, poly or rbf.
max_iter Yes 1e5 Hard limit on iterations within solver, or -1 for no limit.
random_state Yes None Controls the pseudo random number generation for shuffling the data for probability estimates. Ignored when probability is False.
Pass an int for reproducible output across multiple function calls
max_depth No None Specifies the maximum depth of the tree
tol Yes 1e-4 Tolerance for stopping criterion.
degree Yes 3 Degree of the polynomial kernel function (poly). Ignored by all other kernels.
gamma Yes {"scale", "auto"} or scale Kernel coefficient for rbf and poly.
if gamma='scale' (default) is passed then it uses 1 / (n_features * X.var()) as value of gamma,
if auto, uses 1 / n_features.
split_criteria No {"impurity", "max_samples"} impurity Decides (just in case of a multi class classification) which column (class) use to split the dataset in a node**
criterion No {“gini”, “entropy”} entropy The function to measure the quality of a split. Supported criteria are “gini” for the Gini impurity and “entropy” for the information gain.
min_samples_split No 0 The minimum number of samples required to split an internal node. 0 (default) for any
max_features No ,
or {“auto”, “sqrt”, “log2”}
None The number of features to consider when looking for the split:
If int, then consider max_features features at each split.
If float, then max_features is a fraction and int(max_features * n_features) features are considered at each split.
If “auto”, then max_features=sqrt(n_features).
If “sqrt”, then max_features=sqrt(n_features).
If “log2”, then max_features=log2(n_features).
If None, then max_features=n_features.
splitter No {"best", "random"} The strategy used to choose the feature set at each node (only used if max_features != num_features). Supported strategies are “best” to choose the best feature set and “random” to choose the a random combination. The algorithm generates 5 candidates at most to choose from.

** Splitting in a STree node

The decision function is applied to the dataset and distances from samples to hyperplanes are computed in a matrix. This matrix haas as many columns as classes the samples belongs to (if more than two, i.e. multiclass classification) or 1 column if it's a binary class dataset. In binary classification only one hyperplane is computed and therefore only one column is needed to store the distances of the samples to it. If three or more classes are present in the dataset we need as many hyperplanes as classes are there, and therefore one column per hyperplane is needed.

In case of multiclass classification we have to decide which column take into account to make the split, that depends on hyperparameter split_criteria, if "impurity" is chosen then STree computes information gain of every split candidate using each column and chooses the one that maximize the information gain, otherwise STree choses the column with more samples with a predicted class (the column with more positive numbers in it).

Once we have the column to take into account for the split, the algorithm splits samples with a positive distance to hyperplane from the rest.

Tests

python -m unittest -v stree.tests
Description
Oblique Tree classifier based on SVM nodes
Readme MIT 11 MiB
Languages
Python 72.2%
Jupyter Notebook 26.9%
Makefile 0.9%