Skip to content

Commit

Permalink
fix: Refactor code for ml model - xgboost and model/modeller (#188)
Browse files Browse the repository at this point in the history
* fix: add metrics and stats and base_model to Model class

* fix: remove RuleBaseModel from model_repository. Note: will move this persist code out of h1st later also

* fix: add functions to xgboost modeler as it not inherit from Modeler anymore

* fix: add functions to RandomForest and LogisticRegression modelers as it not inherit Modeler anymore

* fix: add xgboost package to pyproject

* refactor: remove oracle from h1st, move sgboost to model.ml

* refactor: create classifier and regression in xgboost, move model and modeler to the same file
  • Loading branch information
phamhoangtuan authored Mar 1, 2023
1 parent e60f33e commit f14a4ac
Show file tree
Hide file tree
Showing 13 changed files with 488 additions and 702 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from h1st.model.xgboost.model import XGBRegressionModel
from h1st.model.ml.xgboost.regression import XGBRegressionModel, XGBRegressionModeler


class XGBClassifierModel(XGBRegressionModel):
name = 'XGBClassifierModel'
Expand All @@ -14,3 +15,10 @@ def apply_threshold(self, x):
def set_threshold(self, threshold: float):
self.stats['threshold'] = threshold


class XGBClassifierModeler(XGBRegressionModeler):
model_class = XGBClassifierModel

def __init__(self, threshold=0.5, **kwargs):
super().__init__(**kwargs)
self.stats['threshold'] = float(threshold)
Loading

0 comments on commit f14a4ac

Please sign in to comment.