aek-auto-mlbuilder 0.3.2__tar.gz → 0.5.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.3.2 → aek_auto_mlbuilder-0.5.0}/PKG-INFO +1 -1
- {aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/aek_auto_mlbuilder/__init__.py +3 -1
- aek_auto_mlbuilder-0.5.0/aek_auto_mlbuilder/knn.py +48 -0
- aek_auto_mlbuilder-0.5.0/aek_auto_mlbuilder/random_forest.py +50 -0
- {aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/aek_auto_mlbuilder.egg-info/PKG-INFO +1 -1
- {aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/aek_auto_mlbuilder.egg-info/SOURCES.txt +2 -0
- {aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/setup.py +1 -1
- {aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/LICENSE +0 -0
- {aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/README.md +0 -0
- {aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/aek_auto_mlbuilder/base.py +0 -0
- {aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/aek_auto_mlbuilder/decision_tree.py +0 -0
- {aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/aek_auto_mlbuilder/linear_regression.py +0 -0
- {aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/aek_auto_mlbuilder/logistic_regression.py +0 -0
- {aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/aek_auto_mlbuilder/utils.py +0 -0
- {aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/aek_auto_mlbuilder.egg-info/dependency_links.txt +0 -0
- {aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/aek_auto_mlbuilder.egg-info/requires.txt +0 -0
- {aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/aek_auto_mlbuilder.egg-info/top_level.txt +0 -0
- {aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/pyproject.toml +0 -0
- {aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/setup.cfg +0 -0
@@ -2,4 +2,6 @@ from .base import BaseModel
|
|
2
2
|
from .utils import split_data
|
3
3
|
from .linear_regression import LinearRegressor
|
4
4
|
from .logistic_regression import LogisticClassifier
|
5
|
-
from .decision_tree import DecisionTreeModel
|
5
|
+
from .decision_tree import DecisionTreeModel
|
6
|
+
from .knn import KNNModel
|
7
|
+
from .random_forest import RandomForestModel
|
@@ -0,0 +1,48 @@
|
|
1
|
+
from sklearn.neighbors import KNeighborsClassifier, KNeighborsRegressor
|
2
|
+
from sklearn.preprocessing import StandardScaler
|
3
|
+
from sklearn.pipeline import make_pipeline
|
4
|
+
from .base import BaseModel
|
5
|
+
|
6
|
+
|
7
|
+
class KNNModel(BaseModel):
|
8
|
+
"""
|
9
|
+
KNN model for classification for classification or regression
|
10
|
+
Use "task" for "classification" or "regression"
|
11
|
+
Brute-force search is using
|
12
|
+
"""
|
13
|
+
def __init__(self, task="classification", param_grid=None):
|
14
|
+
super().__init__()
|
15
|
+
self.task = task
|
16
|
+
self.param_grid = param_grid or {
|
17
|
+
"n_neighbors": [3, 5, 7, 9],
|
18
|
+
"weights": ["uniform", "distance"],
|
19
|
+
"p": [1, 2] #1: manhattan, 2: euclidean
|
20
|
+
}
|
21
|
+
|
22
|
+
def train(self, X, y):
|
23
|
+
best_score = -float("inf")
|
24
|
+
best_model = None
|
25
|
+
|
26
|
+
if self.task.lower() == "classification":
|
27
|
+
ModelClass = KNeighborsClassifier
|
28
|
+
elif self.task.lower() == "regression":
|
29
|
+
ModelClass = KNeighborsRegressor
|
30
|
+
else:
|
31
|
+
raise ValueError("task must be 'classification' or 'regression'")
|
32
|
+
|
33
|
+
for n in self.param_grid["n_neighbors"]:
|
34
|
+
for weights in self.param_grid["weights"]:
|
35
|
+
for p in self.param_grid["p"]:
|
36
|
+
model = make_pipeline(
|
37
|
+
StandardScaler(),
|
38
|
+
ModelClass(n_neighbors=n, weights=weights, p=p)
|
39
|
+
)
|
40
|
+
model.fit(X, y)
|
41
|
+
score = model.score(X, y)
|
42
|
+
if score > best_score:
|
43
|
+
best_score = score
|
44
|
+
best_model = model
|
45
|
+
|
46
|
+
self.best_model = best_model
|
47
|
+
self.best_score = best_score
|
48
|
+
return self.best_model
|
@@ -0,0 +1,50 @@
|
|
1
|
+
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
|
2
|
+
from .base import BaseModel
|
3
|
+
|
4
|
+
class RandomForestModel(BaseModel):
|
5
|
+
"""
|
6
|
+
Random Forest model for classification or regression
|
7
|
+
Use task either "classification" or "regression"
|
8
|
+
brute force method is using
|
9
|
+
"""
|
10
|
+
def __init__(self, task="classification", param_grid=None):
|
11
|
+
super().__init__()
|
12
|
+
self.task = task
|
13
|
+
self.param_grid = param_grid or {
|
14
|
+
"n_estimators": [50, 100, 200],
|
15
|
+
"max_depth": [None, 5, 10],
|
16
|
+
"min_samples_split": [2, 5],
|
17
|
+
"min_samples_leaf": [1, 2]
|
18
|
+
}
|
19
|
+
def train(self, X, y):
|
20
|
+
best_score = -float("inf")
|
21
|
+
best_model = None
|
22
|
+
|
23
|
+
if self.task.lower() == "classification":
|
24
|
+
ModelClass = RandomForestClassifier
|
25
|
+
elif self.task.lower() == "regression":
|
26
|
+
ModelClass = RandomForestRegressor
|
27
|
+
else:
|
28
|
+
raise ValueError("task must be 'classification' or 'regression'")
|
29
|
+
|
30
|
+
for n_estimators in self.param_grid["n_estimators"]:
|
31
|
+
for max_depth in self.param_grid["max_depth"]:
|
32
|
+
for min_samples_split in self.param_grid["min_samples_split"]:
|
33
|
+
for min_samples_leaf in self.param_grid["min_samples_leaf"]:
|
34
|
+
model = ModelClass(
|
35
|
+
n_estimators=n_estimators,
|
36
|
+
max_depth=max_depth,
|
37
|
+
min_samples_split=min_samples_split,
|
38
|
+
min_samples_leaf=min_samples_leaf,
|
39
|
+
random_state=42,
|
40
|
+
n_jobs=-1
|
41
|
+
)
|
42
|
+
model.fit(X, y)
|
43
|
+
score = model.score(X, y)
|
44
|
+
if score > best_score:
|
45
|
+
best_score = score
|
46
|
+
best_model = model
|
47
|
+
self.best_model = best_model
|
48
|
+
self.best_score = best_score
|
49
|
+
return self.best_model
|
50
|
+
|
{aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/aek_auto_mlbuilder.egg-info/SOURCES.txt
RENAMED
@@ -5,8 +5,10 @@ setup.py
|
|
5
5
|
aek_auto_mlbuilder/__init__.py
|
6
6
|
aek_auto_mlbuilder/base.py
|
7
7
|
aek_auto_mlbuilder/decision_tree.py
|
8
|
+
aek_auto_mlbuilder/knn.py
|
8
9
|
aek_auto_mlbuilder/linear_regression.py
|
9
10
|
aek_auto_mlbuilder/logistic_regression.py
|
11
|
+
aek_auto_mlbuilder/random_forest.py
|
10
12
|
aek_auto_mlbuilder/utils.py
|
11
13
|
aek_auto_mlbuilder.egg-info/PKG-INFO
|
12
14
|
aek_auto_mlbuilder.egg-info/SOURCES.txt
|
@@ -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.5.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
|
File without changes
|
{aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/aek_auto_mlbuilder/linear_regression.py
RENAMED
File without changes
|
{aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/aek_auto_mlbuilder/logistic_regression.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/aek_auto_mlbuilder.egg-info/requires.txt
RENAMED
File without changes
|
{aek_auto_mlbuilder-0.3.2 → aek_auto_mlbuilder-0.5.0}/aek_auto_mlbuilder.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|