-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
31 lines (26 loc) · 1.3 KB
/
Copy pathmain.py
File metadata and controls
31 lines (26 loc) · 1.3 KB
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
from src.DataScienceProject.logger import logging
from src.DataScienceProject.exception import CustomException
from src.DataScienceProject.components.data_ingestion import DataIngestion, DataIngestionConfig
from src.DataScienceProject.components.data_transformation import DataTransformation, DataTransformationConfig
from src.DataScienceProject.components.model_trainer import ModelTrainer, ModelTrainerConfig
import sys
if __name__ == "__main__":
logging.info("This is a log message from the main block.")
try:
# data_ingestion_config = DataIngestionConfig()
data_ingestion = DataIngestion()
train_data_path, test_data_path = data_ingestion.initiate_data_ingestion()
# data_transformation_config = DataTransformationConfig()
data_transformation = DataTransformation()
train_array, test_array, preprocessor_obj = data_transformation.initiate_data_transformation(train_data_path, test_data_path)
#Model Training
model_trainer = ModelTrainer()
r2_score = model_trainer.initiate_model_trainer(
train_array,
test_array,
preprocessor_obj
)
logging.info(f"R2 Score is {r2_score}")
except Exception as e:
logging.info("Custom exception occurred.")
raise CustomException(str(e), sys)