recombee_api_client 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/recombee_api_client/api/recommend_items_to_item.rb +13 -6
- data/lib/recombee_api_client/api/recommend_items_to_user.rb +9 -2
- data/lib/recombee_api_client/api/recommend_users_to_item.rb +9 -2
- data/lib/recombee_api_client/api/recommend_users_to_user.rb +9 -2
- data/lib/recombee_api_client/version.rb +1 -1
- data/lib/recombee_api_client.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ece07c27210eaca1d3ee2c818ec6c670d6266c9d
|
4
|
+
data.tar.gz: 158f3b6e97b4bec261b56a96ef038a189f4ced9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e927d93cdeeaa136c19a609cea566a6741db488be745735171c843cd3b3d9851a45c500c0a9efe57822be679507b0a5eeaff760262b59ec0ac3f635861a4356
|
7
|
+
data.tar.gz: aa0d10e14be91db61f6e092dd70c74d92bdcbca06f02a19054c331ca4b570709e429235c791f8b16590cda6e4d9fae736ac5f871de13a5faa6aa4173c434539f
|
@@ -14,7 +14,7 @@ module RecombeeApiClient
|
|
14
14
|
#The returned items are sorted by relevancy (first item being the most relevant).
|
15
15
|
#
|
16
16
|
class RecommendItemsToItem < ApiRequest
|
17
|
-
attr_reader :item_id, :target_user_id, :count, :
|
17
|
+
attr_reader :item_id, :target_user_id, :count, :filter, :booster, :cascade_create, :scenario, :logic, :return_properties, :included_properties, :user_impact, :diversity, :min_relevance, :rotation_rate, :rotation_time, :expert_settings, :return_ab_group
|
18
18
|
attr_accessor :timeout
|
19
19
|
attr_accessor :ensure_https
|
20
20
|
|
@@ -42,12 +42,15 @@ module RecombeeApiClient
|
|
42
42
|
# - +count+ -> Number of items to be recommended (N for the top-N recommendation).
|
43
43
|
#
|
44
44
|
# * *Optional arguments (given as hash optional)*
|
45
|
-
# - +userImpact+ -> 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`.
|
46
|
-
#
|
47
45
|
# - +filter+ -> Boolean-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to filter recommended items based on the values of their attributes.
|
48
46
|
# - +booster+ -> Number-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to boost recommendation rate of some items based on the values of their attributes.
|
49
47
|
# - +cascadeCreate+ -> If item of given *itemId* or user of given *targetUserId* doesn't exist in the database, it creates the missing entity/entities and returns some (non-personalized) recommendations. This allows for example rotations in the following recommendations for the user of given *targetUserId*, as the user will be already known to the system.
|
50
48
|
# - +scenario+ -> Scenario defines a particular application of recommendations. It can be for example "homepage", "cart" or "emailing". You can see each scenario in the UI separately, so you can check how well each application performs. The AI which optimizes models in order to get the best results may optimize different scenarios separately, or even use different models in each of the scenarios.
|
49
|
+
# - +logic+ -> Logic specifies particular behavior of the recommendation models. You can pick tailored logic for your domain (e-commerce, multimedia, fashion ...) and use case.
|
50
|
+
#See [this section](https://docs.recombee.com/recommendation_logic.html) for list of available logics and other details.
|
51
|
+
#
|
52
|
+
#The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
|
53
|
+
#
|
51
54
|
# - +returnProperties+ -> With `returnProperties=true`, property values of the recommended items are returned along with their IDs in a JSON dictionary. The acquired property values can be used for easy displaying of the recommended items to the user.
|
52
55
|
#
|
53
56
|
#Example response:
|
@@ -104,6 +107,8 @@ module RecombeeApiClient
|
|
104
107
|
# }
|
105
108
|
#```
|
106
109
|
#
|
110
|
+
# - +userImpact+ -> **Expert option** If *targetUserId* parameter is present, the recommendations are biased towards the given user. 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`.
|
111
|
+
#
|
107
112
|
# - +diversity+ -> **Expert option** Real number from [0.0, 1.0] which determines how much mutually dissimilar should the recommended items be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification.
|
108
113
|
#
|
109
114
|
# - +minRelevance+ -> **Expert option** If the *targetUserId* is provided: Specifies the threshold of how much relevant must the recommended items be to the user. Possible values one of: "low", "medium", "high". The default value is "low", meaning that the system attempts to recommend number of items equal to *count* at any cost. If there are not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations to be appended to reach the full *count*. This behavior may be suppressed by using "medium" or "high" values. In such case, the system only recommends items of at least the requested relevancy, and may return less than *count* items when there is not enough data to fulfill it.
|
@@ -122,13 +127,14 @@ module RecombeeApiClient
|
|
122
127
|
@target_user_id = target_user_id
|
123
128
|
@count = count
|
124
129
|
optional = normalize_optional(optional)
|
125
|
-
@user_impact = optional['userImpact']
|
126
130
|
@filter = optional['filter']
|
127
131
|
@booster = optional['booster']
|
128
132
|
@cascade_create = optional['cascadeCreate']
|
129
133
|
@scenario = optional['scenario']
|
134
|
+
@logic = optional['logic']
|
130
135
|
@return_properties = optional['returnProperties']
|
131
136
|
@included_properties = optional['includedProperties']
|
137
|
+
@user_impact = optional['userImpact']
|
132
138
|
@diversity = optional['diversity']
|
133
139
|
@min_relevance = optional['minRelevance']
|
134
140
|
@rotation_rate = optional['rotationRate']
|
@@ -139,7 +145,7 @@ module RecombeeApiClient
|
|
139
145
|
@timeout = 3000
|
140
146
|
@ensure_https = false
|
141
147
|
@optional.each do |par, _|
|
142
|
-
fail UnknownOptionalParameter.new(par) unless ["
|
148
|
+
fail UnknownOptionalParameter.new(par) unless ["filter","booster","cascadeCreate","scenario","logic","returnProperties","includedProperties","userImpact","diversity","minRelevance","rotationRate","rotationTime","expertSettings","returnAbGroup"].include? par
|
143
149
|
end
|
144
150
|
end
|
145
151
|
|
@@ -153,13 +159,14 @@ module RecombeeApiClient
|
|
153
159
|
p = Hash.new
|
154
160
|
p['targetUserId'] = @target_user_id
|
155
161
|
p['count'] = @count
|
156
|
-
p['userImpact'] = @optional['userImpact'] if @optional.include? 'userImpact'
|
157
162
|
p['filter'] = @optional['filter'] if @optional.include? 'filter'
|
158
163
|
p['booster'] = @optional['booster'] if @optional.include? 'booster'
|
159
164
|
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
160
165
|
p['scenario'] = @optional['scenario'] if @optional.include? 'scenario'
|
166
|
+
p['logic'] = @optional['logic'] if @optional.include? 'logic'
|
161
167
|
p['returnProperties'] = @optional['returnProperties'] if @optional.include? 'returnProperties'
|
162
168
|
p['includedProperties'] = @optional['includedProperties'] if @optional.include? 'includedProperties'
|
169
|
+
p['userImpact'] = @optional['userImpact'] if @optional.include? 'userImpact'
|
163
170
|
p['diversity'] = @optional['diversity'] if @optional.include? 'diversity'
|
164
171
|
p['minRelevance'] = @optional['minRelevance'] if @optional.include? 'minRelevance'
|
165
172
|
p['rotationRate'] = @optional['rotationRate'] if @optional.include? 'rotationRate'
|
@@ -14,7 +14,7 @@ module RecombeeApiClient
|
|
14
14
|
#The returned items are sorted by relevancy (first item being the most relevant).
|
15
15
|
#
|
16
16
|
class RecommendItemsToUser < ApiRequest
|
17
|
-
attr_reader :user_id, :count, :filter, :booster, :cascade_create, :scenario, :return_properties, :included_properties, :diversity, :min_relevance, :rotation_rate, :rotation_time, :expert_settings, :return_ab_group
|
17
|
+
attr_reader :user_id, :count, :filter, :booster, :cascade_create, :scenario, :logic, :return_properties, :included_properties, :diversity, :min_relevance, :rotation_rate, :rotation_time, :expert_settings, :return_ab_group
|
18
18
|
attr_accessor :timeout
|
19
19
|
attr_accessor :ensure_https
|
20
20
|
|
@@ -28,6 +28,11 @@ module RecombeeApiClient
|
|
28
28
|
# - +booster+ -> Number-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to boost recommendation rate of some items based on the values of their attributes.
|
29
29
|
# - +cascadeCreate+ -> If the user does not exist in the database, returns a list of non-personalized recommendations and creates the user in the database. This allows for example rotations in the following recommendations for that user, as the user will be already known to the system.
|
30
30
|
# - +scenario+ -> Scenario defines a particular application of recommendations. It can be for example "homepage", "cart" or "emailing". You can see each scenario in the UI separately, so you can check how well each application performs. The AI which optimizes models in order to get the best results may optimize different scenarios separately, or even use different models in each of the scenarios.
|
31
|
+
# - +logic+ -> Logic specifies particular behavior of the recommendation models. You can pick tailored logic for your domain (e-commerce, multimedia, fashion ...) and use case.
|
32
|
+
#See [this section](https://docs.recombee.com/recommendation_logic.html) for list of available logics and other details.
|
33
|
+
#
|
34
|
+
#The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
|
35
|
+
#
|
31
36
|
# - +returnProperties+ -> With `returnProperties=true`, property values of the recommended items are returned along with their IDs in a JSON dictionary. The acquired property values can be used for easy displaying of the recommended items to the user.
|
32
37
|
#
|
33
38
|
#Example response:
|
@@ -105,6 +110,7 @@ module RecombeeApiClient
|
|
105
110
|
@booster = optional['booster']
|
106
111
|
@cascade_create = optional['cascadeCreate']
|
107
112
|
@scenario = optional['scenario']
|
113
|
+
@logic = optional['logic']
|
108
114
|
@return_properties = optional['returnProperties']
|
109
115
|
@included_properties = optional['includedProperties']
|
110
116
|
@diversity = optional['diversity']
|
@@ -117,7 +123,7 @@ module RecombeeApiClient
|
|
117
123
|
@timeout = 3000
|
118
124
|
@ensure_https = false
|
119
125
|
@optional.each do |par, _|
|
120
|
-
fail UnknownOptionalParameter.new(par) unless ["filter","booster","cascadeCreate","scenario","returnProperties","includedProperties","diversity","minRelevance","rotationRate","rotationTime","expertSettings","returnAbGroup"].include? par
|
126
|
+
fail UnknownOptionalParameter.new(par) unless ["filter","booster","cascadeCreate","scenario","logic","returnProperties","includedProperties","diversity","minRelevance","rotationRate","rotationTime","expertSettings","returnAbGroup"].include? par
|
121
127
|
end
|
122
128
|
end
|
123
129
|
|
@@ -134,6 +140,7 @@ module RecombeeApiClient
|
|
134
140
|
p['booster'] = @optional['booster'] if @optional.include? 'booster'
|
135
141
|
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
136
142
|
p['scenario'] = @optional['scenario'] if @optional.include? 'scenario'
|
143
|
+
p['logic'] = @optional['logic'] if @optional.include? 'logic'
|
137
144
|
p['returnProperties'] = @optional['returnProperties'] if @optional.include? 'returnProperties'
|
138
145
|
p['includedProperties'] = @optional['includedProperties'] if @optional.include? 'includedProperties'
|
139
146
|
p['diversity'] = @optional['diversity'] if @optional.include? 'diversity'
|
@@ -14,7 +14,7 @@ module RecombeeApiClient
|
|
14
14
|
#The returned users are sorted by predicted interest in the item (first user being the most interested).
|
15
15
|
#
|
16
16
|
class RecommendUsersToItem < ApiRequest
|
17
|
-
attr_reader :item_id, :count, :filter, :booster, :cascade_create, :scenario, :return_properties, :included_properties, :diversity, :expert_settings, :return_ab_group
|
17
|
+
attr_reader :item_id, :count, :filter, :booster, :cascade_create, :scenario, :logic, :return_properties, :included_properties, :diversity, :expert_settings, :return_ab_group
|
18
18
|
attr_accessor :timeout
|
19
19
|
attr_accessor :ensure_https
|
20
20
|
|
@@ -28,6 +28,11 @@ module RecombeeApiClient
|
|
28
28
|
# - +booster+ -> Number-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to boost recommendation rate of some items based on the values of their attributes.
|
29
29
|
# - +cascadeCreate+ -> If item of given *itemId* doesn't exist in the database, it creates the missing item.
|
30
30
|
# - +scenario+ -> Scenario defines a particular application of recommendations. It can be for example "homepage", "cart" or "emailing". You can see each scenario in the UI separately, so you can check how well each application performs. The AI which optimizes models in order to get the best results may optimize different scenarios separately, or even use different models in each of the scenarios.
|
31
|
+
# - +logic+ -> Logic specifies particular behavior of the recommendation models. You can pick tailored logic for your domain (e-commerce, multimedia, fashion ...) and use case.
|
32
|
+
#See [this section](https://docs.recombee.com/recommendation_logic.html) for list of available logics and other details.
|
33
|
+
#
|
34
|
+
#The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
|
35
|
+
#
|
31
36
|
# - +returnProperties+ -> With `returnProperties=true`, property values of the recommended users are returned along with their IDs in a JSON dictionary. The acquired property values can be used for easy displaying the recommended users.
|
32
37
|
#
|
33
38
|
#Example response:
|
@@ -93,6 +98,7 @@ module RecombeeApiClient
|
|
93
98
|
@booster = optional['booster']
|
94
99
|
@cascade_create = optional['cascadeCreate']
|
95
100
|
@scenario = optional['scenario']
|
101
|
+
@logic = optional['logic']
|
96
102
|
@return_properties = optional['returnProperties']
|
97
103
|
@included_properties = optional['includedProperties']
|
98
104
|
@diversity = optional['diversity']
|
@@ -102,7 +108,7 @@ module RecombeeApiClient
|
|
102
108
|
@timeout = 50000
|
103
109
|
@ensure_https = false
|
104
110
|
@optional.each do |par, _|
|
105
|
-
fail UnknownOptionalParameter.new(par) unless ["filter","booster","cascadeCreate","scenario","returnProperties","includedProperties","diversity","expertSettings","returnAbGroup"].include? par
|
111
|
+
fail UnknownOptionalParameter.new(par) unless ["filter","booster","cascadeCreate","scenario","logic","returnProperties","includedProperties","diversity","expertSettings","returnAbGroup"].include? par
|
106
112
|
end
|
107
113
|
end
|
108
114
|
|
@@ -119,6 +125,7 @@ module RecombeeApiClient
|
|
119
125
|
p['booster'] = @optional['booster'] if @optional.include? 'booster'
|
120
126
|
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
121
127
|
p['scenario'] = @optional['scenario'] if @optional.include? 'scenario'
|
128
|
+
p['logic'] = @optional['logic'] if @optional.include? 'logic'
|
122
129
|
p['returnProperties'] = @optional['returnProperties'] if @optional.include? 'returnProperties'
|
123
130
|
p['includedProperties'] = @optional['includedProperties'] if @optional.include? 'includedProperties'
|
124
131
|
p['diversity'] = @optional['diversity'] if @optional.include? 'diversity'
|
@@ -14,7 +14,7 @@ module RecombeeApiClient
|
|
14
14
|
#The returned users are sorted by similarity (first user being the most similar).
|
15
15
|
#
|
16
16
|
class RecommendUsersToUser < ApiRequest
|
17
|
-
attr_reader :user_id, :count, :filter, :booster, :cascade_create, :scenario, :return_properties, :included_properties, :diversity, :min_relevance, :rotation_rate, :rotation_time, :expert_settings, :return_ab_group
|
17
|
+
attr_reader :user_id, :count, :filter, :booster, :cascade_create, :scenario, :logic, :return_properties, :included_properties, :diversity, :min_relevance, :rotation_rate, :rotation_time, :expert_settings, :return_ab_group
|
18
18
|
attr_accessor :timeout
|
19
19
|
attr_accessor :ensure_https
|
20
20
|
|
@@ -28,6 +28,11 @@ module RecombeeApiClient
|
|
28
28
|
# - +booster+ -> Number-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to boost recommendation rate of some users based on the values of their attributes.
|
29
29
|
# - +cascadeCreate+ -> If the user does not exist in the database, returns a list of non-personalized recommendations and creates the user in the database. This allows for example rotations in the following recommendations for that user, as the user will be already known to the system.
|
30
30
|
# - +scenario+ -> Scenario defines a particular application of recommendations. It can be for example "homepage", "cart" or "emailing". You can see each scenario in the UI separately, so you can check how well each application performs. The AI which optimizes models in order to get the best results may optimize different scenarios separately, or even use different models in each of the scenarios.
|
31
|
+
# - +logic+ -> Logic specifies particular behavior of the recommendation models. You can pick tailored logic for your domain (e-commerce, multimedia, fashion ...) and use case.
|
32
|
+
#See [this section](https://docs.recombee.com/recommendation_logic.html) for list of available logics and other details.
|
33
|
+
#
|
34
|
+
#The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
|
35
|
+
#
|
31
36
|
# - +returnProperties+ -> With `returnProperties=true`, property values of the recommended users are returned along with their IDs in a JSON dictionary. The acquired property values can be used for easy displaying the recommended users.
|
32
37
|
#
|
33
38
|
#Example response:
|
@@ -99,6 +104,7 @@ module RecombeeApiClient
|
|
99
104
|
@booster = optional['booster']
|
100
105
|
@cascade_create = optional['cascadeCreate']
|
101
106
|
@scenario = optional['scenario']
|
107
|
+
@logic = optional['logic']
|
102
108
|
@return_properties = optional['returnProperties']
|
103
109
|
@included_properties = optional['includedProperties']
|
104
110
|
@diversity = optional['diversity']
|
@@ -111,7 +117,7 @@ module RecombeeApiClient
|
|
111
117
|
@timeout = 50000
|
112
118
|
@ensure_https = false
|
113
119
|
@optional.each do |par, _|
|
114
|
-
fail UnknownOptionalParameter.new(par) unless ["filter","booster","cascadeCreate","scenario","returnProperties","includedProperties","diversity","minRelevance","rotationRate","rotationTime","expertSettings","returnAbGroup"].include? par
|
120
|
+
fail UnknownOptionalParameter.new(par) unless ["filter","booster","cascadeCreate","scenario","logic","returnProperties","includedProperties","diversity","minRelevance","rotationRate","rotationTime","expertSettings","returnAbGroup"].include? par
|
115
121
|
end
|
116
122
|
end
|
117
123
|
|
@@ -128,6 +134,7 @@ module RecombeeApiClient
|
|
128
134
|
p['booster'] = @optional['booster'] if @optional.include? 'booster'
|
129
135
|
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
130
136
|
p['scenario'] = @optional['scenario'] if @optional.include? 'scenario'
|
137
|
+
p['logic'] = @optional['logic'] if @optional.include? 'logic'
|
131
138
|
p['returnProperties'] = @optional['returnProperties'] if @optional.include? 'returnProperties'
|
132
139
|
p['includedProperties'] = @optional['includedProperties'] if @optional.include? 'includedProperties'
|
133
140
|
p['diversity'] = @optional['diversity'] if @optional.include? 'diversity'
|
data/lib/recombee_api_client.rb
CHANGED
@@ -18,13 +18,13 @@ module RecombeeApiClient
|
|
18
18
|
include HTTParty
|
19
19
|
|
20
20
|
BATCH_MAX_SIZE = 10000
|
21
|
-
USER_AGENT = {'User-Agent' => 'recombee-ruby-api-client/2.
|
21
|
+
USER_AGENT = {'User-Agent' => 'recombee-ruby-api-client/2.4.0'}
|
22
22
|
|
23
23
|
##
|
24
24
|
# - +account+ -> Name of your account at Recombee
|
25
25
|
# - +token+ -> Secret token obtained from Recombee for signing requests
|
26
26
|
# - +protocol+ -> Default protocol for sending requests. Possible values: 'http', 'https'.
|
27
|
-
def initialize(account, token, protocol = '
|
27
|
+
def initialize(account, token, protocol = 'https', options = {})
|
28
28
|
@account = account
|
29
29
|
@token = token
|
30
30
|
@protocol = protocol
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recombee_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ondřej Fiedler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|