regression
Module Contents
Classes
Base class for H1st Model. |
|
- class regression.XGBRegressionModel(result_key: str = 'result', max_features: int = 50, eta: float = 0.001, n_estimators: int = 5, max_depth: int = 3, debug: bool = False)
Bases:
h1st.model.model.Model
Base class for H1st Model.
To create your own model, inherit Model class and implement process accordingly. Please refer to Tutorial for more details how to create a model.
The framework allows you to persist and load model to the model repository. To persist the model, you can call persist(), and then load_params to retrieve the model. See persist() and load_params() document for more detail.
import h1st class MyModeler(h1st.model.Modeler): def build_model(self): ... class MyModel(h1st.model.Model): my_modeler = MyModeler() my_modeler.model_class = MyModel my_model = my_modeler.build_model() # Persist the model to repo my_model.persist('1st_version') # Load the model from the repo my_model_2 = MyModel() my_model_2.load_params('1st_version')
- input_key = X
- output_key = predictions
- name = XGBRegression
- train_model(self, input_data: dict)
This function can be used to build and train XGBRegression model. It also performs gridsearch which helps us to get optimal model parameters based on Mean Absolute Error.
prepared_data requires keys: X_train, y_train, X_test, y_test
- evaluate_model(self, input_data, trained_model)
Calculate metrics
- class regression.XGBRegressionModeler(result_key: str = 'result', max_features: int = 50, eta: float = 0.001, n_estimators: int = 5, max_depth: int = 3, debug: bool = False)
- model_class
- __get_model_build_params(self, model: XGBRegressionModel) dict
- train_base_model(self, input_data: dict) xgboost.XGBRegressor
This function can be used to build and train XGBRegression model. It also performs gridsearch which helps us to get optimal model parameters based on Mean Absolute Error.
prepared_data requires keys: X_train, y_train, X_test, y_test
- evaluate_model(self, input_data, trained_model)
Calculate metrics