Baselines (recommendation
)¶
Global Average¶
Global Average uses the average rating value of all ratings to make predictions.
\[\hat { r }_{ ui } = \mu\]
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 | import Orange
from orangecontrib.recommendation import GlobalAvgLearner
# Load data and train the model
data = Orange.data.Table('movielens100k.tab')
learner = GlobalAvgLearner()
recommender = learner(data)
prediction = recommender(data[:3])
print(prediction)
>>>
[ 3.52986 3.52986 3.52986]
|
-
class
orangecontrib.recommendation.
GlobalAvgLearner
(preprocessors=None, verbose=False)[source]¶ Global Average
This model takes the average rating value of all ratings to make predictions.
- Attributes:
- verbose: boolean or int, optional
- Prints information about the process according to the verbosity level. Values: False (verbose=0), True (verbose=1) and INTEGER
User Average¶
User Average uses the average rating value of a user to make predictions.
\[\hat { r }_{ ui } = \mu_{u}\]
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 13 | import Orange
from orangecontrib.recommendation import UserAvgLearner
# Load data and train the model
data = Orange.data.Table('movielens100k.tab')
learner = UserAvgLearner()
recommender = learner(data)
# Make predictions
prediction = recommender(data[:3])
print(prediction)
>>>
[ 3.61538462 3.41304348 3.3515625 ]
|
-
class
orangecontrib.recommendation.
UserAvgLearner
(preprocessors=None, verbose=False)[source]¶ User average
This model takes the average rating value of a user to make predictions.
- Attributes:
- verbose: boolean or int, optional
- Prints information about the process according to the verbosity level. Values: False (verbose=0), True (verbose=1) and INTEGER
Item Average¶
Item Average uses the average rating value of an item to make predictions.
\[\hat { r }_{ ui } = \mu_{i}\]
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 13 | import Orange
from orangecontrib.recommendation import ItemAvgLearner
# Load data and train the model
data = Orange.data.Table('movielens100k.tab')
learner = ItemAvgLearner()
recommender = learner(data)
# Make predictions
prediction = recommender(data[:3])
print(prediction)
>>>
[ 3.99145299 4.16161616 2.15384615]
|
-
class
orangecontrib.recommendation.
ItemAvgLearner
(preprocessors=None, verbose=False)[source]¶ Item average
This model takes the average rating value of an item to make predictions.
- Attributes:
- verbose: boolean or int, optional
- Prints information about the process according to the verbosity level. Values: False (verbose=0), True (verbose=1) and INTEGER
User-Item Baseline¶
User-Item Baseline takes the bias of users and items plus the global average to make predictions.
\[\hat { r }_{ ui } = \mu + b_{u} + b_{i}\]
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 13 | import Orange
from orangecontrib.recommendation import UserItemBaselineLearner
# Load data and train the model
data = Orange.data.Table('movielens100k.tab')
learner = UserItemBaselineLearner()
recommender = learner(data)
# Make predictions
prediction = recommender(data[:3])
print(prediction)
>>>
[ 4.07697761 4.04479964 1.97554865]
|
-
class
orangecontrib.recommendation.
UserItemBaselineLearner
(preprocessors=None, verbose=False)[source]¶ User-Item baseline
This model takes the bias of users and items plus the global average to make predictions.
- Attributes:
- verbose: boolean or int, optional
- Prints information about the process according to the verbosity level. Values: False (verbose=0), True (verbose=1) and INTEGER