Boosted_Decision_Tree module

class simple_one_syst_model.boosted_decision_tree.BoostedDecisionTree

Bases: object

This class implements a boosted decision tree classifier.

Attributes:
  • model (XGBClassifier): The underlying XGBoost classifier model.

  • scaler (StandardScaler): The scaler used to normalize the input data.

Methods:
  • fit(self, train_data, labels, weights=None): Fits the model to the training data.

  • predict(self, test_data): Predicts the class probabilities for the test data.

  • save(self, model_name): Saves the model and scaler to disk.

  • load(self, model_path): Loads the model and scaler from disk.

fit(train_data, labels, weights=None, valid_set=None)

Fits the model to the training data.

Args:
  • train_data (pandas.DataFrame): The input training data.

  • labels (array-like): The labels corresponding to the training data.

  • weights (array-like, optional): The sample weights for the training data.

load(model_path)

Loads the model and scaler from disk.

Args:

model_path (str): The path to the model file.

Returns:

XGBClassifier: The loaded model.

predict(data)

Predicts the class probabilities for the input data.

Args:

data (pandas.DataFrame): The input data.

Returns:

array-like: The predicted class probabilities.

save(model_name)

Saves the model and scaler to disk.

Args:

model_name (str): The name of the model file.