aek-auto-mlbuilder 0.2.0__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/PKG-INFO +1 -1
- {aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder/__init__.py +2 -1
- aek_auto_mlbuilder-0.3.0/aek_auto_mlbuilder/decision_tree.py +45 -0
- {aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder.egg-info/PKG-INFO +1 -1
- {aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder.egg-info/SOURCES.txt +1 -0
- {aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/setup.py +1 -1
- {aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/LICENSE +0 -0
- {aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/README.md +0 -0
- {aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder/base.py +0 -0
- {aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder/linear_regression.py +0 -0
- {aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder/logistic_regression.py +0 -0
- {aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder/utils.py +0 -0
- {aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder.egg-info/dependency_links.txt +0 -0
- {aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder.egg-info/requires.txt +0 -0
- {aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder.egg-info/top_level.txt +0 -0
- {aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/pyproject.toml +0 -0
- {aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/setup.cfg +0 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
|
2
|
+
from .base import BaseModel
|
3
|
+
|
4
|
+
|
5
|
+
class DecisionTreeModel(BaseModel):
|
6
|
+
"""
|
7
|
+
Decision Tree for classification or regression
|
8
|
+
Use "task" param to specify "classification" or "regression"
|
9
|
+
Brute force search included
|
10
|
+
"""
|
11
|
+
|
12
|
+
def __init__(self, task="classification", param_grid=None):
|
13
|
+
super().__init__()
|
14
|
+
self.task = task
|
15
|
+
self.param_grid = param_grid or {
|
16
|
+
"max_depth": [None, 3, 5, 10],
|
17
|
+
"min_samples_split": [2, 5, 10],
|
18
|
+
"min_samples_leaf": [1, 2, 4]
|
19
|
+
}
|
20
|
+
|
21
|
+
def train(self, X, y):
|
22
|
+
best_score = -float("inf")
|
23
|
+
best_model = None
|
24
|
+
|
25
|
+
if self.task.lower() == "classification":
|
26
|
+
ModelClass = DecisionTreeClassifier
|
27
|
+
else:
|
28
|
+
ModelClass = DecisionTreeRegressor
|
29
|
+
|
30
|
+
for max_depth in self.param_grid["max_depth"]:
|
31
|
+
for min_samples_split in self.param_grid["min_samples_split"]:
|
32
|
+
for min_samples_leaf in self.param_grid["min_samples_leaf"]:
|
33
|
+
model = ModelClass(
|
34
|
+
max_depth=max_depth,
|
35
|
+
min_samples_split=min_samples_split,
|
36
|
+
min_samples_leaf=min_samples_leaf
|
37
|
+
)
|
38
|
+
model.fit(X, y)
|
39
|
+
score = model.score(X, y)
|
40
|
+
if score > best_score:
|
41
|
+
best_score = score
|
42
|
+
best_model = model
|
43
|
+
self.best_model = best_model
|
44
|
+
self.best_score = best_score
|
45
|
+
return self.best_model
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
2
2
|
|
3
3
|
setup(
|
4
4
|
name="aek-auto-mlbuilder", # PyPI dağıtım adı
|
5
|
-
version="0.
|
5
|
+
version="0.3.0",
|
6
6
|
description="Automatic ML model builder in Python",
|
7
7
|
long_description=open("README.md", encoding="utf-8").read(),
|
8
8
|
long_description_content_type="text/markdown",
|
File without changes
|
File without changes
|
File without changes
|
{aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder/linear_regression.py
RENAMED
File without changes
|
{aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder/logistic_regression.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder.egg-info/requires.txt
RENAMED
File without changes
|
{aek_auto_mlbuilder-0.2.0 → aek_auto_mlbuilder-0.3.0}/aek_auto_mlbuilder.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|