<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>mendation Constrained by Total Cost</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Oleg Lashinin</string-name>
          <email>o.a.lashinin@tinkoff.ru</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Marina Ananyeva</string-name>
          <email>m.ananyeva@tinkoff.ai</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Metrics. We compute the ranking metrics</institution>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>National Research University Higher School of Economics</institution>
          ,
          <addr-line>Moscow</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Tinkof</institution>
          ,
          <addr-line>Moscow</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2022</year>
      </pub-date>
      <abstract>
        <p>The next-basket recommendations are a well-studied problem in the academic field. As a rule, we want to predict top-K goods that might be added to the last known basket of the user based on the previous purchase history. However, the existing studies do not take into account that each user can be limited by the amount of money. Therefore, clients of online websites might be interested in the opportunity to receive personal recommendations with a given fixed cost. For example, we can take the average spending over the history of customer's purchases as an upper bound. In this article, we consider addressing the problem of making next-basket recommendations with set total cost restrictions.</p>
      </abstract>
      <kwd-group>
        <kwd>next-basket recommendation</kwd>
        <kwd>constrained recommendations</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>(M. Ananyeva)</p>
      <p>1234-5678-9012 (M. Ananyeva)</p>
      <p>= { ,1 , … ,  ,| | }.</p>
      <p>It is implied, that any recommender model can be used
to obtain these scores, which is beyond our scope. Also,
we obtain a list of items prices   = { 1, … ,  | | }. For each
user, we have a true basket with some purchased items
in the last transaction  ,</p>
      <p>= { ,1 , … ,  ,| | } where || is a
number of goods in the last purchased basket. The aim is
to predict items in  ,
 ̂
,
= { ,̂1 , … ,  ,̂</p>
      <p>with a  -length recommendations
}.    is a total cost for a user  . We
generate the list based on the restrictions for each user:
of the used total cost in recommended baskets. The second histogram presents the distribution of the number of recommended
items. The line graph presents Recall@k w.r.t. diferent k values both for the classical NBR problem and the proposed
next-basket with constraints task.</p>
      <p>
        =1
=1
∑  , → 
∑  , &lt;   
(
        <xref ref-type="bibr" rid="ref1">1</xref>
        )
(
        <xref ref-type="bibr" rid="ref2">2</xref>
        )
      </p>
      <p>However, a few remarks are required here. Usually, we
have no information on how many items || a customer
will add to the next cart. To overcome this problem, we
can generate the lists  ̂</p>
      <p>
        , for diferent  values and select
those that maximize the equation (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ). In our
implementation, we generate  -length vectors with
recommendations for each user and drop extra items Alternatively,
we can try to predict the number of items || and make
the lists based on the predicted values.
      </p>
      <p>Also, the    parameter can be varied by the user in
real-time. The user can change the thresholds of the total
cost and select the best option with personal
recommendations.</p>
      <p>We use a genetic algorithm in order to find the optimal
 ,̂ . The generated populations of multi-hot vectors with

size from the most relevant items  ,</p>
      <p>
        = { ,1 , … ,  , }
for each user. The  -th component of a generated
vector (gene of a chromosome) is supposed to be equal to
1 and the corresponding  -th element of the
recommendations list will be included to the final predictions. If
the condition (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ) is not met, the fitness function is equal
to negative infinity or
∑ ,
      </p>
      <p>
        otherwise. Therefore, the
genetic algorithm will maximize (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) with the respect to
the condition (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ). We leave other possible approaches to
ifnding the optimal solution for future work.
      </p>
    </sec>
    <sec id="sec-2">
      <title>3. Experiments</title>
      <sec id="sec-2-1">
        <title>Dataset. We conducte preliminary experiments on the</title>
        <p>[1, 2] Ta-Feng dataset1, which is extensively used in
recommender systems.</p>
        <p>It includes purchase history of goods with given
pricing. Users in the Ta-Feng dataset can purchase diferent
quantities of the same goods. Nonetheless, we will
consider proposing a product based on the dataset’s average
price. Furthermore, we assume that the
recommendations cannot contain duplicates, which means that each
item can only be suggested once and in a single
occurrence. We employ the same data preparation strategy as
in TIFU-KNN [1] to evaluate our approach, and we use a
leave-one-basket [3] scenario.</p>
      </sec>
      <sec id="sec-2-2">
        <title>NDCG@k) that are commonly used in the next-basket recommendation evaluation [1, 4, 2].</title>
        <p>Experiment Settings.</p>
      </sec>
      <sec id="sec-2-3">
        <title>In ofline evaluation settings, the</title>
        <p>value can be
chosen by the researchers. For instance, we could predict
the total cost of the last known basket for each user or
vary the values of</p>
        <p>across some range on a dataset.</p>
        <p>In particular, it is possible to calculate the average basket
cost from the training set for each user and take this
aggregated statistic as a constraint. In our case,   
equals the true cost of the last basket ∑  ,
customer. It approximates the case when the customer</p>
        <p>of each
knows exactly how much he is can aford or is willing to
spend.</p>
        <p>We adopt the genetic algorithm, using the
implementation from the open-source framework
geneticalgorithm22. For solving this task on the Ta-Feng dataset,
we use only the 20 most relevant items and population
1https://www.kaggle.com/datasets/chiranjivdas09/ta-feng-grocerysize of 40 vectors. PersonTopFreq approach is applied reward, and the conditions for buying the entire bundle
as a recommender model that returns the most popular or only certain items from it are open. In addition, the
items from the baskets of all users, demonstrating the diferent cases which allow a user to add or delete an
high performance in TIFU-KNN [1]. Also, we use nega- item allow the platforms to make a user-friendly
intertive ranks of items as  , because negativity is needed for face with updates in recommendations in real time. In
maximizing the    of items included in the final predic- particular, after each customer’s action with the basket,
tions. Application of other recommendation approaches the recommended bundle of items can be recalculated
for the next basket task is left for future work. entirely or iteratively, by replacing each added or deleted</p>
        <p>Performance Comparison. Figure 1 (a) shows the item with a new item of the same price in order not
