Commit 6c383e0e authored by Dr.李's avatar Dr.李

update data implementation

parent 4a6cf837
...@@ -858,6 +858,7 @@ class Models(Base): ...@@ -858,6 +858,7 @@ class Models(Base):
model_version = Column(BigInteger, nullable=False) model_version = Column(BigInteger, nullable=False)
update_time = Column(DateTime, nullable=False) update_time = Column(DateTime, nullable=False)
model_desc = Column(JSONB, nullable=False) model_desc = Column(JSONB, nullable=False)
data_meta = Column(JSONB, nullable=True)
is_primary = Column(Boolean) is_primary = Column(Boolean)
model_id = Column(Integer, primary_key=True, autoincrement=True) model_id = Column(Integer, primary_key=True, autoincrement=True)
......
...@@ -57,7 +57,7 @@ class ConstLinearModel(ModelBase): ...@@ -57,7 +57,7 @@ class ConstLinearModel(ModelBase):
class LinearRegression(ModelBase): class LinearRegression(ModelBase):
def __init__(self, features: list = None, fit_intercept: bool = False, **kwargs): def __init__(self, features=None, fit_intercept: bool = False, **kwargs):
super().__init__(features) super().__init__(features)
self.impl = LinearRegressionImpl(fit_intercept=fit_intercept, **kwargs) self.impl = LinearRegressionImpl(fit_intercept=fit_intercept, **kwargs)
...@@ -84,7 +84,7 @@ class LinearRegression(ModelBase): ...@@ -84,7 +84,7 @@ class LinearRegression(ModelBase):
class LassoRegression(ModelBase): class LassoRegression(ModelBase):
def __init__(self, alpha=0.01, features: list = None, fit_intercept: bool = False, **kwargs): def __init__(self, alpha=0.01, features=None, fit_intercept: bool = False, **kwargs):
super().__init__(features) super().__init__(features)
self.impl = Lasso(alpha=alpha, fit_intercept=fit_intercept, **kwargs) self.impl = Lasso(alpha=alpha, fit_intercept=fit_intercept, **kwargs)
...@@ -111,7 +111,7 @@ class LassoRegression(ModelBase): ...@@ -111,7 +111,7 @@ class LassoRegression(ModelBase):
class LogisticRegression(ModelBase): class LogisticRegression(ModelBase):
def __init__(self, features: list = None, fit_intercept: bool = False, **kwargs): def __init__(self, features=None, fit_intercept: bool = False, **kwargs):
super().__init__(features) super().__init__(features)
self.impl = LogisticRegressionImpl(fit_intercept=fit_intercept, **kwargs) self.impl = LogisticRegressionImpl(fit_intercept=fit_intercept, **kwargs)
......
...@@ -5,7 +5,6 @@ Created on 2017-12-4 ...@@ -5,7 +5,6 @@ Created on 2017-12-4
@author: cheng.li @author: cheng.li
""" """
from typing import List
from distutils.version import LooseVersion from distutils.version import LooseVersion
import arrow import arrow
import numpy as np import numpy as np
...@@ -27,7 +26,7 @@ class RandomForestRegressor(ModelBase): ...@@ -27,7 +26,7 @@ class RandomForestRegressor(ModelBase):
def __init__(self, def __init__(self,
n_estimators: int=100, n_estimators: int=100,
max_features: str='auto', max_features: str='auto',
features: List=None, features=None,
**kwargs): **kwargs):
super().__init__(features) super().__init__(features)
self.impl = RandomForestRegressorImpl(n_estimators=n_estimators, self.impl = RandomForestRegressorImpl(n_estimators=n_estimators,
...@@ -59,7 +58,7 @@ class RandomForestClassifier(ModelBase): ...@@ -59,7 +58,7 @@ class RandomForestClassifier(ModelBase):
def __init__(self, def __init__(self,
n_estimators: int=100, n_estimators: int=100,
max_features: str='auto', max_features: str='auto',
features: List = None, features=None,
**kwargs): **kwargs):
super().__init__(features) super().__init__(features)
self.impl = RandomForestClassifierImpl(n_estimators=n_estimators, self.impl = RandomForestClassifierImpl(n_estimators=n_estimators,
...@@ -92,7 +91,7 @@ class XGBRegressor(ModelBase): ...@@ -92,7 +91,7 @@ class XGBRegressor(ModelBase):
n_estimators: int=100, n_estimators: int=100,
learning_rate: float=0.1, learning_rate: float=0.1,
max_depth: int=3, max_depth: int=3,
features: List=None, features=None,
n_jobs: int=1, n_jobs: int=1,
**kwargs): **kwargs):
super().__init__(features) super().__init__(features)
...@@ -171,7 +170,7 @@ class XGBTrainer(ModelBase): ...@@ -171,7 +170,7 @@ class XGBTrainer(ModelBase):
early_stopping_rounds=None, early_stopping_rounds=None,
subsample=1., subsample=1.,
colsample_bytree=1., colsample_bytree=1.,
features: List = None, feature=None,
random_state: int=0, random_state: int=0,
n_jobs: int=1, n_jobs: int=1,
**kwargs): **kwargs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment