Skip to content

Commit

Permalink
[TESTED]Forest Model Integration
Browse files Browse the repository at this point in the history
1. switching a model is as simple as changing model_type in config file

2. ForestModel is now working. Main model is in model.py file which is copied from label_assist

3. TestRunForestModel.py is working.

3. Regression test in TestForestmodel.py are still under construction.
  • Loading branch information
humbleOldSage committed Nov 2, 2023
1 parent 5b2572e commit bf7f406
Show file tree
Hide file tree
Showing 7 changed files with 1,369 additions and 592 deletions.
629 changes: 105 additions & 524 deletions emission/analysis/modelling/trip_model/forest_classifier.py

Large diffs are not rendered by default.

17 changes: 8 additions & 9 deletions emission/analysis/modelling/trip_model/model_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,16 @@ def build(self, config=None) -> eamuu.TripModel:
:raises KeyError: if the requested model name does not exist
"""
# Dict[ModelType, TripModel]
MODELS = {
#ModelType.GREEDY_SIMILARITY_BINNING: eamug.GreedySimilarityBinning(config),
ModelType.RANDOM_FOREST_CLASSIFIER: eamuf.ForestClassifier(config)
}
MODELS = {
ModelType.GREEDY_SIMILARITY_BINNING: eamug.GreedySimilarityBinning,
ModelType.RANDOM_FOREST_CLASSIFIER: eamuf.ForestClassifier
}
model = MODELS.get(self)
if model is None:
model_names = list(lambda e: e.name, MODELS.keys())
models = ",".join(model_names)
raise KeyError(f"ModelType {self.name} not found in factory, please add to build method")

return model
available_models = ', '.join([ e.name for e in ModelType])
raise KeyError(f"ModelType {self.name} not found in factory, Available models are {available_models}."\
"Otherwise please add new model to build method")
return model(config)

@classmethod
def names(cls):
Expand Down
Loading

0 comments on commit bf7f406

Please sign in to comment.