recombee_api_client 3.2.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/recombee_api_client/api/add_bookmark.rb +1 -1
- data/lib/recombee_api_client/api/add_cart_addition.rb +3 -3
- data/lib/recombee_api_client/api/add_detail_view.rb +1 -1
- data/lib/recombee_api_client/api/add_group.rb +1 -1
- data/lib/recombee_api_client/api/add_item.rb +2 -2
- data/lib/recombee_api_client/api/add_item_property.rb +1 -1
- data/lib/recombee_api_client/api/add_manual_reql_segment.rb +69 -0
- data/lib/recombee_api_client/api/add_purchase.rb +4 -4
- data/lib/recombee_api_client/api/add_rating.rb +1 -1
- data/lib/recombee_api_client/api/add_series.rb +1 -1
- data/lib/recombee_api_client/api/add_user_property.rb +2 -2
- data/lib/recombee_api_client/api/create_auto_reql_segmentation.rb +75 -0
- data/lib/recombee_api_client/api/create_manual_reql_segmentation.rb +71 -0
- data/lib/recombee_api_client/api/create_property_based_segmentation.rb +76 -0
- data/lib/recombee_api_client/api/delete_bookmark.rb +3 -3
- data/lib/recombee_api_client/api/delete_cart_addition.rb +3 -3
- data/lib/recombee_api_client/api/delete_detail_view.rb +3 -3
- data/lib/recombee_api_client/api/delete_group.rb +2 -2
- data/lib/recombee_api_client/api/delete_item.rb +3 -3
- data/lib/recombee_api_client/api/delete_manual_reql_segment.rb +52 -0
- data/lib/recombee_api_client/api/delete_more_items.rb +52 -0
- data/lib/recombee_api_client/api/delete_purchase.rb +3 -3
- data/lib/recombee_api_client/api/delete_rating.rb +2 -2
- data/lib/recombee_api_client/api/delete_search_synonym.rb +1 -1
- data/lib/recombee_api_client/api/delete_segmentation.rb +50 -0
- data/lib/recombee_api_client/api/delete_series.rb +1 -1
- data/lib/recombee_api_client/api/delete_user.rb +2 -2
- data/lib/recombee_api_client/api/delete_user_property.rb +1 -1
- data/lib/recombee_api_client/api/get_item_values.rb +2 -2
- data/lib/recombee_api_client/api/get_segmentation.rb +50 -0
- data/lib/recombee_api_client/api/get_user_values.rb +2 -2
- data/lib/recombee_api_client/api/insert_to_group.rb +2 -2
- data/lib/recombee_api_client/api/insert_to_series.rb +2 -2
- data/lib/recombee_api_client/api/list_group_items.rb +1 -1
- data/lib/recombee_api_client/api/list_item_bookmarks.rb +2 -2
- data/lib/recombee_api_client/api/list_item_cart_additions.rb +2 -2
- data/lib/recombee_api_client/api/list_item_detail_views.rb +2 -2
- data/lib/recombee_api_client/api/list_item_purchases.rb +2 -2
- data/lib/recombee_api_client/api/list_item_ratings.rb +2 -2
- data/lib/recombee_api_client/api/list_item_view_portions.rb +2 -2
- data/lib/recombee_api_client/api/list_items.rb +1 -1
- data/lib/recombee_api_client/api/list_segmentations.rb +51 -0
- data/lib/recombee_api_client/api/list_series_items.rb +2 -2
- data/lib/recombee_api_client/api/list_user_bookmarks.rb +1 -1
- data/lib/recombee_api_client/api/list_user_cart_additions.rb +1 -1
- data/lib/recombee_api_client/api/list_user_detail_views.rb +1 -1
- data/lib/recombee_api_client/api/list_user_purchases.rb +1 -1
- data/lib/recombee_api_client/api/list_user_ratings.rb +1 -1
- data/lib/recombee_api_client/api/list_user_view_portions.rb +1 -1
- data/lib/recombee_api_client/api/list_users.rb +1 -1
- data/lib/recombee_api_client/api/merge_users.rb +2 -2
- data/lib/recombee_api_client/api/recommend_item_segments_to_item.rb +131 -0
- data/lib/recombee_api_client/api/recommend_item_segments_to_item_segment.rb +131 -0
- data/lib/recombee_api_client/api/recommend_item_segments_to_user.rb +111 -0
- data/lib/recombee_api_client/api/recommend_items_to_item.rb +26 -26
- data/lib/recombee_api_client/api/recommend_items_to_user.rb +23 -23
- data/lib/recombee_api_client/api/recommend_next_items.rb +2 -2
- data/lib/recombee_api_client/api/recommend_users_to_item.rb +18 -18
- data/lib/recombee_api_client/api/recommend_users_to_user.rb +21 -21
- data/lib/recombee_api_client/api/reset_database.rb +1 -1
- data/lib/recombee_api_client/api/search_item_segments.rb +114 -0
- data/lib/recombee_api_client/api/search_items.rb +17 -17
- data/lib/recombee_api_client/api/set_view_portion.rb +3 -3
- data/lib/recombee_api_client/api/update_auto_reql_segmentation.rb +69 -0
- data/lib/recombee_api_client/api/update_manual_reql_segment.rb +67 -0
- data/lib/recombee_api_client/api/update_manual_reql_segmentation.rb +65 -0
- data/lib/recombee_api_client/api/update_more_items.rb +63 -0
- data/lib/recombee_api_client/api/update_property_based_segmentation.rb +69 -0
- data/lib/recombee_api_client/version.rb +1 -1
- data/lib/recombee_api_client.rb +40 -15
- data/recombee_api_client.gemspec +2 -2
- metadata +24 -8
- data/lib/recombee_api_client/api/item_based_recommendation.rb +0 -159
- data/lib/recombee_api_client/api/user_based_recommendation.rb +0 -143
@@ -0,0 +1,131 @@
|
|
1
|
+
#
|
2
|
+
# This file is auto-generated, do not edit
|
3
|
+
#
|
4
|
+
|
5
|
+
module RecombeeApiClient
|
6
|
+
require_relative 'request'
|
7
|
+
require_relative '../errors'
|
8
|
+
|
9
|
+
##
|
10
|
+
#Recommends Segments from a Segmentation that are the most relevant to a particular item.
|
11
|
+
#
|
12
|
+
#Based on the used Segmentation, this endpoint can be used for example for:
|
13
|
+
#
|
14
|
+
# - Recommending the related categories
|
15
|
+
# - Recommending the related genres
|
16
|
+
# - Recommending the related brands
|
17
|
+
# - Recommending the related artists
|
18
|
+
#
|
19
|
+
#You need to set the used Segmentation the Admin UI in the Scenario settings prior to using this endpoint.
|
20
|
+
#
|
21
|
+
#The returned segments are sorted by relevance (first segment being the most relevant).
|
22
|
+
#
|
23
|
+
#It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
|
24
|
+
#
|
25
|
+
class RecommendItemSegmentsToItem < ApiRequest
|
26
|
+
attr_reader :item_id, :target_user_id, :count, :scenario, :cascade_create, :filter, :booster, :logic, :expert_settings, :return_ab_group
|
27
|
+
attr_accessor :timeout
|
28
|
+
attr_accessor :ensure_https
|
29
|
+
|
30
|
+
##
|
31
|
+
# * *Required arguments*
|
32
|
+
# - +item_id+ -> ID of the item for which the recommendations are to be generated.
|
33
|
+
# - +target_user_id+ -> ID of the user who will see the recommendations.
|
34
|
+
#
|
35
|
+
#Specifying the *targetUserId* is beneficial because:
|
36
|
+
#
|
37
|
+
#* It makes the recommendations personalized
|
38
|
+
#* Allows the calculation of Actions and Conversions
|
39
|
+
# in the graphical user interface,
|
40
|
+
# as Recombee can pair the user who got recommendations
|
41
|
+
# and who afterward viewed/purchased an item.
|
42
|
+
#
|
43
|
+
#If you insist on not specifying the user, pass `null`
|
44
|
+
#(`None`, `nil`, `NULL` etc., depending on the language) to *targetUserId*.
|
45
|
+
#Do not create some special dummy user for getting recommendations,
|
46
|
+
#as it could mislead the recommendation models,
|
47
|
+
#and result in wrong recommendations.
|
48
|
+
#
|
49
|
+
#For anonymous/unregistered users, it is possible to use, for example, their session ID.
|
50
|
+
#
|
51
|
+
# - +count+ -> Number of item segments to be recommended (N for the top-N recommendation).
|
52
|
+
#
|
53
|
+
#
|
54
|
+
# * *Optional arguments (given as hash optional)*
|
55
|
+
# - +scenario+ -> Scenario defines a particular application of recommendations. It can be, for example, "homepage", "cart", or "emailing".
|
56
|
+
#
|
57
|
+
#You can set various settings to the [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com). You can also see the performance of each scenario in the Admin UI separately, so you can check how well each application performs.
|
58
|
+
#
|
59
|
+
#The AI that optimizes models to get the best results may optimize different scenarios separately or even use different models in each of the scenarios.
|
60
|
+
#
|
61
|
+
# - +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.
|
62
|
+
#
|
63
|
+
# - +filter+ -> Boolean-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to filter recommended segments based on the `segmentationId`.
|
64
|
+
#
|
65
|
+
# - +booster+ -> Number-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to boost recommendation rate of some segments based on the `segmentationId`.
|
66
|
+
#
|
67
|
+
# - +logic+ -> Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case.
|
68
|
+
#See [this section](https://docs.recombee.com/recommendation_logics.html) for a list of available logics and other details.
|
69
|
+
#
|
70
|
+
#The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
|
71
|
+
#
|
72
|
+
#Logic can also be set to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
|
73
|
+
#
|
74
|
+
# - +expertSettings+ -> Dictionary of custom options.
|
75
|
+
#
|
76
|
+
# - +returnAbGroup+ -> If there is a custom AB-testing running, return the name of the group to which the request belongs.
|
77
|
+
#
|
78
|
+
#
|
79
|
+
def initialize(item_id, target_user_id, count, optional = {})
|
80
|
+
@item_id = item_id
|
81
|
+
@target_user_id = target_user_id
|
82
|
+
@count = count
|
83
|
+
optional = normalize_optional(optional)
|
84
|
+
@scenario = optional['scenario']
|
85
|
+
@cascade_create = optional['cascadeCreate']
|
86
|
+
@filter = optional['filter']
|
87
|
+
@booster = optional['booster']
|
88
|
+
@logic = optional['logic']
|
89
|
+
@expert_settings = optional['expertSettings']
|
90
|
+
@return_ab_group = optional['returnAbGroup']
|
91
|
+
@optional = optional
|
92
|
+
@timeout = 3000
|
93
|
+
@ensure_https = false
|
94
|
+
@optional.each do |par, _|
|
95
|
+
fail UnknownOptionalParameter.new(par) unless ["scenario","cascadeCreate","filter","booster","logic","expertSettings","returnAbGroup"].include? par
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# HTTP method
|
100
|
+
def method
|
101
|
+
:post
|
102
|
+
end
|
103
|
+
|
104
|
+
# Values of body parameters as a Hash
|
105
|
+
def body_parameters
|
106
|
+
p = Hash.new
|
107
|
+
p['targetUserId'] = @target_user_id
|
108
|
+
p['count'] = @count
|
109
|
+
p['scenario'] = @optional['scenario'] if @optional.include? 'scenario'
|
110
|
+
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
111
|
+
p['filter'] = @optional['filter'] if @optional.include? 'filter'
|
112
|
+
p['booster'] = @optional['booster'] if @optional.include? 'booster'
|
113
|
+
p['logic'] = @optional['logic'] if @optional.include? 'logic'
|
114
|
+
p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
|
115
|
+
p['returnAbGroup'] = @optional['returnAbGroup'] if @optional.include? 'returnAbGroup'
|
116
|
+
p
|
117
|
+
end
|
118
|
+
|
119
|
+
# Values of query parameters as a Hash.
|
120
|
+
# name of parameter => value of the parameter
|
121
|
+
def query_parameters
|
122
|
+
params = {}
|
123
|
+
params
|
124
|
+
end
|
125
|
+
|
126
|
+
# Relative path to the endpoint
|
127
|
+
def path
|
128
|
+
"/{databaseId}/recomms/items/#{@item_id}/item-segments/"
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
#
|
2
|
+
# This file is auto-generated, do not edit
|
3
|
+
#
|
4
|
+
|
5
|
+
module RecombeeApiClient
|
6
|
+
require_relative 'request'
|
7
|
+
require_relative '../errors'
|
8
|
+
|
9
|
+
##
|
10
|
+
#Recommends Segments from a result Segmentation that are the most relevant to a particular Segment from a context Segmentation.
|
11
|
+
#
|
12
|
+
#Based on the used Segmentations, this endpoint can be used for example for:
|
13
|
+
#
|
14
|
+
# - Recommending the related brands to particular brand
|
15
|
+
# - Recommending the related brands to particular category
|
16
|
+
# - Recommending the related artists to a particular genre (assuming songs are the Items)
|
17
|
+
#
|
18
|
+
#You need to set the used context and result Segmentation the Admin UI in the Scenario settings prior to using this endpoint.
|
19
|
+
#
|
20
|
+
#The returned segments are sorted by relevance (first segment being the most relevant).
|
21
|
+
#
|
22
|
+
#It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
|
23
|
+
#
|
24
|
+
class RecommendItemSegmentsToItemSegment < ApiRequest
|
25
|
+
attr_reader :context_segment_id, :target_user_id, :count, :scenario, :cascade_create, :filter, :booster, :logic, :expert_settings, :return_ab_group
|
26
|
+
attr_accessor :timeout
|
27
|
+
attr_accessor :ensure_https
|
28
|
+
|
29
|
+
##
|
30
|
+
# * *Required arguments*
|
31
|
+
# - +context_segment_id+ -> ID of the segment from `contextSegmentationId` for which the recommendations are to be generated.
|
32
|
+
# - +target_user_id+ -> ID of the user who will see the recommendations.
|
33
|
+
#
|
34
|
+
#Specifying the *targetUserId* is beneficial because:
|
35
|
+
#
|
36
|
+
#* It makes the recommendations personalized
|
37
|
+
#* Allows the calculation of Actions and Conversions
|
38
|
+
# in the graphical user interface,
|
39
|
+
# as Recombee can pair the user who got recommendations
|
40
|
+
# and who afterward viewed/purchased an item.
|
41
|
+
#
|
42
|
+
#If you insist on not specifying the user, pass `null`
|
43
|
+
#(`None`, `nil`, `NULL` etc., depending on the language) to *targetUserId*.
|
44
|
+
#Do not create some special dummy user for getting recommendations,
|
45
|
+
#as it could mislead the recommendation models,
|
46
|
+
#and result in wrong recommendations.
|
47
|
+
#
|
48
|
+
#For anonymous/unregistered users, it is possible to use, for example, their session ID.
|
49
|
+
#
|
50
|
+
# - +count+ -> Number of item segments to be recommended (N for the top-N recommendation).
|
51
|
+
#
|
52
|
+
#
|
53
|
+
# * *Optional arguments (given as hash optional)*
|
54
|
+
# - +scenario+ -> Scenario defines a particular application of recommendations. It can be, for example, "homepage", "cart", or "emailing".
|
55
|
+
#
|
56
|
+
#You can set various settings to the [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com). You can also see the performance of each scenario in the Admin UI separately, so you can check how well each application performs.
|
57
|
+
#
|
58
|
+
#The AI that optimizes models to get the best results may optimize different scenarios separately or even use different models in each of the scenarios.
|
59
|
+
#
|
60
|
+
# - +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.
|
61
|
+
#
|
62
|
+
# - +filter+ -> Boolean-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to filter recommended segments based on the `segmentationId`.
|
63
|
+
#
|
64
|
+
# - +booster+ -> Number-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to boost recommendation rate of some segments based on the `segmentationId`.
|
65
|
+
#
|
66
|
+
# - +logic+ -> Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case.
|
67
|
+
#See [this section](https://docs.recombee.com/recommendation_logics.html) for a list of available logics and other details.
|
68
|
+
#
|
69
|
+
#The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
|
70
|
+
#
|
71
|
+
#Logic can also be set to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
|
72
|
+
#
|
73
|
+
# - +expertSettings+ -> Dictionary of custom options.
|
74
|
+
#
|
75
|
+
# - +returnAbGroup+ -> If there is a custom AB-testing running, return the name of the group to which the request belongs.
|
76
|
+
#
|
77
|
+
#
|
78
|
+
def initialize(context_segment_id, target_user_id, count, optional = {})
|
79
|
+
@context_segment_id = context_segment_id
|
80
|
+
@target_user_id = target_user_id
|
81
|
+
@count = count
|
82
|
+
optional = normalize_optional(optional)
|
83
|
+
@scenario = optional['scenario']
|
84
|
+
@cascade_create = optional['cascadeCreate']
|
85
|
+
@filter = optional['filter']
|
86
|
+
@booster = optional['booster']
|
87
|
+
@logic = optional['logic']
|
88
|
+
@expert_settings = optional['expertSettings']
|
89
|
+
@return_ab_group = optional['returnAbGroup']
|
90
|
+
@optional = optional
|
91
|
+
@timeout = 3000
|
92
|
+
@ensure_https = false
|
93
|
+
@optional.each do |par, _|
|
94
|
+
fail UnknownOptionalParameter.new(par) unless ["scenario","cascadeCreate","filter","booster","logic","expertSettings","returnAbGroup"].include? par
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# HTTP method
|
99
|
+
def method
|
100
|
+
:post
|
101
|
+
end
|
102
|
+
|
103
|
+
# Values of body parameters as a Hash
|
104
|
+
def body_parameters
|
105
|
+
p = Hash.new
|
106
|
+
p['contextSegmentId'] = @context_segment_id
|
107
|
+
p['targetUserId'] = @target_user_id
|
108
|
+
p['count'] = @count
|
109
|
+
p['scenario'] = @optional['scenario'] if @optional.include? 'scenario'
|
110
|
+
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
111
|
+
p['filter'] = @optional['filter'] if @optional.include? 'filter'
|
112
|
+
p['booster'] = @optional['booster'] if @optional.include? 'booster'
|
113
|
+
p['logic'] = @optional['logic'] if @optional.include? 'logic'
|
114
|
+
p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
|
115
|
+
p['returnAbGroup'] = @optional['returnAbGroup'] if @optional.include? 'returnAbGroup'
|
116
|
+
p
|
117
|
+
end
|
118
|
+
|
119
|
+
# Values of query parameters as a Hash.
|
120
|
+
# name of parameter => value of the parameter
|
121
|
+
def query_parameters
|
122
|
+
params = {}
|
123
|
+
params
|
124
|
+
end
|
125
|
+
|
126
|
+
# Relative path to the endpoint
|
127
|
+
def path
|
128
|
+
"/{databaseId}/recomms/item-segments/item-segments/"
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
#
|
2
|
+
# This file is auto-generated, do not edit
|
3
|
+
#
|
4
|
+
|
5
|
+
module RecombeeApiClient
|
6
|
+
require_relative 'request'
|
7
|
+
require_relative '../errors'
|
8
|
+
|
9
|
+
##
|
10
|
+
#Recommends the top Segments from a Segmentation for a particular user, based on the user's past interactions.
|
11
|
+
#
|
12
|
+
#Based on the used Segmentation, this endpoint can be used for example for:
|
13
|
+
#
|
14
|
+
# - Recommending the top categories for the user
|
15
|
+
# - Recommending the top genres for the user
|
16
|
+
# - Recommending the top brands for the user
|
17
|
+
# - Recommending the top artists for the user
|
18
|
+
#
|
19
|
+
#You need to set the used Segmentation the Admin UI in the Scenario settings prior to using this endpoint.
|
20
|
+
#
|
21
|
+
#The returned segments are sorted by relevance (first segment being the most relevant).
|
22
|
+
#
|
23
|
+
#It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
|
24
|
+
#
|
25
|
+
class RecommendItemSegmentsToUser < ApiRequest
|
26
|
+
attr_reader :user_id, :count, :scenario, :cascade_create, :filter, :booster, :logic, :expert_settings, :return_ab_group
|
27
|
+
attr_accessor :timeout
|
28
|
+
attr_accessor :ensure_https
|
29
|
+
|
30
|
+
##
|
31
|
+
# * *Required arguments*
|
32
|
+
# - +user_id+ -> ID of the user for whom personalized recommendations are to be generated.
|
33
|
+
# - +count+ -> Number of item segments to be recommended (N for the top-N recommendation).
|
34
|
+
#
|
35
|
+
#
|
36
|
+
# * *Optional arguments (given as hash optional)*
|
37
|
+
# - +scenario+ -> Scenario defines a particular application of recommendations. It can be, for example, "homepage", "cart", or "emailing".
|
38
|
+
#
|
39
|
+
#You can set various settings to the [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com). You can also see the performance of each scenario in the Admin UI separately, so you can check how well each application performs.
|
40
|
+
#
|
41
|
+
#The AI that optimizes models to get the best results may optimize different scenarios separately or even use different models in each of the scenarios.
|
42
|
+
#
|
43
|
+
# - +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.
|
44
|
+
#
|
45
|
+
# - +filter+ -> Boolean-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to filter recommended segments based on the `segmentationId`.
|
46
|
+
#
|
47
|
+
# - +booster+ -> Number-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to boost recommendation rate of some segments based on the `segmentationId`.
|
48
|
+
#
|
49
|
+
# - +logic+ -> Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case.
|
50
|
+
#See [this section](https://docs.recombee.com/recommendation_logics.html) for a 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
|
+
#
|
54
|
+
#Logic can also be set to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
|
55
|
+
#
|
56
|
+
# - +expertSettings+ -> Dictionary of custom options.
|
57
|
+
#
|
58
|
+
# - +returnAbGroup+ -> If there is a custom AB-testing running, return the name of the group to which the request belongs.
|
59
|
+
#
|
60
|
+
#
|
61
|
+
def initialize(user_id, count, optional = {})
|
62
|
+
@user_id = user_id
|
63
|
+
@count = count
|
64
|
+
optional = normalize_optional(optional)
|
65
|
+
@scenario = optional['scenario']
|
66
|
+
@cascade_create = optional['cascadeCreate']
|
67
|
+
@filter = optional['filter']
|
68
|
+
@booster = optional['booster']
|
69
|
+
@logic = optional['logic']
|
70
|
+
@expert_settings = optional['expertSettings']
|
71
|
+
@return_ab_group = optional['returnAbGroup']
|
72
|
+
@optional = optional
|
73
|
+
@timeout = 3000
|
74
|
+
@ensure_https = false
|
75
|
+
@optional.each do |par, _|
|
76
|
+
fail UnknownOptionalParameter.new(par) unless ["scenario","cascadeCreate","filter","booster","logic","expertSettings","returnAbGroup"].include? par
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# HTTP method
|
81
|
+
def method
|
82
|
+
:post
|
83
|
+
end
|
84
|
+
|
85
|
+
# Values of body parameters as a Hash
|
86
|
+
def body_parameters
|
87
|
+
p = Hash.new
|
88
|
+
p['count'] = @count
|
89
|
+
p['scenario'] = @optional['scenario'] if @optional.include? 'scenario'
|
90
|
+
p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate'
|
91
|
+
p['filter'] = @optional['filter'] if @optional.include? 'filter'
|
92
|
+
p['booster'] = @optional['booster'] if @optional.include? 'booster'
|
93
|
+
p['logic'] = @optional['logic'] if @optional.include? 'logic'
|
94
|
+
p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings'
|
95
|
+
p['returnAbGroup'] = @optional['returnAbGroup'] if @optional.include? 'returnAbGroup'
|
96
|
+
p
|
97
|
+
end
|
98
|
+
|
99
|
+
# Values of query parameters as a Hash.
|
100
|
+
# name of parameter => value of the parameter
|
101
|
+
def query_parameters
|
102
|
+
params = {}
|
103
|
+
params
|
104
|
+
end
|
105
|
+
|
106
|
+
# Relative path to the endpoint
|
107
|
+
def path
|
108
|
+
"/{databaseId}/recomms/users/#{@user_id}/item-segments/"
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -7,16 +7,16 @@ module RecombeeApiClient
|
|
7
7
|
require_relative '../errors'
|
8
8
|
|
9
9
|
##
|
10
|
-
#Recommends set of items that are somehow related to one given item, *X*.
|
10
|
+
#Recommends a set of items that are somehow related to one given item, *X*. A typical scenario is when the user *A* is viewing *X*. Then you may display items to the user that he might also be interested in. Recommend items to item request gives you Top-N such items, optionally taking the target user *A* into account.
|
11
11
|
#
|
12
|
-
#The returned items are sorted by relevance (first item being the most relevant).
|
12
|
+
#The returned items are sorted by relevance (the first item being the most relevant).
|
13
13
|
#
|
14
14
|
#Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to:
|
15
15
|
#
|
16
|
-
#- Let Recombee know that this recommendation was successful (e.g
|
16
|
+
#- Let Recombee know that this recommendation was successful (e.g., user clicked one of the recommended items). See [Reported metrics](https://docs.recombee.com/admin_ui.html#reported-metrics).
|
17
17
|
#- Get subsequent recommended items when the user scrolls down (*infinite scroll*) or goes to the next page. See [Recommend Next Items](https://docs.recombee.com/api.html#recommend-next-items).
|
18
18
|
#
|
19
|
-
#It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
|
19
|
+
#It is also possible to use POST HTTP method (for example in the case of a very long ReQL filter) - query parameters then become body parameters.
|
20
20
|
#
|
21
21
|
class RecommendItemsToItem < ApiRequest
|
22
22
|
attr_reader :item_id, :target_user_id, :count, :scenario, :cascade_create, :return_properties, :included_properties, :filter, :booster, :logic, :user_impact, :diversity, :min_relevance, :rotation_rate, :rotation_time, :expert_settings, :return_ab_group
|
@@ -34,27 +34,27 @@ module RecombeeApiClient
|
|
34
34
|
#* Allows the calculation of Actions and Conversions
|
35
35
|
# in the graphical user interface,
|
36
36
|
# as Recombee can pair the user who got recommendations
|
37
|
-
# and who
|
37
|
+
# and who afterward viewed/purchased an item.
|
38
38
|
#
|
39
39
|
#If you insist on not specifying the user, pass `null`
|
40
|
-
#(`None`, `nil`, `NULL` etc
|
40
|
+
#(`None`, `nil`, `NULL` etc., depending on the language) to *targetUserId*.
|
41
41
|
#Do not create some special dummy user for getting recommendations,
|
42
42
|
#as it could mislead the recommendation models,
|
43
43
|
#and result in wrong recommendations.
|
44
44
|
#
|
45
|
-
#For anonymous/unregistered users it is possible to use for example their session ID.
|
45
|
+
#For anonymous/unregistered users, it is possible to use, for example, their session ID.
|
46
46
|
#
|
47
47
|
# - +count+ -> Number of items to be recommended (N for the top-N recommendation).
|
48
48
|
#
|
49
49
|
# * *Optional arguments (given as hash optional)*
|
50
|
-
# - +scenario+ -> Scenario defines a particular application of recommendations. It can be for example "homepage", "cart" or "emailing".
|
50
|
+
# - +scenario+ -> Scenario defines a particular application of recommendations. It can be, for example, "homepage", "cart", or "emailing".
|
51
51
|
#
|
52
|
-
#You can set various settings to the [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com). You can also see performance of each scenario in the Admin UI separately, so you can check how well each application performs.
|
52
|
+
#You can set various settings to the [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com). You can also see the performance of each scenario in the Admin UI separately, so you can check how well each application performs.
|
53
53
|
#
|
54
|
-
#The AI
|
54
|
+
#The AI that optimizes models to get the best results may optimize different scenarios separately or even use different models in each of the scenarios.
|
55
55
|
#
|
56
|
-
# - +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.
|
57
|
-
# - +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
|
56
|
+
# - +cascadeCreate+ -> If an item of the given *itemId* or user of the 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 the given *targetUserId*, as the user will be already known to the system.
|
57
|
+
# - +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 to easily display the recommended items to the user.
|
58
58
|
#
|
59
59
|
#Example response:
|
60
60
|
#```
|
@@ -85,7 +85,7 @@ module RecombeeApiClient
|
|
85
85
|
# }
|
86
86
|
#```
|
87
87
|
#
|
88
|
-
# - +includedProperties+ -> Allows
|
88
|
+
# - +includedProperties+ -> Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.
|
89
89
|
#
|
90
90
|
#Example response for `includedProperties=description,price`:
|
91
91
|
#```
|
@@ -112,34 +112,34 @@ module RecombeeApiClient
|
|
112
112
|
# }
|
113
113
|
#```
|
114
114
|
#
|
115
|
-
# - +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.
|
115
|
+
# - +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.
|
116
116
|
#
|
117
|
-
#Filters can be
|
117
|
+
#Filters can also be assigned to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
|
118
118
|
#
|
119
|
-
# - +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.
|
119
|
+
# - +booster+ -> Number-returning [ReQL](https://docs.recombee.com/reql.html) expression, which allows you to boost the recommendation rate of some items based on the values of their attributes.
|
120
120
|
#
|
121
|
-
#Boosters can be
|
121
|
+
#Boosters can also be assigned to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
|
122
122
|
#
|
123
|
-
# - +logic+ -> Logic specifies particular behavior of the recommendation models. You can pick tailored logic for your domain and use case.
|
124
|
-
#See [this section](https://docs.recombee.com/recommendation_logics.html) for list of available logics and other details.
|
123
|
+
# - +logic+ -> Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case.
|
124
|
+
#See [this section](https://docs.recombee.com/recommendation_logics.html) for a list of available logics and other details.
|
125
125
|
#
|
126
126
|
#The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
|
127
127
|
#
|
128
|
-
#Logic can be
|
128
|
+
#Logic can also be set to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
|
129
129
|
#
|
130
|
-
# - +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`.
|
130
|
+
# - +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 a user-based recommendation. The default value is `0`.
|
131
131
|
#
|
132
|
-
# - +diversity+ -> **Expert option** Real number from [0.0, 1.0] which determines how
|
132
|
+
# - +diversity+ -> **Expert option** Real number from [0.0, 1.0], which determines how mutually dissimilar the recommended items should be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification.
|
133
133
|
#
|
134
|
-
# - +minRelevance+ -> **Expert option** If the *targetUserId* is provided: Specifies the threshold of how
|
134
|
+
# - +minRelevance+ -> **Expert option** If the *targetUserId* is provided: Specifies the threshold of how 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 a number of items equal to *count* at any cost. If there is not enough data (such as interactions or item properties), this may even lead to bestseller-based recommendations being 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 relevance and may return less than *count* items when there is not enough data to fulfill it.
|
135
135
|
#
|
136
|
-
# - +rotationRate+ -> **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
|
136
|
+
# - +rotationRate+ -> **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 a 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.
|
137
137
|
#
|
138
|
-
# - +rotationTime+ -> **Expert option** If the *targetUserId* is provided: Taking *rotationRate* into account, specifies how long
|
138
|
+
# - +rotationTime+ -> **Expert option** If the *targetUserId* is provided: Taking *rotationRate* into account, specifies how long it takes for an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized.
|
139
139
|
#
|
140
140
|
# - +expertSettings+ -> Dictionary of custom options.
|
141
141
|
#
|
142
|
-
# - +returnAbGroup+ -> If there is a custom AB-testing running, return name of group to which the request belongs.
|
142
|
+
# - +returnAbGroup+ -> If there is a custom AB-testing running, return the name of the group to which the request belongs.
|
143
143
|
#
|
144
144
|
#
|
145
145
|
def initialize(item_id, target_user_id, count, optional = {})
|
@@ -7,18 +7,18 @@ module RecombeeApiClient
|
|
7
7
|
require_relative '../errors'
|
8
8
|
|
9
9
|
##
|
10
|
-
#Based on user's past interactions (purchases, ratings, etc.) with the items, recommends top-N items that are most likely to be of high value for
|
10
|
+
#Based on the user's past interactions (purchases, ratings, etc.) with the items, recommends top-N items that are most likely to be of high value for the given user.
|
11
11
|
#
|
12
|
-
#The most typical use cases are recommendations
|
12
|
+
#The most typical use cases are recommendations on the homepage, in some "Picked just for you" section, or in email.
|
13
13
|
#
|
14
|
-
#The returned items are sorted by relevance (first item being the most relevant).
|
14
|
+
#The returned items are sorted by relevance (the first item being the most relevant).
|
15
15
|
#
|
16
16
|
#Besides the recommended items, also a unique `recommId` is returned in the response. It can be used to:
|
17
17
|
#
|
18
|
-
#- Let Recombee know that this recommendation was successful (e.g
|
18
|
+
#- Let Recombee know that this recommendation was successful (e.g., user clicked one of the recommended items). See [Reported metrics](https://docs.recombee.com/admin_ui.html#reported-metrics).
|
19
19
|
#- Get subsequent recommended items when the user scrolls down (*infinite scroll*) or goes to the next page. See [Recommend Next Items](https://docs.recombee.com/api.html#recommend-next-items).
|
20
20
|
#
|
21
|
-
#It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
|
21
|
+
#It is also possible to use POST HTTP method (for example in the case of a very long ReQL filter) - query parameters then become body parameters.
|
22
22
|
#
|
23
23
|
class RecommendItemsToUser < ApiRequest
|
24
24
|
attr_reader :user_id, :count, :scenario, :cascade_create, :return_properties, :included_properties, :filter, :booster, :logic, :diversity, :min_relevance, :rotation_rate, :rotation_time, :expert_settings, :return_ab_group
|
@@ -32,15 +32,15 @@ module RecombeeApiClient
|
|
32
32
|
#
|
33
33
|
#
|
34
34
|
# * *Optional arguments (given as hash optional)*
|
35
|
-
# - +scenario+ -> Scenario defines a particular application of recommendations. It can be for example "homepage", "cart" or "emailing".
|
35
|
+
# - +scenario+ -> Scenario defines a particular application of recommendations. It can be, for example, "homepage", "cart", or "emailing".
|
36
36
|
#
|
37
|
-
#You can set various settings to the [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com). You can also see performance of each scenario in the Admin UI separately, so you can check how well each application performs.
|
37
|
+
#You can set various settings to the [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com). You can also see the performance of each scenario in the Admin UI separately, so you can check how well each application performs.
|
38
38
|
#
|
39
|
-
#The AI
|
39
|
+
#The AI that optimizes models to get the best results may optimize different scenarios separately or even use different models in each of the scenarios.
|
40
40
|
#
|
41
|
-
# - +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.
|
41
|
+
# - +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.
|
42
42
|
#
|
43
|
-
# - +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
|
43
|
+
# - +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 to easily display the recommended items to the user.
|
44
44
|
#
|
45
45
|
#Example response:
|
46
46
|
#```
|
@@ -71,7 +71,7 @@ module RecombeeApiClient
|
|
71
71
|
# }
|
72
72
|
#```
|
73
73
|
#
|
74
|
-
# - +includedProperties+ -> Allows
|
74
|
+
# - +includedProperties+ -> Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.
|
75
75
|
#
|
76
76
|
#Example response for `includedProperties=description,price`:
|
77
77
|
#```
|
@@ -98,32 +98,32 @@ module RecombeeApiClient
|
|
98
98
|
# }
|
99
99
|
#```
|
100
100
|
#
|
101
|
-
# - +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.
|
101
|
+
# - +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.
|
102
102
|
#
|
103
|
-
#Filters can be
|
103
|
+
#Filters can also be assigned to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
|
104
104
|
#
|
105
|
-
# - +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.
|
105
|
+
# - +booster+ -> Number-returning [ReQL](https://docs.recombee.com/reql.html) expression, which allows you to boost the recommendation rate of some items based on the values of their attributes.
|
106
106
|
#
|
107
|
-
#Boosters can be
|
107
|
+
#Boosters can also be assigned to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
|
108
108
|
#
|
109
|
-
# - +logic+ -> Logic specifies particular behavior of the recommendation models. You can pick tailored logic for your domain and use case.
|
110
|
-
#See [this section](https://docs.recombee.com/recommendation_logics.html) for list of available logics and other details.
|
109
|
+
# - +logic+ -> Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case.
|
110
|
+
#See [this section](https://docs.recombee.com/recommendation_logics.html) for a list of available logics and other details.
|
111
111
|
#
|
112
112
|
#The difference between `logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
|
113
113
|
#
|
114
|
-
#Logic can be
|
114
|
+
#Logic can also be set to a [scenario](https://docs.recombee.com/scenarios.html) in the [Admin UI](https://admin.recombee.com).
|
115
115
|
#
|
116
|
-
# - +diversity+ -> **Expert option** Real number from [0.0, 1.0] which determines how
|
116
|
+
# - +diversity+ -> **Expert option** Real number from [0.0, 1.0], which determines how mutually dissimilar the recommended items should be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification.
|
117
117
|
#
|
118
|
-
# - +minRelevance+ -> **Expert option** Specifies the threshold of how
|
118
|
+
# - +minRelevance+ -> **Expert option** Specifies the threshold of how 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 a number of items equal to *count* at any cost. If there is 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 a case, the system only recommends items of at least the requested relevance and may return less than *count* items when there is not enough data to fulfill it.
|
119
119
|
#
|
120
|
-
# - +rotationRate+ -> **Expert option** 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
|
120
|
+
# - +rotationRate+ -> **Expert option** 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 a 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. Default: `0`.
|
121
121
|
#
|
122
|
-
# - +rotationTime+ -> **Expert option** Taking *rotationRate* into account, specifies how long
|
122
|
+
# - +rotationTime+ -> **Expert option** Taking *rotationRate* into account, specifies how long it takes for an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. Default: `7200.0`.
|
123
123
|
#
|
124
124
|
# - +expertSettings+ -> Dictionary of custom options.
|
125
125
|
#
|
126
|
-
# - +returnAbGroup+ -> If there is a custom AB-testing running, return name of group to which the request belongs.
|
126
|
+
# - +returnAbGroup+ -> If there is a custom AB-testing running, return the name of the group to which the request belongs.
|
127
127
|
#
|
128
128
|
#
|
129
129
|
def initialize(user_id, count, optional = {})
|
@@ -7,9 +7,9 @@ module RecombeeApiClient
|
|
7
7
|
require_relative '../errors'
|
8
8
|
|
9
9
|
##
|
10
|
-
#Returns items that shall be shown to a user as next recommendations when the user e.g. scrolls the page down (*infinite scroll*) or goes to
|
10
|
+
#Returns items that shall be shown to a user as next recommendations when the user e.g. scrolls the page down (*infinite scroll*) or goes to the next page.
|
11
11
|
#
|
12
|
-
#It accepts `recommId` of a base recommendation request (e.g
|
12
|
+
#It accepts `recommId` of a base recommendation request (e.g., request from the first page) and the number of items that shall be returned (`count`).
|
13
13
|
#The base request can be one of:
|
14
14
|
# - [Recommend items to item](https://docs.recombee.com/api.html#recommend-items-to-item)
|
15
15
|
# - [Recommend items to user](https://docs.recombee.com/api.html#recommend-items-to-user)
|