Add AdaBoostStree model

This commit is contained in:
2022-03-21 23:00:28 +01:00
parent 58129e97fa
commit 5dbc067b28
2 changed files with 500 additions and 2 deletions

View File

@@ -0,0 +1,491 @@
{
"balance-scale": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 10000.0,
"base_estimator__gamma": 0.1,
"base_estimator__kernel": "rbf",
"base_estimator__max_iter": 10000.0,
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"balloons": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 7,
"base_estimator__gamma": 0.1,
"base_estimator__kernel": "rbf",
"base_estimator__max_iter": 10000.0,
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"breast-cancer-wisc-diag": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 0.2,
"base_estimator__max_iter": 10000.0,
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"breast-cancer-wisc-prog": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 0.2,
"base_estimator__max_iter": 10000.0,
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"breast-cancer-wisc": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__kernel": "rbf",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"breast-cancer": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"cardiotocography-10clases": [
0.0,
{ "n_estimators": 100, "n_jobs": -1 },
"-program made-"
],
"cardiotocography-3clases": [
0.0,
{ "n_estimators": 100, "n_jobs": -1 },
"-program made-"
],
"conn-bench-sonar-mines-rocks": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__kernel": "rbf",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"cylinder-bands": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__kernel": "rbf",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"dermatology": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 55,
"base_estimator__max_iter": 10000.0,
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"echocardiogram": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__splitter": "random",
"base_estimator__max_features": "auto"
},
"-program made-"
],
"fertility": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 0.05,
"base_estimator__max_features": "auto",
"base_estimator__max_iter": 10000.0,
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"haberman-survival": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"heart-hungarian": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 0.05,
"base_estimator__max_iter": 10000.0,
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"hepatitis": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 7,
"base_estimator__gamma": 0.1,
"base_estimator__kernel": "rbf",
"base_estimator__max_iter": 10000.0,
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"ilpd-indian-liver": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"ionosphere": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 7,
"base_estimator__gamma": 0.1,
"base_estimator__kernel": "rbf",
"base_estimator__max_iter": 10000.0,
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"iris": [0.0, { "n_estimators": 100, "n_jobs": -1 }, "-program made-"],
"led-display": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"libras": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 0.08,
"base_estimator__max_iter": 10000.0,
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"low-res-spect": [
0.0,
{ "n_estimators": 100, "n_jobs": -1 },
"-program made-"
],
"lymphography": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 0.05,
"base_estimator__max_iter": 10000.0,
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"mammographic": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__kernel": "rbf",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"molec-biol-promoter": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__kernel": "rbf",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"musk-1": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 0.05,
"base_estimator__gamma": 0.1,
"base_estimator__kernel": "poly",
"base_estimator__max_iter": 10000.0,
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"oocytes_merluccius_nucleus_4d": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 8.25,
"base_estimator__gamma": 0.1,
"base_estimator__kernel": "poly",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"oocytes_merluccius_states_2f": [
0.0,
{ "n_estimators": 100, "n_jobs": -1 },
"-program made-"
],
"oocytes_trisopterus_nucleus_2f": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"oocytes_trisopterus_states_5b": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 0.11,
"base_estimator__max_iter": 10000.0,
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"parkinsons": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"pima": [0.0, { "n_estimators": 100, "n_jobs": -1 }, "-program made-"],
"pittsburg-bridges-MATERIAL": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 7,
"base_estimator__gamma": 0.1,
"base_estimator__kernel": "rbf",
"base_estimator__max_iter": 10000.0,
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"pittsburg-bridges-REL-L": [
0.0,
{ "n_estimators": 100, "n_jobs": -1 },
"-program made-"
],
"pittsburg-bridges-SPAN": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 0.05,
"base_estimator__max_iter": 10000.0,
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"pittsburg-bridges-T-OR-D": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__splitter": "random",
"base_estimator__max_features": "auto"
},
"-program made-"
],
"planning": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 7,
"base_estimator__gamma": 10.0,
"base_estimator__kernel": "rbf",
"base_estimator__max_iter": 10000.0,
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"post-operative": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 55,
"base_estimator__degree": 5,
"base_estimator__gamma": 0.1,
"base_estimator__kernel": "poly",
"base_estimator__max_iter": 10000.0,
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"seeds": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 10000.0,
"base_estimator__max_iter": 10000.0,
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"statlog-australian-credit": [
0.0,
{ "n_estimators": 100, "n_jobs": -1 },
"-program made-"
],
"statlog-german-credit": [
0.0,
{ "n_estimators": 100, "n_jobs": -1 },
"-program made-"
],
"statlog-heart": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"statlog-image": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 7,
"base_estimator__max_iter": 10000.0,
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"statlog-vehicle": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"synthetic-control": [
0.0,
{ "n_estimators": 100, "n_jobs": -1 },
"-program made-"
],
"tic-tac-toe": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 0.2,
"base_estimator__gamma": 0.1,
"base_estimator__kernel": "poly",
"base_estimator__max_iter": 10000.0,
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"vertebral-column-2clases": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"wine": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 0.55,
"base_estimator__max_iter": 10000.0,
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
],
"zoo": [
0.0,
{
"n_estimators": 100,
"algorithm": "SAMME",
"base_estimator__C": 0.1,
"base_estimator__max_iter": 10000.0,
"base_estimator__kernel": "liblinear",
"base_estimator__multiclass_strategy": "ovr"
},
"-program made-"
]
}

View File

@@ -1,6 +1,10 @@
from statistics import mean
from sklearn.tree import DecisionTreeClassifier, ExtraTreeClassifier
from sklearn.ensemble import RandomForestClassifier, BaggingClassifier
from sklearn.ensemble import (
RandomForestClassifier,
BaggingClassifier,
AdaBoostClassifier,
)
from sklearn.svm import SVC
from stree import Stree
from wodt import Wodt
@@ -28,6 +32,9 @@ class Models:
if name == "BaggingWodt":
clf = Wodt(random_state=random_state)
return BaggingClassifier(base_estimator=clf)
if name == "AdaBoostStree":
clf = Stree(random_state=random_state)
return AdaBoostClassifier(base_estimator=clf)
if name == "RandomForest":
return RandomForestClassifier()
msg = f"No model recognized {name}"
@@ -47,7 +54,7 @@ class Models:
nodes = 0
leaves = result.get_n_leaves()
depth = 0
elif name.startswith("Bagging"):
elif name.startswith("Bagging") or name.startswith("AdaBoost"):
if hasattr(result.base_estimator_, "nodes_leaves"):
nodes, leaves = list(
zip(*[x.nodes_leaves() for x in result.estimators_])