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
Copy file name to clipboardExpand all lines: src/RecommApi/Requests/ItemBasedRecommendation.php
+42-31Lines changed: 42 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -11,11 +11,12 @@
11
11
12
12
/**
13
13
* Recommends set of items that are somehow related to one given item, *X*. Typical scenario for using item-based recommendation is when user *A* is viewing *X*. Then you may display items to the user that he might be also interested in. Item-recommendation request gives you Top-N such items, optionally taking the target user *A* into account.
14
+
* It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
14
15
*/
15
16
class ItemBasedRecommendation extends Request {
16
17
17
18
/**
18
-
* @var string $item_id ID of the item recommendations for which are to be generated.
19
+
* @var string $item_id ID of the item for which the recommendations are to be generated.
19
20
*/
20
21
protected$item_id;
21
22
/**
@@ -32,7 +33,7 @@ class ItemBasedRecommendation extends Request {
32
33
*/
33
34
protected$target_user_id;
34
35
/**
35
-
* @var float $user_impact If *targetUserId* parameter is present, the recommendations are biased towards the user given. Using *userImpact*, you may control this bias. For an extreme case of `userImpact=0.0`, the interactions made by the user are not taken into account at all (with the exception of history-based blacklisting), for `userImpact=1.0`, you'll get user-based recommendation. The default value is `0.1`
36
+
* @var float $user_impact If *targetUserId* parameter is present, the recommendations are biased towards the user given. Using *userImpact*, you may control this bias. For an extreme case of `userImpact=0.0`, the interactions made by the user are not taken into account at all (with the exception of history-based blacklisting), for `userImpact=1.0`, you'll get user-based recommendation. The default value is `0`.
36
37
*/
37
38
protected$user_impact;
38
39
/**
@@ -110,17 +111,21 @@ class ItemBasedRecommendation extends Request {
110
111
*/
111
112
protected$rotation_rate;
112
113
/**
113
-
* @var float $rotation_time **Expert option** If the *targetUserId* is provided: Taking *rotationRate* into account, specifies how long time it takes to an item to fully recover from the penalization. For example, `rotationTime=7200.0` means that items recommended more than 2 hours ago are definitely not penalized anymore. Currently, the penalization is linear, so for `rotationTime=7200.0`, an item is still penalized by `0.5` to the user after 1 hour.
114
+
* @var float $rotation_time **Expert option** If the *targetUserId* is provided: Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized.
114
115
*/
115
116
protected$rotation_time;
117
+
/**
118
+
* @var $expert_settings Dictionary of custom options.
119
+
*/
120
+
protected$expert_settings;
116
121
/**
117
122
* @var array Array containing values of optional parameters
118
123
*/
119
124
protected$optional;
120
125
121
126
/**
122
127
* Construct the request
123
-
* @param string $item_id ID of the item recommendations for which are to be generated.
128
+
* @param string $item_id ID of the item for which the recommendations are to be generated.
124
129
* @param int $count Number of items to be recommended (N for the top-N recommendation).
125
130
* @param array $optional Optional parameters given as an array containing pairs name of the parameter => value
126
131
* - Allowed parameters:
@@ -134,7 +139,7 @@ class ItemBasedRecommendation extends Request {
134
139
* For the above reasons, we encourage you to set the *targetUserId* even for anonymous/unregistered users (i.e. use their session ID).
135
140
* - *userImpact*
136
141
* - Type: float
137
-
* - Description: If *targetUserId* parameter is present, the recommendations are biased towards the user given. Using *userImpact*, you may control this bias. For an extreme case of `userImpact=0.0`, the interactions made by the user are not taken into account at all (with the exception of history-based blacklisting), for `userImpact=1.0`, you'll get user-based recommendation. The default value is `0.1`
142
+
* - Description: If *targetUserId* parameter is present, the recommendations are biased towards the user given. Using *userImpact*, you may control this bias. For an extreme case of `userImpact=0.0`, the interactions made by the user are not taken into account at all (with the exception of history-based blacklisting), for `userImpact=1.0`, you'll get user-based recommendation. The default value is `0`.
138
143
* - *filter*
139
144
* - Type: string
140
145
* - Description: Boolean-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to filter recommended items based on the values of their attributes.
@@ -201,7 +206,10 @@ class ItemBasedRecommendation extends Request {
201
206
* - Description: **Expert option** If the *targetUserId* is provided: If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items.
202
207
* - *rotationTime*
203
208
* - Type: float
204
-
* - Description: **Expert option** If the *targetUserId* is provided: Taking *rotationRate* into account, specifies how long time it takes to an item to fully recover from the penalization. For example, `rotationTime=7200.0` means that items recommended more than 2 hours ago are definitely not penalized anymore. Currently, the penalization is linear, so for `rotationTime=7200.0`, an item is still penalized by `0.5` to the user after 1 hour.
209
+
* - Description: **Expert option** If the *targetUserId* is provided: Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized.
210
+
* - *expertSettings*
211
+
* - Type:
212
+
* - Description: Dictionary of custom options.
205
213
* @throws Exceptions\UnknownOptionalParameterException UnknownOptionalParameterException if an unknown optional parameter is given in $optional
0 commit comments