File size: 4,007 Bytes
b4f6ffc
77c8b76
b4f6ffc
 
 
 
 
77c8b76
 
 
b4f6ffc
77c8b76
 
 
 
c3c7748
 
 
77c8b76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c3c7748
77c8b76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import sys
from anime_recommender.pipelines.training_pipeline import TrainingPipeline
from anime_recommender.loggers.logging import logging
from anime_recommender.exception.exception import AnimeRecommendorException

if __name__ == "__main__":
    try:
        logging.info("Starting the Anime Recommendation System Training Pipeline...")
        pipeline = TrainingPipeline()
        pipeline.run_pipeline() 
    except Exception as e:
        logging.error(f"Pipeline execution failed: {str(e)}")
        raise AnimeRecommendorException(e, sys)





# import sys
# from anime_recommender.loggers.logging import logging
# from anime_recommender.exception.exception import AnimeRecommendorException
# from anime_recommender.components.data_ingestion import DataIngestion
# from anime_recommender.entity.config_entity import TrainingPipelineConfig,DataIngestionConfig,DataTransformationConfig,CollaborativeModelConfig,ContentBasedModelConfig
# from anime_recommender.components.data_transformation import DataTransformation
# from anime_recommender.components.collaborative_recommender import CollaborativeModelTrainer
# from anime_recommender.components.content_based_recommender import ContentBasedModelTrainer 
# from anime_recommender.components.top_anime_recommenders import PopularityBasedRecommendor


# if __name__ == "__main__":
#     try:
#         training_pipeline_config = TrainingPipelineConfig()  
#         data_ingestion_config = DataIngestionConfig(training_pipeline_config)
#         data_ingestion = DataIngestion(data_ingestion_config)
#         logging.info("Initiating Data Ingestion.")
#         data_ingestion_artifact = data_ingestion.ingest_data()
#         logging.info(f"Data ingestion completed.")
#         print(data_ingestion_artifact)

#         # Data Transformation
#         data_transformation_config = DataTransformationConfig(training_pipeline_config)
#         data_transformation = DataTransformation(data_ingestion_artifact,data_transformation_config)
#         logging.info("Initiating Data Transformation.")
#         data_transformation_artifact = data_transformation.initiate_data_transformation()
#         logging.info("Data Transformation Completed.")
#         print(data_transformation_artifact)

#         # Collaborative Model Training
#         collaborative_model_trainer_config = CollaborativeModelConfig(training_pipeline_config)
#         collaborative_model_trainer = CollaborativeModelTrainer(collaborative_model_trainer_config= collaborative_model_trainer_config,data_transformation_artifact=data_transformation_artifact)
#         logging.info("Initiating Collaborative Model training.")
#         collaborative_model_trainer_artifact = collaborative_model_trainer.initiate_model_trainer()
#         logging.info("Collaborative Model training completed.")
#         print(collaborative_model_trainer_artifact)

#         # Content Based Model Training
#         content_based_model_trainer_config = ContentBasedModelConfig(training_pipeline_config)
#         content_based_model_trainer = ContentBasedModelTrainer(content_based_model_trainer_config=content_based_model_trainer_config,data_ingestion_artifact=data_ingestion_artifact)
#         logging.info("Initiating Content Based Model training.")
#         content_based_model_trainer_artifact = content_based_model_trainer.initiate_model_trainer()
#         logging.info("Content Based Model training completed.")
#         print(content_based_model_trainer_artifact)

#         # Popularity Based Filtering
#         logging.info("Initiating Popularity based filtering.")
#         filtering = PopularityBasedRecommendor(data_ingestion_artifact=data_ingestion_artifact)
#         popularity_recommendations =  filtering.initiate_model_trainer(filter_type='top_avg_rated')
#         logging.info("Popularity based filtering completed.") 

#     except Exception as e:
#             raise AnimeRecommendorException(e, sys)