Skip to content

Commit 0aaa2a2

Browse files
committed
Added the entity , config and traning pipeline
1 parent d9c7b04 commit 0aaa2a2

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

networksecurity/constants/training_pipeline/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,13 @@
5353
"n_neighbors": 3,
5454
"weights": "uniform",
5555
}
56+
57+
"""
58+
MODEL TRAINER related constant start with MODEL_TRAINER var name
59+
"""
60+
MODEL_TRAINER_DIR_NAME: str = "model_trainer"
61+
MODEL_TRAINER_TRAINED_MODEL_DIR: str = "trained_model"
62+
MODEL_TRAINER_TRAINED_MODEL_NAME: str = "model.pkl"
63+
MODEL_TRAINER_EXPECTED_SCORE: float = 0.6
64+
MODEL_TRAINER_OVER_FITTING_UNDER_FITTING_THRESHOLD : float = 0.05
65+
MODEL_TRAINER_MODEL_CONFIG_FILE_PATH: str = os.path.join("config", "model.yaml")

networksecurity/entity/config_entity.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,23 @@ def __post_init__(self):
109109
training_pipeline.DATA_TRANSFORMATION_TRANSFORMED_OBJECT_DIR, # fixed here
110110
training_pipeline.MODEL_FILE_NAME # You might want to change this if you have a specific preprocessing object file name constant
111111
)
112+
113+
@dataclass
114+
class ModelTrainerConfigEntity:
115+
training_pipeline_config: TrainingPipelineConfigEntity
116+
117+
def __post_init__(self):
118+
self.model_trainer_dir: str = os.path.join(
119+
self.training_pipeline_config.artifact_dir,
120+
training_pipeline.MODEL_TRAINER_DIR_NAME
121+
)
122+
self.trained_model_file_path: str = os.path.join(
123+
self.model_trainer_dir,
124+
training_pipeline.MODEL_TRAINER_TRAINED_MODEL_DIR
125+
)
126+
self.expected_score: float = training_pipeline.MODEL_TRAINER_EXPECTED_SCORE
127+
self.overfitting_underfitting_threshold: training_pipeline.MODEL_TRAINER_OVER_FITTING_UNDER_FITTING_THRESHOLD# Assuming you want to keep this as a constant
128+
self.model_config_file_path: str = os.path.join(
129+
self.model_trainer_dir,
130+
training_pipeline.MODEL_FILE_PATH
131+
)

0 commit comments

Comments
 (0)