average rate of the used total cost, which is quite close to exceed the total price. Finally, we could use bundle
to the cost of the basket from the testing sample. In this recommendations in the ofline experiments as baseline
graph, all predicted baskets with a higher total cost are solutions or adapt them to this formalized task.
neglected. The costs of most collected baskets are close Approaches. Instead of genetic algorithms, we could
to    and satisfy the user’s needs. also try to adopt a graph-based A* algorithm, integer
pro</p>
        <p>Figure 1 (b) demonstrates the number of goods that gramming, or knapsack problem with dynamic
programwere included in the baskets, which is close to the Gaus- ming techniques to address the problem of generating
sian distribution. next-basket recommendations with a total cost constraint.</p>
        <p>Figure 1 (c) compares the values of Recall@k w.r.t. the Still, some open issues should be discussed. For instance,
diferent  values for two cases. The results when we should the sum of relevance scores be equal to the total
recommend only top-k relevant items are in green. The relevance score and be constrained by the lower bound
Recall@k values with top-k items with the total cost re- of relevance or not? What are the reasonable restrictions
strictions from the 20 most relevant items are in blue. for relevance scores considering their diferent ranges
There is no extreme diference between the two meth- of values, negative and positive scores from the
recomods observed, but our recommendations fit additional mender algorithms? These are only a few examples of
restrictions in the TCANBR scenario. open questions.</p>
        <p>Total Cost values. In this paper, we suggested a way
to set a total cost value. However, we could think of
4. Discussion predicting the total cost for each user, for example, using
linear regression or other machine learning models. In
During the discussion panel of this brainstorming ides, user cases, when the customer updates the maximum
that took place at the 5th Workshop on Online Recom- afordable cost, we can take this value in real-time and use
mender Systems and User Modeling (Seattle, WA, USA, it on the inference step. Otherwise, we could also think of
2022)3, we can summarize the open issues and several using the segments of customers instead of personalized
future directions for future work. values of the total cost. For example, the customers with</p>
        <p>Additional constraints. Taking into account the for- low, medium, and high income and three diferent values
malization problem mentioned above, we could think of for this constraint correspondingly.
additional restrictions that can be applied to bring the so- Item quantity. One of the problems, which we
nelution closer to real conditions. Firstly, we could extend glect for the simplicity, is the challenge to take into
acto the lower and upper bounds of the price for recom- count the diferent quantities for each item in the lists of
mended items. It can either be set as hyperparameters recommendations. In case we want to add this additional
or as extra constraints in our task. It would help to solve restriction to the task, we should think carefully about
a problem of making the list of recommendations only how to include this constraint and optimize the function.
with cheap or expensive items. Secondly, we could extend We also should think about whether we allow duplicated
the task to introducing the profit margins, which both items. For example, the milk, but of diferent brands and
customers and enterprises pursue considering business prices. In addition, some items could be bought always
metrics. in single pieces, but some others are taken in multiple</p>
        <p>Bundle recommendations. Considering the fact that pieces or are the goods sold by weight. In our case, we
we want to generate a list of recommended items, we implied no duplicates and only 1 allowed piece of each
might think about it as bundle recommendations. In par- item for simplicity.
ticular, it could enhance the diversity or complementarity The list of problems mentioned above is not exhaustive
of predicted items. Thus, the approaches for bundle rec- and can be continued and developed into comprehensive
ommendations could also bee used to solve the task of versions of formalization task and be addressed by
diferconstrained recommendations with total cost. However, ent approaches.
the questions on how to evaluate the bundle, attribute the</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>5. Conclusion</title>
      <p>In this article, we briefly introduced a formalization
problem of the next-basket constrained recommendations
problem. The tested approach simulates a case when a
customer of an online marketplace can spend a
particular upper bound of the amount of money. Alternatively,
some online services can fit the recommendations into
a suggested budget for each user. This problem task
suggests generating item recommendations that do not
exceed the specified maximum total cost.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>H.</given-names>
            <surname>Hu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>He</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Gao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.-L.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <article-title>Modeling personalized item frequency information for next-basket recommendation</article-title>
          ,
          <source>in: Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval</source>
          ,
          <year>2020</year>
          , pp.
          <fpage>1071</fpage>
          -
          <lpage>1080</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>G.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <article-title>A new method combining pattern prediction and preference prediction for next basket recommendation</article-title>
          ,
          <source>Entropy</source>
          <volume>23</volume>
          (
          <year>2021</year>
          )
          <fpage>1430</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>Z.</given-names>
            <surname>Meng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>McCreadie</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Macdonald</surname>
          </string-name>
          ,
          <string-name>
            <surname>I. Ounis</surname>
          </string-name>
          ,
          <article-title>Exploring data splitting strategies for the evaluation of recommendation models</article-title>
          ,
          <source>in: Fourteenth ACM conference on recommender systems</source>
          ,
          <year>2020</year>
          , pp.
          <fpage>681</fpage>
          -
          <lpage>686</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>M.</given-names>
            <surname>Ariannezhad</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Jullien</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Fang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Schelter</surname>
          </string-name>
          , M. de Rijke,
          <article-title>Recanet: A repeat consumption-aware neural network for next basket recommendation in grocery shopping (</article-title>
          <year>2022</year>
          ).
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>