You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Measures Recommendations' accuracy based on users' access to the services. A value of 1, indicates that the RS model got all the predictions right, and a value of 0 indicates that the RS model did not make a single correct prediction
5
+
6
+
description: >
7
+
The accuracy (\(A\)) of the recommendations is based on users' access to the services. A value of 1, indicates that the RS model got all the predictions right, and a value of 0 indicates that the RS model did not make a single correct prediction. Generally, the Accuracy mathematical expression is defined as:
8
+
$$A=\frac{Number\;of\;correct\;predictions}{Total\;number\;of\;predictions}$$In RS Metrics the computation is determined by the following formula:
9
+
$$Accuracy=\frac{Number\;of\;correctly\;recommended\;services}{Total\;number\;of\;services}$$where correctness is defined as if the service is both accessed by the user and also it is recommended by the RS
10
+
11
+
output:
12
+
type: float
13
+
min: 0
14
+
max: 1
15
+
comment: A value of 1, indicates that the RS model got all the predictions right, and a value of 0 indicates that the RS model did not make a single correct prediction.
16
+
17
+
prerequisites:
18
+
- recommendations without anonymous users
19
+
- all available users (with their accessed services)
20
+
- all available services
21
+
22
+
process:
23
+
- step: Clean up
24
+
details: >
25
+
Recommendations clean up; entries removal where users or services are not found in "users" or "services" accordingly
26
+
- step: Vector creation of the Accessed Services
27
+
details: >
28
+
For each user create a vector at the size of the number of the services, and assign a binary value for each service with a value of 1 if it is found in the user's accessed services, or 0 if it is not
29
+
- step: Vector creation of the Recommended Services
30
+
details: >
31
+
For each user create a vector at the size of the number of the services, and assign a binary value for each service with a value of 1 if it is recommended to the user, or 0 if it is not
32
+
- step: Accuracy score computation
33
+
details: >
34
+
For each user compute the average value of the difference vector; a vector which states True if service is found in both accessed and recommended vectors or False if it is not
35
+
- step: Mean value of Accuracy score
36
+
details: >
37
+
Computation of the overall value by calculating the mean value of each user's accuracy score
38
+
39
+
# This is optional for visual stylization of the metric when displayed on the report
# return a list of objects with date and value fields
694
+
returnres.to_dict(orient='records')
695
+
696
+
@metric('The mean value of the accuracy score found for each user defined by the fraction of the number of the correct predictions by the total number of predictions')
697
+
defaccuracy(object):
698
+
"""
699
+
Calculate the accuracy score found for each and retrieve the mean value.
700
+
The score is calculated by dividing the number of the correct predictions
701
+
by the total number of predictions.
702
+
"""
703
+
# a list of unique services' ids found in Datastore
0 commit comments