mirror of
https://github.com/Doctorado-ML/Stree_datasets.git
synced 2025-08-15 23:46:03 +00:00
Non stratified experiments
Remove reference column in analysis
This commit is contained in:
@@ -6,8 +6,9 @@ import warnings
|
||||
from sklearn.model_selection import GridSearchCV, cross_validate
|
||||
|
||||
from . import Models
|
||||
from .Database import Hyperparameters, Outcomes, MySQL
|
||||
from .Database import Hyperparameters, MySQL, Outcomes
|
||||
from .Sets import Datasets
|
||||
from sklearn.model_selection._split import KFold
|
||||
|
||||
|
||||
class Experiment:
|
||||
@@ -81,6 +82,7 @@ class Experiment:
|
||||
for item in outcomes:
|
||||
total[item] = []
|
||||
for random_state in [57, 31, 1714, 17, 23, 79, 83, 97, 7, 1]:
|
||||
kfold = KFold(shuffle=True, random_state=random_state, n_splits=5)
|
||||
model.set_params(**{"random_state": random_state})
|
||||
print(f"{random_state}, ", end="", flush=True)
|
||||
with warnings.catch_warnings():
|
||||
@@ -88,7 +90,12 @@ class Experiment:
|
||||
# Also affect subprocesses
|
||||
os.environ["PYTHONWARNINGS"] = "ignore"
|
||||
results = cross_validate(
|
||||
model, X, y, return_train_score=True, n_jobs=self._threads
|
||||
model,
|
||||
X,
|
||||
y,
|
||||
return_train_score=True,
|
||||
n_jobs=self._threads,
|
||||
cv=kfold,
|
||||
)
|
||||
for item in outcomes:
|
||||
total[item].append(results[item])
|
||||
|
Reference in New Issue
Block a user