mirror of
https://github.com/Hestia-Homes/ML.git
synced 2026-07-12 13:28:58 +00:00
add conditional imports
This commit is contained in:
parent
d331ee1649
commit
e0fc65ec8a
1 changed files with 7 additions and 3 deletions
|
|
@ -11,9 +11,6 @@ import joblib
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Union, List
|
from typing import Union, List
|
||||||
from sklearn import linear_model
|
|
||||||
from sklearn.svm import SVR
|
|
||||||
from autogluon.tabular import TabularDataset, TabularPredictor
|
|
||||||
from core.interface.InterfaceModels import MLModel
|
from core.interface.InterfaceModels import MLModel
|
||||||
from core.Logger import logger
|
from core.Logger import logger
|
||||||
|
|
||||||
|
|
@ -69,6 +66,8 @@ class SKLearnLinearRegression:
|
||||||
"""
|
"""
|
||||||
Method to train a model
|
Method to train a model
|
||||||
"""
|
"""
|
||||||
|
from sklearn import linear_model
|
||||||
|
|
||||||
self.model = linear_model.LinearRegression()
|
self.model = linear_model.LinearRegression()
|
||||||
|
|
||||||
x_train = data.iloc[:, data.columns != target]
|
x_train = data.iloc[:, data.columns != target]
|
||||||
|
|
@ -117,6 +116,7 @@ class SKLearnSVMRegression:
|
||||||
"""
|
"""
|
||||||
Method to train a model
|
Method to train a model
|
||||||
"""
|
"""
|
||||||
|
from sklearn.svm import SVR
|
||||||
|
|
||||||
validate_dict_keys(
|
validate_dict_keys(
|
||||||
list(model_hyperparameters.keys()),
|
list(model_hyperparameters.keys()),
|
||||||
|
|
@ -161,6 +161,8 @@ class AutogluonAutoML:
|
||||||
"""
|
"""
|
||||||
Method to load a model
|
Method to load a model
|
||||||
"""
|
"""
|
||||||
|
from autogluon.tabular import TabularPredictor
|
||||||
|
|
||||||
filepath = str(path)
|
filepath = str(path)
|
||||||
self.model = TabularPredictor.load(path=filepath)
|
self.model = TabularPredictor.load(path=filepath)
|
||||||
|
|
||||||
|
|
@ -186,6 +188,8 @@ class AutogluonAutoML:
|
||||||
"""
|
"""
|
||||||
Method to train a model
|
Method to train a model
|
||||||
"""
|
"""
|
||||||
|
from autogluon.tabular import TabularDataset, TabularPredictor
|
||||||
|
|
||||||
# Force Parallel Model fitting
|
# Force Parallel Model fitting
|
||||||
os.environ["AG_FORCE_PARALLEL"] = "True"
|
os.environ["AG_FORCE_PARALLEL"] = "True"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue