-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
49 lines (40 loc) · 2.42 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from networksecurity.exception.exception import NetworkSecurityException
from networksecurity.logging.logger import logging
from networksecurity.entity.config_entity import DataIngestionConfig
from networksecurity.entity.config_entity import DataValidationConfig
from networksecurity.components.data_validation import DataValidation
from networksecurity.entity.config_entity import TrainingPipelineConfig
from networksecurity.components.data_ingestion import DataIngestion
from networksecurity.components.data_transformation import DataTransformation
from networksecurity.entity.config_entity import DataTransformationConfig
from networksecurity.components.model_trainer import ModelTrainer
from networksecurity.entity.config_entity import ModelTrainerConfig
import sys
if __name__=='__main__':
try:
trainingpipelineconfig=TrainingPipelineConfig()
dataingestionconfig=DataIngestionConfig(trainingpipelineconfig)
data_ingestion=DataIngestion(dataingestionconfig)
logging.info("Initiate the data ingestion")
dataingestionartifact=data_ingestion.initiate_data_ingestion()
logging.info("Data Initiation Completed")
print(dataingestionartifact)
datavalidationconfig = DataValidationConfig(trainingpipelineconfig)
data_validation = DataValidation(dataingestionartifact, datavalidationconfig)
logging.info("Initiate the data validation")
data_validation_artifact = data_validation.initiate_data_validation()
logging.info("Data Validation Completed")
print(data_validation_artifact)
datatransformationconfig = DataTransformationConfig(trainingpipelineconfig)
data_transformation = DataTransformation(data_validation_artifact, datatransformationconfig)
logging.info("Initiate the data transformation")
data_transformation_artifact = data_transformation.initiate_data_transformation()
logging.info("Data Transformation Completed")
print(data_transformation_artifact)
logging.info("Model Training sstared")
model_trainer_config=ModelTrainerConfig(trainingpipelineconfig)
model_trainer=ModelTrainer(model_trainer_config=model_trainer_config,data_transformation_artifact=data_transformation_artifact)
model_trainer_artifact=model_trainer.initiate_model_trainer()
logging.info("Model Training artifact created")
except Exception as e:
raise NetworkSecurityException(e,sys)