Skip to content

Commit

Permalink
Calibrated the Regressor Model (#3450)
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteWolf47 committed May 7, 2023
1 parent dc2cce8 commit 4819447
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bugbug/models/regressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from bugbug import bugzilla, commit_features, db, feature_cleanup, repository, utils
from bugbug.model import CommitModel
from bugbug.model_calibration import IsotonicRegressionCalibrator

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -51,6 +52,7 @@ class RegressorModel(CommitModel):

def __init__(
self,
calibration: bool = True,
lemmatization: bool = False,
interpretable: bool = True,
use_finder: bool = False,
Expand Down Expand Up @@ -127,9 +129,12 @@ def __init__(
("union", ColumnTransformer(column_transformers)),
]
)

self.clf = xgboost.XGBClassifier(n_jobs=utils.get_physical_cpu_count())
self.clf.set_params(predictor="cpu_predictor")
if calibration:
self.clf = IsotonicRegressionCalibrator(self.clf)
# This is a temporary workaround for the error : "Model type not yet supported by TreeExplainer"
self.calculate_importance = False

def get_labels(self):
classes = {}
Expand Down

0 comments on commit 4819447

Please sign in to comment.