src.fairreckitlib.data.ratings.base_converter
This module contains the base class for converting ratings.
Classes:
RatingConverter: the base class for converting ratings.
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 base class for converting ratings. 2 3Classes: 4 5 RatingConverter: the base class for converting ratings. 6 7This program has been developed by students from the bachelor Computer Science at 8Utrecht University within the Software Project course. 9© Copyright Utrecht University (Department of Information and Computing Sciences) 10""" 11 12from typing import Any, Dict 13 14import pandas as pd 15 16from ..data_modifier import DataModifier 17 18 19class RatingConverter(DataModifier): 20 """Base class for FairRecKit rating converters. 21 22 A converter is used to convert ratings of a dataframe. 23 """ 24 25 def __init__(self, name: str, params: Dict[str, Any]): 26 """Construct the Rating Converter. 27 28 Args: 29 name: the name of the converter. 30 params: the converter parameters. 31 """ 32 DataModifier.__init__(self, name, params) 33 34 def run(self, dataframe: pd.DataFrame) -> pd.DataFrame: 35 """Run the converter on the specified dataframe. 36 37 Args: 38 dataframe: with at least the 'rating' column. 39 40 Returns: 41 the converted dataframe and the type of rating, either 'explicit' or 'implicit'. 42 """ 43 raise NotImplementedError()
20class RatingConverter(DataModifier): 21 """Base class for FairRecKit rating converters. 22 23 A converter is used to convert ratings of a dataframe. 24 """ 25 26 def __init__(self, name: str, params: Dict[str, Any]): 27 """Construct the Rating Converter. 28 29 Args: 30 name: the name of the converter. 31 params: the converter parameters. 32 """ 33 DataModifier.__init__(self, name, params) 34 35 def run(self, dataframe: pd.DataFrame) -> pd.DataFrame: 36 """Run the converter on the specified dataframe. 37 38 Args: 39 dataframe: with at least the 'rating' column. 40 41 Returns: 42 the converted dataframe and the type of rating, either 'explicit' or 'implicit'. 43 """ 44 raise NotImplementedError()
Base class for FairRecKit rating converters.
A converter is used to convert ratings of a dataframe.
RatingConverter(name: str, params: Dict[str, Any])
26 def __init__(self, name: str, params: Dict[str, Any]): 27 """Construct the Rating Converter. 28 29 Args: 30 name: the name of the converter. 31 params: the converter parameters. 32 """ 33 DataModifier.__init__(self, name, params)
Construct the Rating Converter.
Args: name: the name of the converter. params: the converter parameters.
def
run( self, dataframe: pandas.core.frame.DataFrame) -> pandas.core.frame.DataFrame:
35 def run(self, dataframe: pd.DataFrame) -> pd.DataFrame: 36 """Run the converter on the specified dataframe. 37 38 Args: 39 dataframe: with at least the 'rating' column. 40 41 Returns: 42 the converted dataframe and the type of rating, either 'explicit' or 'implicit'. 43 """ 44 raise NotImplementedError()
Run the converter on the specified dataframe.
Args: dataframe: with at least the 'rating' column.
Returns: the converted dataframe and the type of rating, either 'explicit' or 'implicit'.