src.fairreckitlib.model.pipeline.model_pipeline_surprise
This module contains the model pipelines for the Surprise package.
Classes:
PredictionPipelineSurprise: prediction pipeline that uses a surprise matrix.
RecommendationPipelineSurprise: recommendation pipeline that uses a surprise matrix.
This program has been developed by students from the bachelor Computer Science at Utrecht University within the Software Project course. © Copyright Utrecht University (Department of Information and Computing Sciences)
1"""This module contains the model pipelines for the Surprise package. 2 3Classes: 4 5 PredictionPipelineSurprise: prediction pipeline that uses a surprise matrix. 6 RecommendationPipelineSurprise: recommendation pipeline that uses a surprise matrix. 7 8This program has been developed by students from the bachelor Computer Science at 9Utrecht University within the Software Project course. 10© Copyright Utrecht University (Department of Information and Computing Sciences) 11""" 12 13from ..algorithms.surprise.surprise_matrix import MatrixSurprise 14from ..algorithms.matrix import Matrix 15from .prediction_pipeline import PredictionPipeline 16from .recommendation_pipeline import RecommendationPipeline 17 18 19class PredictionPipelineSurprise(PredictionPipeline): 20 """Prediction Pipeline implementation for a surprise matrix train set.""" 21 22 def on_load_train_set_matrix(self) -> Matrix: 23 """Load the train set matrix that all models can use for training. 24 25 Raises: 26 FileNotFoundError: when the train set file is not found. 27 RuntimeError: when the max of the rating scale is larger than the RATING_TYPE_THRESHOLD. 28 29 Returns: 30 the loaded surprise train set matrix. 31 """ 32 return MatrixSurprise( 33 self.data_transition.train_set_path, 34 self.data_transition.rating_scale 35 ) 36 37 38class RecommendationPipelineSurprise(RecommendationPipeline): 39 """Recommendation Pipeline implementation for a surprise matrix train set.""" 40 41 def on_load_train_set_matrix(self) -> Matrix: 42 """Load the train set matrix that all models can use for training. 43 44 Raises: 45 FileNotFoundError: when the train set file is not found. 46 RuntimeError: when the max of the rating scale is larger than the RATING_TYPE_THRESHOLD. 47 48 Returns: 49 the loaded surprise train set matrix. 50 """ 51 return MatrixSurprise( 52 self.data_transition.train_set_path, 53 self.data_transition.rating_scale 54 )
20class PredictionPipelineSurprise(PredictionPipeline): 21 """Prediction Pipeline implementation for a surprise matrix train set.""" 22 23 def on_load_train_set_matrix(self) -> Matrix: 24 """Load the train set matrix that all models can use for training. 25 26 Raises: 27 FileNotFoundError: when the train set file is not found. 28 RuntimeError: when the max of the rating scale is larger than the RATING_TYPE_THRESHOLD. 29 30 Returns: 31 the loaded surprise train set matrix. 32 """ 33 return MatrixSurprise( 34 self.data_transition.train_set_path, 35 self.data_transition.rating_scale 36 )
Prediction Pipeline implementation for a surprise matrix train set.
23 def on_load_train_set_matrix(self) -> Matrix: 24 """Load the train set matrix that all models can use for training. 25 26 Raises: 27 FileNotFoundError: when the train set file is not found. 28 RuntimeError: when the max of the rating scale is larger than the RATING_TYPE_THRESHOLD. 29 30 Returns: 31 the loaded surprise train set matrix. 32 """ 33 return MatrixSurprise( 34 self.data_transition.train_set_path, 35 self.data_transition.rating_scale 36 )
Load the train set matrix that all models can use for training.
Raises: FileNotFoundError: when the train set file is not found. RuntimeError: when the max of the rating scale is larger than the RATING_TYPE_THRESHOLD.
Returns: the loaded surprise train set matrix.
Inherited Members
39class RecommendationPipelineSurprise(RecommendationPipeline): 40 """Recommendation Pipeline implementation for a surprise matrix train set.""" 41 42 def on_load_train_set_matrix(self) -> Matrix: 43 """Load the train set matrix that all models can use for training. 44 45 Raises: 46 FileNotFoundError: when the train set file is not found. 47 RuntimeError: when the max of the rating scale is larger than the RATING_TYPE_THRESHOLD. 48 49 Returns: 50 the loaded surprise train set matrix. 51 """ 52 return MatrixSurprise( 53 self.data_transition.train_set_path, 54 self.data_transition.rating_scale 55 )
Recommendation Pipeline implementation for a surprise matrix train set.
42 def on_load_train_set_matrix(self) -> Matrix: 43 """Load the train set matrix that all models can use for training. 44 45 Raises: 46 FileNotFoundError: when the train set file is not found. 47 RuntimeError: when the max of the rating scale is larger than the RATING_TYPE_THRESHOLD. 48 49 Returns: 50 the loaded surprise train set matrix. 51 """ 52 return MatrixSurprise( 53 self.data_transition.train_set_path, 54 self.data_transition.rating_scale 55 )
Load the train set matrix that all models can use for training.
Raises: FileNotFoundError: when the train set file is not found. RuntimeError: when the max of the rating scale is larger than the RATING_TYPE_THRESHOLD.
Returns: the loaded surprise train set matrix.