# Simultaneous Learning of the Inputs and Parameters in
Neural Collaborative Filtering

Ramin Raziperchikolaei  Young-joo Chung

###### Abstract

Neural network-based collaborative filtering systems focus on designing
network architectures to learn better representations while fixing the input
to the user/item interaction vectors and/or ID. In this paper, we first show
that the non-zero elements of the inputs are learnable parameters that
determine the weights in combining the user/item embeddings and fixing them
limits the power of the models in learning the representations. Then, we
propose to learn the value of the non-zero elements of the inputs jointly with
the neural network parameters. We analyze the model complexity and the
empirical risk of our approach and prove that learning the input leads to a
better generalization bound. Our experiments on several real-world datasets
show that our method outperforms the state-of-the-art methods, even using
shallow network structures with a smaller number of layers and parameters.

##  1 Introduction

With the explosive growth of online information in the past few decades,
recommender systems (RSs) have become imperative to overcome the information
overload problem [23]. The goal of RSs is to predict user feedback on items,
which can be helpful in providing a list of suggested items to a user. The
feedback (also called interaction) can be implicit (e.g., purchased) or
explicit (e.g., a rating between $1$ to $5$). Our approach can be applied to
both types of feedback. The ”interaction” throughout this paper refers to both
types.

Collaborative filtering (CF), one of the most widely used and studied
approaches in RSs, learns users’ preferences from the patterns in the past
feedback between the users and items [23]. Matrix factorization (MF), the most
popular approach in CF, models the interaction between the users and items by
the dot product of their representations [17].

Neural network-based collaborative filtering methods have recently become
popular to extend the idea of the MF and achieve better predictions. These
methods involve neural networks in learning the user/item representations
and/or modeling the interactions [12]. The main neural network architectures
used in these models are autoencoders [24], multilayer perceptrons (MLPs) [37,
11, 5], and convolutional neural networks (CNNs) [12].

In this paper, we focus on another key–but lesser studied–element of neural
network-based methods: _the input layer and its role in learning better
representations._ Two types of inputs are used in neural network-based RSs.
The first one is the user/item ID, where each ID is converted to a one-hot-
encoding vector and gets connected to an embedding matrix [11, 12]. The second
one is the user-item interaction vector, where the user interaction vector
contains user feedback on all items and the item interaction vector contains
all feedback given to an item [24, 37, 5]. Even the hybrid RS models, which
utilize side information to overcome the issue of interaction sparsity, still
keep the user/item ID and/or interaction vector to get competitive results
[28, 40, 4].

Table 2 of Dong et al. [5] shows that DeepCF (with the interaction vector as
the input) outperforms NeuMF (with the ID as the input) in four different
datasets. Table 2 of Xue et al. [37] and our experiments confirm these
results. In Section 3, we give the details of the NCF with the interaction
vector and ID as the input and explain why one works better than the other.

It is known that deep neural networks can be applied to images and textual
data, which are spatially and/or temporally correlated, to achieve state-of-
the-art results. As pointed out by Lian et al. [20], the input data in RSs is
different from images and textual data. First, there is no temporal or spatial
correlation in the interaction vectors. Second, the interaction vectors are
massively sparse (between $95\%$ to $99\%$) and have vast dimensions (between
a few thousand to a few million). What kind of information does the neural
network extract from the interaction vectors to learn user and item
representations then?

To answer this question, we utilize Neural Collaborative Filtering (NCF)
framework proposed by He et al. [11] to understand and analyze the role of
interaction vectors. We selected NFC because it is a basic two-branch
architecture for neural collaborative filtering. In most NCF papers, the input
layer is connected to a set of fully connected layers [37, 11, 5]. We show
that the weight matrix of the first layer can be considered as an implicit
user/item embedding matrix, and the non-zero elements of the interaction
vector determine which embedding vectors to choose. We argue that the non-zero
elements of the interaction vectors are _learnable parameters_ that determine
the weights in combining the embeddings. Fixing these input parameters limits
the power of the models in learning the representations. To achieve better
representations, we propose to learn the input and neural network parameters
jointly. We theoretically analyze our approach and prove that it achieves a
better empirical error and a lower generalization bound than previous works
with the fixed input.

We conduct extensive experiments on several real-world datasets. The
experiments show that our approach has a better prediction performance than
state-of-the-art methods, even using shallow network structures with a smaller
number of parameters.

##  2 Related work

Matrix factorization (MF) is the most popular collaborative filtering
approach. MF uses the dot product of the user and item representations to
estimate their interaction [16, 30, 17]. To improve performance, neural
networks have been involved in learning representations and modeling
interactions [3, 10, 7, 11, 5, 37, 12]. NeuMF [11] takes the user and item IDs
as the inputs and uses embedding layers to create representations. Two joint
user-item representations are then learned, one by the element-wise product of
the user and item representations and the other one by applying an MLP to
their concatenation. Finally, another MLP takes the two joint representations
and predicts the final rating. DeepCF [5] makes two changes to the NeuMF to
learn the representations. First, DeepCF uses user/item interaction vectors as
the input, instead of IDs. Second, before applying the element-wise product,
it uses several MLPs on top of the user and item representations. DMF [37]
uses explicit ratings as the input to a set of MLPs to learn the
representations. The user-item interactions are modeled with the dot product
of the representations. ConvNCF [12] learns user and item representations by
connecting user/item IDs to the embedding layers and applies convolutional
neural networks to their outer product to predict the ratings. Autorec is an
autoencoder-based CF method that reconstructs the known values of the
interaction vectors to predict unknown ones [24].

Autoencoders have been used extensively in hybrid collaborative filtering to
utilize various sources of side information for the users and items, such as
users’ age, users’ occupation, and items’ title. [18, 34, 28, 4, 39, 19, 27].
These methods try to reconstruct the input vectors (fixed to the interaction
vector and side information) to learn representations for the prediction task.

The focus of these previous works is on designing complicated network
structures to learn high-quality representations. A recent work [2] uses a
different approach and focuses on the quality of the output ratings in
collaborative filtering. It simultaneously learns the model parameters and
edits the overly personalized ratings using data debugging techniques.

All the previous works fix the input to either the interaction vector or the
IDs. On the contrary, we focus on the input layer and its role in learning
better representations.

##### Notations.

We denote the sparse interaction matrix by $\mathbf{R}\in\mathbb{R}^{m\times
n}$, where $m$ and $n$ are the number of users and items, respectively,
$R_{jk}>0$ is the interaction value of the user $j$ on the item $k$, and
$R_{jk}=0$ means the interaction is unknown. The goal is to predict the
unknown interactions in $\mathbf{R}$. The $i$th row of a matrix $\mathbf{H}$
is shown by $\mathbf{H}_{i,:}$ and the $j$th column is shown by
$\mathbf{H}_{:,j}$.

##  3 Neural collaborative filtering

Since our proposed method uses the neural collaborative filtering (NCF)
framework, we review NCF in this section. In NCF framework, as depicted in
Fig. 1(a), the interaction of the users on items is predicted by an MLP, which
takes the user and item representations as the input.

Let us denote the $j$th user representation by
$\smash{\mathbf{z}^{u}_{j}\in\mathbb{R}^{d_{u}}}$ and the $k$th item
representation by $\smash{\mathbf{z}^{i}_{k}\in\mathbb{R}^{d_{i}}}$. These two
representations are concatenated to give the user-item representation, which
is denoted by
$\smash{\mathbf{z}_{jk}=[\mathbf{z}^{u}_{j},\mathbf{z}^{i}_{k}]\in\mathbb{R}^{d_{u}+d_{i}}}$.
Then, an MLP, denoted by $f()$ , takes $\mathbf{z}_{jk}$ and predicts the
interaction. The objective function is defined as:

$E_{\text{NCF}}(\mathbf{z}_{jk},\boldsymbol{\theta}^{ui})=\frac{1}{mn}\sum_{j=1}^{m}\sum_{k=1}^{n}L(R_{jk},f(\mathbf{z}_{jk};\boldsymbol{\theta}^{ui}))$
(1)

where $\boldsymbol{\theta}^{ui}$ contains all the weight matrices of the MLP
$f()$. Minimization of the loss function $L()$ should lead to the match
between the observed and predicted interactions. Both regression [11] and
classification (binary cross-entropy) [5] losses have been used in the
literature, which are defined as follows:

$L_{\text{reg}}=||R_{jk}-\hat{R}_{jk}||^{2},\qquad\qquad
L_{\text{bce}}=-(R_{jk}\log\hat{R}_{jk}+(1-R_{jk})\log(1-\hat{R}_{jk})),$ (2)

where $\hat{R}_{jk}=f(\mathbf{z}_{jk};\boldsymbol{\theta}^{ui})$ is the
predicted interaction.

The focus of our paper is on learning better user and item representations,
which play an important role in the final performance of the recommendation
systems. In the rest of this section, we explain how these representations are
learned with the ID and interaction vector as the input.

|  |
---|---|---
(a) | (b) | (c)
Figure 1:  (a) NCF applies MLP to the concatenation of the user and item
representations to predict the interaction. (b) Representation learning with
the ID as the input. (c) Representation learning with the interaction vector
as the input.

###  3.1 NCF with the ID as the input

Figure 1(b) shows how IDs are mapped to the low-dimensional representations.
First, the user ID is converted to a one-hot-encoding vector of size $m$
(number of users). For user $j$, this vector is denoted by
$\mathbf{I}^{u}_{j}\in\mathbb{R}^{m}$, where the $j$th entry of
$\mathbf{I}^{u}_{j}$ is $1$ and the rest are $0$. Then, this vector is
multiplied by a user embedding matrix
$\smash{\mathbf{E}^{u}\in\mathbb{R}^{m\times d_{u}}}$ to give us the $d_{u}$
dimensional representation vector, i.e.,
$\smash{\mathbf{z}^{u}_{j}=\mathbf{I}^{u}_{j}\mathbf{E}^{u}}$. We can write
the $k$th item representation in the same way as
$\smash{\mathbf{z}^{i}_{k}=\mathbf{I}^{i}_{k}\mathbf{E}^{i}}$, where
$\mathbf{I}^{i}_{k}\in\mathbb{R}^{1\times n}$, and
$\smash{\mathbf{E}^{i}\in\mathbb{R}^{n\times d_{i}}}$ is the item embedding
matrix. The objective function of the NCF with the ID as the input is defined
as:

$\begin{split}&E_{\text{NCF}}(\mathbf{E}^{u},\mathbf{E}^{i},\boldsymbol{\theta}^{ui})=E_{\text{NCF}}(\mathbf{z}_{jk},\boldsymbol{\theta}^{ui})=\frac{1}{mn}\sum_{j=1}^{m}\sum_{k=1}^{n}L(R_{jk},f(\mathbf{z}_{jk};\boldsymbol{\theta}^{ui}))\\\
&\text{s.t.}\quad\mathbf{z}_{jk}=[\mathbf{z}^{u}_{j},\mathbf{z}^{i}_{k}],\quad\mathbf{z}^{u}_{j}=\mathbf{I}^{u}_{j}\mathbf{E}^{u},\quad\mathbf{z}^{i}_{k}=\mathbf{I}^{i}_{k}\mathbf{E}^{i}.\end{split}$
(3)

###  3.2 NCF with the interaction vector as the input

Fig. 1(c) shows how the interaction vector as the input works. First, for the
$j$th user, the $j$th row of the interaction matrix $\mathbf{R}$ is extracted.
An MLP, denoted by $\mathbf{g}^{u}()$, takes this vector and generates the
user representation:

$\mathbf{z}^{u}_{j}=\mathbf{g}^{u}(\mathbf{R}_{j,:};\boldsymbol{\theta}^{u}_{L})=\sigma(\dots\sigma(\sigma(\mathbf{R}_{j,:}\mathbf{P}^{u})\mathbf{W}^{u}_{2})\dots\mathbf{W}^{u}_{L}),$

where $L$ is the number of layers, $\sigma()$ is an activation function,
$\smash{\boldsymbol{\theta}^{u}_{L}=\\{\mathbf{P}^{u},\mathbf{W}^{u}_{2},\dots,\mathbf{W}^{u}_{L}\\}}$
contains the weights of all layers, and $\mathbf{P}^{u}$ and
$\mathbf{W}^{u}_{l}$ are the weight matrices of the first and $l$th layers
($l>1$), respectively. We can write the $k$th item representation in the same
way as
$\smash{\mathbf{z}^{i}_{k}=\mathbf{g}^{i}(\mathbf{R}_{:,k};\boldsymbol{\theta}^{i}_{L})}$.
Note that for simplicity, we assume both $\mathbf{g}^{u}()$ and
$\mathbf{g}^{i}()$ have $L$ layers and we ignore the biases. We can write the
objective function as:

$\begin{split}&E_{\text{NCF}}(\boldsymbol{\theta}^{u}_{L},\boldsymbol{\theta}^{i}_{L},\boldsymbol{\theta}^{ui})=E_{\text{NCF}}(\mathbf{z}_{jk},\boldsymbol{\theta}^{ui})=\frac{1}{mn}\sum_{j=1}^{m}\sum_{k=1}^{n}L(R_{jk},f(\mathbf{z}_{jk};\boldsymbol{\theta}^{ui}))\\\
&\text{s.t.}\quad\mathbf{z}_{jk}=[\mathbf{z}^{u}_{j},\mathbf{z}^{i}_{k}],\quad\mathbf{z}^{u}_{j}=\mathbf{g}^{u}(\mathbf{R}_{j,:};\boldsymbol{\theta}^{u}_{L}),\quad\mathbf{z}^{i}_{k}=\mathbf{g}^{i}(\mathbf{R}_{:,k};\boldsymbol{\theta}^{i}_{L})\end{split}$
(4)

where
$\boldsymbol{\theta}=[\boldsymbol{\theta}^{u}_{L},\boldsymbol{\theta}^{i}_{L},\boldsymbol{\theta}^{ui}]$
contains all parameters of the $\mathbf{g}^{u}(),\mathbf{g}^{i}()$, and $f()$
MLPs, respectively.

###  3.3 ID versus interaction vector as the input

Table 2 of Dong et al. [5] and Table 2 of Xue et al. [37] show that DeepCF
(interaction vector as the input) outperforms NeuMF (ID as the input) in four
different datasets. Our experiments also confirm these results. We also found
that DeepCF converges faster than NeuMF. To understand the reason of
performance difference between ID and interaction vectors, we examine the toy
interaction matrix of Fig. 2. Here, there are three users and four items, $1$
means implicit feedback and $0$ means unknown feedback.

The main idea of collaborative filtering is to use the patterns in the past
interactions of the users and items to predict future interactions. In Fig. 2,
we can see that the past interactions of user#1 and user#2 are similar, as
they have both interacted with item#1 and item#2. However, there is no common
item in the past interactions of the user#2 and user#3. In CF, we expect
user#1 and user#2 to follow the same pattern, but not much can be said about
the similarity of user#2 and user#3. Let us see how this information appears
in the input spaces created by the IDs and interaction vectors.

In the case of ID as the input, each user ID is converted to a one-hot-
encoding of length four. So the Euclidean distance between each pair of users
is $\sqrt{2}$. In other words, all users are at the same distance from each
other.

In the case of the interaction vector as the input, each row of the
interaction matrix of Fig. 2 corresponds to the input vector of each user. We
can see that the Euclidean distance between the input vectors of the users #1
and #2 (similar past interactions) is $1$, while the distance between the
input vectors of users #2 and #3 (dissimilar or unrelated past interactions)
is $\sqrt{3}$. This example shows that the similarity is preserved (to some
extent) in the input space created by the interaction vectors, which is the
reason that NCF with interaction vector as input outperforms NCF with ID as
input.

In the rest of this script, we focus on NCF with the interaction vectors as
the input and how we can improve its performance.

| item#1 | item#2 | item#3 | item#4
---|---|---|---|---
user#1 | 1 | 1 | 1 | 0
user#2 | 1 | 1 | 0 | 0
user#3 | 0 | 0 | 0 | 1
Figure 2: Toy example. Interaction matrix of three users and four items, where
$1$ is observed implicit feedback and $0$ is unknown feedback.

##  4 Proposed method: learning the inputs in neural
collaborative filtering

We explain our proposed approach using the NCF architecture introduced in
Section 3. This makes our equations simpler and enable us to focus on our main
idea of learning the inputs better. In the supplementary material in Section
7, we change the architecture to the more complicated NCF architectures of
CFNet [5] and show that our arguments and theoretical analysis remain valid.
Our experiments confirm that our approach improves the results of the previous
works, regardless of the specific type of NCF architecture.

We motivate the idea of learning the inputs by explaining what the MLPs in Eq.
(4) learn from the interaction vectors. While there are several nonlinear
layers in $\mathbf{g}^{u}()$ and $\mathbf{g}^{i}()$, we focus on understanding
the output of the first layer, which gives us a good intuition about how the
interaction vectors are used.

Consider the first fully connected layer of the $\mathbf{g}^{u}()$, with the
weight matrix $\mathbf{P}^{u}$. Assuming linear activation function, the
output of this layer can be written as
$\mathbf{y}^{u}_{j}=\mathbf{R}_{j,:}\mathbf{P}^{u}=\sum_{l=1}^{n}\mathbf{R}_{j,l}\mathbf{P}^{u}_{l,:}$.
Note that $\mathbf{P}^{u}\in\mathbb{R}^{n\times d_{u}}$ contains a $d_{u}$
dimensional vector for each of the items. In other words, we can consider
$\mathbf{P}^{u}$ as an (implicit) item embedding matrix. _The user (initial)
representation $\mathbf{y}^{u}_{j}$ is the weighted sum of the embedding
vectors of the items which are interacted by the $j$th user._ Similarly for
the items, the weights of the first layer of $\mathbf{g}^{i}()$, denoted by
$\mathbf{P}^{i}\in\mathbb{R}^{m\times d_{i}}$, can be considered as an
implicit user embedding layer, and _the item (initial) representation
$\mathbf{y}^{i}_{k}$ is the weighted sum of the embedding vectors of the users
who interacted with the $k$th item._ In previous works, the weights in the
”weighted sum of embedding vectors” are fixed to the interaction values
(ratings or ones) of the users on the items. We will show that fixing these
weights limits the power of the representations and we should consider them as
the learnable parameters.

Previous works rely on the nonlinear activation functions, making networks
deep, and creating multiple user and item representations (from different
network architectures) to make powerful representations. On the contrary, our
approach learns the Input and Parameters of NCF simultaneously, and is denoted
by InP-NCF in the rest of the paper.

Next, we define our objective function formally. For the $j$th user, we define
the set $N_{j}=\\{l|R_{jl}\neq 0,1\leq l\leq n\\}$, which contains the index
of all the items interacted by the $j$th user. We define the set of user input
vectors as $\mathbf{U}\in\mathbb{R}^{m\times n}$, where $\mathbf{U}_{j,:}$ is
the input vector of the $j$th user. We learn $U_{jl}$ if $l\in N_{j}$ and fix
it to $0$ otherwise. The output of the first layer of the network for the
$j$th user is computed as
$\mathbf{y}_{j}=\sigma(\mathbf{U}_{j,:}\mathbf{P}^{u})=\sigma(\sum_{l\in
N_{j}}U_{jl}\mathbf{P}^{u}_{l,:})$, where we consider $U_{jl}$ as a learnable
parameter, as opposed to the previous works that fix it to the interaction
value of the $j$th user on the $l$th item. For the $k$th item, we define the
set $N_{k}=\\{l|R_{lk}\neq 0,1\leq l\leq m\\}$, which contains the index of
all the users who interacted with the $k$th item. We also define the set of
item input vectors as $\mathbf{V}\in\mathbb{R}^{n\times m}$. We learn $V_{kl}$
if $l\in N_{k}$ and fix it to $0$ otherwise. Our objective function is defined
as follows:

$E_{\text{InP-
NCF}}(\boldsymbol{\theta},\mathbf{U},\mathbf{V})=E_{\text{NCF}}(\boldsymbol{\theta}^{u}_{L},\boldsymbol{\theta}^{i}_{L},\boldsymbol{\theta}^{ui})\
\text{s.t.}\
\begin{cases}\mathbf{z}^{u}_{j}=\mathbf{g}^{u}(\mathbf{y}^{u}_{j};\boldsymbol{\theta}^{u}_{L-1}),\
\mathbf{y}^{u}_{j}=\sigma(\sum_{l\in N_{j}}U_{jl}\mathbf{P}^{u}_{l,:})\\\
\mathbf{z}^{i}_{k}=\mathbf{g}^{i}(\mathbf{y}^{i}_{k};\boldsymbol{\theta}^{i}_{L-1}),\
\mathbf{y}^{i}_{k}=\sigma(\sum_{l\in
N_{k}}V_{kl}\mathbf{P}^{i}_{l,:})\end{cases}$ (5)

where
$\boldsymbol{\theta}=[\boldsymbol{\theta}^{u}_{L-1},\mathbf{P}^{u},\boldsymbol{\theta}^{i}_{L-1},\mathbf{P}^{i},\boldsymbol{\theta}^{ui}]$
contains all the parameters of the three MLPs, $\mathbf{P}^{u}$ and
$\mathbf{P}^{i}$ contain the weights of the first layer of the user and item
MLPs, respectively, and $\mathbf{y}^{u}_{j}$ and $\mathbf{y}^{i}_{k}$ are the
output of the first layer of the user and item MLPs, respectively. By setting
$\smash{U_{jl}=R_{jl}}$ and $\smash{V_{kl}=R_{lk}}$, our objective in Eq. (5)
becomes equivalent to the previous works’ objective function in Eq. (4).

While both $\mathbf{U}$ and $\mathbf{V}$ contain $m\times n$ entries, most
entries are $0$ because of the sparsity of the interaction matrix and don’t
get updated during training. We learn $U_{jk}$ and $V_{kj}$ if user $j$
interacted with item $k$. So the total number of learnable variables in
$\mathbf{U}$ and $\mathbf{V}$ is twice the number of observed interactions,
which is insignificant compared to the number of network parameters in large
datasets. We give more details about the number of model and input parameters
in the experimental results in Section. 5 and in Table 1.

We apply end-to-end optimization to learn the input and model parameters
jointly. We found that the model parameters overfit faster than the input
parameters. As we will show in our experiments, we can improve results by
post-input optimization. In other words, at the end of the joint optimization,
we fix the network parameters and continue learning the input parameters.

###  4.1 Our approach from the lens of the graph neural networks

We first show that neural collaborative filtering can be formulated as a graph
convolutional network with a one-layer propagation and a deep message
aggregation function. Then we show how our input-learning approach works and
what learning the inputs means in this context.

Matrix completion can be cast as a link prediction problem on a bipartite
user-item graph [31, 35, 29, 38, 14]. This graph contains $m$ user nodes and
$n$ item nodes. An edge between a user node $j$ and item node $k$ exists if
$R_{jk}\neq 0$. The graph-based methods extract node features using methods
such as graph convolutional neural networks (GCNs) and then map them to the
interaction value.

NCF has all the three main components of the GCNs-based recommendation systems
methods:

  1. 1.

Node embeddings. In NCF, each row of the matrices $\mathbf{P}^{u}$ and
$\mathbf{P}^{i}$ contains the embeddings of the user and item nodes,
respectively.

  2. 2.

Propagation layer. This layer defines how the messages between the nodes are
constructed and how they get aggregated. In NCF, for a connected user-item
pair $(j,k)$, the message from user $j$ to item $k$ is the user’s embedding
$\mathbf{P}^{u}_{j,:}$, and the message from item $k$ to user $j$ is the
item’s embedding $\mathbf{P}^{i}_{k,:}$. To understand the message aggregation
process in NCF, let us divide it into two steps. In the first step, the
weighted sum of the messages is computed and followed by an activation
function:

$\mathbf{y}^{u}_{j}=\sigma(\sum_{l\in
N_{j}}R_{jl}\mathbf{P}^{i}_{l,:})\quad\mathbf{y}^{i}_{k}=\sigma(\sum_{l\in
N_{k}}R_{lk}\mathbf{P}^{u}_{l,:}).$ (6)

As the second step, NCF applies the last $L-1$ layers of the
$\mathbf{g}^{u}()$ and $\mathbf{g}^{i}()$ to the $\mathbf{y}^{u}_{j}$ and
$\mathbf{y}^{i}_{k}$, respectively, to get more complicated representations.
The GCNs-based methods use different variants of the Eq. (6) as the
aggregation function [31, 35, 29, 38, 14].

  3. 3.

Prediction model. NCF uses an MLP $f()$ to map the user and item
representation to the final interaction value. Dot-product of the user and
item representation is one of the popular prediction models in previous GCNs-
based works [35, 29, 14].

The main difference between NCF and GCNs is how they use neural networks to
learn better representations: GCNs use higher-order propagations, while NCF
relies on the power of the MLPs $\mathbf{g}^{u}()$ and $\mathbf{g}^{i}()$.

Let us explain how our approach works in this context. InP-NCF improves the
first step of the message aggregation of NCF: instead of fixing the weights of
each message to the interaction values $R_{jl}$ and $R_{lk}$, InP-NCF learns
these weights, which leads to learning better representations.

Using the explicit ratings in learning better representations has been tried
in graph-based recommendation systems. Ying et al. [38] learns a specific
transformation (weight matrix) for each rating level, resulting in edge-type
specific messages. Fan et al. [6] learns a specific embedding vector for each
rating level and uses them in learning the item representations. In both
methods, similar ratings get similar embeddings or transformation functions,
even if the ratings belong to different users or items. InP-NCF considers each
rating as a learning parameter and let the similar ratings of different
users/items converge to different places. This makes the model learned by InP-
NCF more powerful.

###  4.2 Attention mechanisms in learning the weights

The goal here is to explain the difference between our approach InP-NCF and
the attention-based methods GAT [33] and NAIS [13].

GAT [33] showed that assigning different importances to nodes of the same
neighborhood can lead to better results in GCNs. GAT uses self-attention to
find the weights in computing the weighted sum in aggregating the neighbor
messages. In recommendation system literature, NAIS [13], uses attention
mechanisms to give different weights to the item embeddings in computing the
users’ initial representations.

Let us explain the advantages of the InP-NCF. In many recommendation system
tasks, we have access to the explicit interactions, which already determine
the importance of the neighbors to some extent. In other words, if
$R_{jk}>R_{jl}$, then item $k$ is more favorable for user $j$. Our InP-NCF
approach uses this information by initializing the weights with the user and
item interactions. GAT and NAIS do not use this information in defining the
weights. Also, since the weights are free parameters in InP-NCF and we can
initialize them form the given interaction values, we can prove that InP-NCF
achieves a smaller empirical error and a better generalization bound than NCF
(next subsection). Since weights in attention-based methods are a function of
the embeddings, we can not initialize them directly with the ratings.

Here is a detailed explanation of the differences between NAIS and our
approach:

  * •

NAIS relies on item IDs as the input and focuses on the item-item similarity
CF models to predict the users’ interests. Our work uses item and user
interaction vectors as the inputs, learns separate user and item
representations, and uses user-item CF to predict the score. In other words,
the two methods use completely different structures and follow different CF
models.

  * •

Since NAIS focuses on the item-item similarity, the weights are only defined
for the ”items” which are rated by the users. There is no easy way to define
the weights for the ”users” who rated the items. Our approach defines weights
for users and items separately.

  * •

The items’ weights in NAIS are defined based on the similarity to the _target_
item. In our case, both user and item weights are _free variables._

  * •

Finally, as we will show in experiments of Table 3, InP-NCF achieves better
results than NAIS.

###  4.3 Generalization bound of InP-NCF versus NCF

In this section, we first define the basic elements of the statistical
learning theory in collaborative filtering. Then, we show that we can compare
generalization bound of the INP-NCF and NCF based on their empirical errors.
More details about these definitions can be found in [25].

##### The collaborative filtering model and the hypothesis class.

In collaborative filtering (matrix completion), the ultimate goal is to
predict the interaction value for a pair of users and items. The assumption is
that we have has seen all users and items and a small subset of their
interactions in the training set. In other words, there would be no new user
or item in the test set. The prediction model of the latent factor-based
collaborative filtering methods can be written as:

$\hat{R}_{jk}=f(\mathbf{z}_{jk};\boldsymbol{\theta}^{ui})\quad\text{s.t.}\quad\mathbf{z}_{jk}=\mathbf{m}(\mathbf{z}^{u}_{j},\mathbf{z}^{i}_{k}),\
\mathbf{z}^{u}_{j}=\mathbf{I}^{u}_{j}\mathbf{Z}^{u},\
\mathbf{z}^{i}_{k}=\mathbf{I}^{i}_{k}\mathbf{Z}^{i},$ (7)

where $\mathbf{I}^{u}_{j}$ and $\mathbf{I}^{i}_{k}$ are the one-hot encoding
vectors of the $j$th user and $k$th item and $\mathbf{m}()$ is a fusion
function that takes two representations and returns a joint one. The input to
this model is the user and item IDs and the parameters are
$\boldsymbol{\theta}^{ui}$, $\mathbf{Z}^{u}$, and $\mathbf{Z}^{i}$. In
statistical learning theory, the model of Eq. (7) is called the hypothesis
class. Different choices for the $f()$ and the fusion function $\mathbf{m}()$
lead to different hypothesis classes. In matrix factorization, $\mathbf{m}()$
is an element-wise product and $f()$ is a summation. In NCF, $\mathbf{m}()$ is
concatenation and $f()$ is an MLP. Each specific set of the parameters
corresponds to a specific hypothesis.

##### The learning algorithm.

The CF methods differ on the way they learn the parameters of the model in Eq.
(7). A learning algorithm, denoted by $\mathcal{A}$, takes the i.i.d.
observations $\mathcal{D}$ and generates a specific set of parameters, which
creates a hypothesis. In CF, the learning algorithm returns:
$\boldsymbol{\theta}^{ui},\mathbf{Z}^{u},\mathbf{Z}^{i}=\mathcal{A}(\mathcal{D})$.

The latent factor-based CF methods in the literature, including NCF and INP-
NCF, are learning algorithms. These methods use different training strategies,
sets of parameters, models, and objective functions. At the end, all these
methods return a hypothesis from the hypothesis class of Eq. (7), i.e., they
return the user and item representations and parameters of the $f()$.

While a learning algorithm must return parameters of a hypothesis, it is not
limited to use only those parameters in training. InP-NCF and NCF (as learning
algorithms) use the user and item MLPs $\mathbf{g}^{u}()$ and
$\mathbf{g}^{i}()$ to learn better representations from interaction vectors or
learnable inputs during the training. But, all these parameters are discarded
afterward.

Let us mention that in addition to collaborative filtering, there exist other
machine learning areas where the learning algorithm uses more parameters than
the hypothesis space’s parameters. One example is hyper-parameter optimization
(HPO) [26, 36]. In HPO, the learning algorithm learns two sets of parameters,
one set to predict the target and another set to predict the best hyper-
parameters (such as leanring rate and dropout ratio). But, the output of the
learning algorithm is always the parameters of the hypothesis (prediction
model).

##### The empirical risk.

For each hypothesis, this risk is defined based on the difference between the
predicted interactions and the true interactions on a training set (a set of
observations from the true distribution). For a particular choice of the
parameters $\boldsymbol{\theta}^{ui}$, $\mathbf{Z}^{u}$, and $\mathbf{Z}^{i}$,
the empirical risk is defined as:

$R_{emp}(\boldsymbol{\theta}^{ui},\mathbf{Z}^{u},\mathbf{Z}^{i})=\frac{1}{mn}\sum_{j=1}^{m}\sum_{k=1}^{n}L(R_{jk},\hat{R}_{jk}),$
(8)

where $\hat{R}_{jk}$ is defined in Eq. (7).

##### The generalization bound

The expected risk $E^{exp}$ (also called actual risk) is the expectation of
the test error for a hypothesis. Since we do not have access to the true data
distribution, we can not compare the hypothesizes directly using $E^{exp}$.
Therefore, the generalization bound is the upper bound on $E^{exp}$ and
defined as follows [32]:

$R^{emp}(\boldsymbol{\theta}^{ui},\mathbf{Z}^{u},\mathbf{Z}^{i})+C(H(\text{hypothesis
space}),N),$ (9)

where $R^{emp}$ is the empirical risk (error on a set of observations), $C()$
is a cost function, $H()$ is complexity of the hypothesis space, and $N$ is
the number of training samples. Here, we focus on the VC dimension-based
bounds, where complexity is a function of the number of parameters of the
model. The smaller the number of parameters the tighter this bound. We can
make bound tighter by making the representations $\mathbf{Z}^{u}$ and
$\mathbf{Z}^{i}$ low-dimensional and making $f()$ a shallow function.

##### Our main theorem

######  Theorem 1.

$\mathcal{A}_{\text{InP-NCF}}(\mathcal{D})$ achieves a generalization bound
smaller than or equal to the $\mathcal{A}_{\text{NCF}}(\mathcal{D})$.

###### Proof.

Let us assume the learning algorithms return the following parameters at the
convergence:

${\boldsymbol{\theta}^{ui}}^{*},{\mathbf{Z}^{u}}^{*},{\mathbf{Z}^{i}}^{*}=\mathcal{A}_{\text{InP-
NCF}}(\mathcal{D}),\qquad\qquad\hat{\boldsymbol{\theta}^{ui}},\hat{\mathbf{Z}^{u}},\hat{\mathbf{Z}^{i}}=\mathcal{A}_{\text{NCF}}(\mathcal{D}).$
(10)

Generalization bound is defined at the right side of Eq. (9). The theorem
holds because: 1) $C()$ is determined based on the complexity of the
hypothesis space of Eq. (7), is independent of the learning algorithms, and is
the same for both $\mathcal{A}_{\text{InP-NCF}}$ and
$\mathcal{A}_{\text{NCF}}$, and 2) as we will prove in Lemma 4, we have:

$R^{\text{emp}}_{\text{Inp-
NCF}}=R^{\text{emp}}({\boldsymbol{\theta}^{ui}}^{*},{\mathbf{Z}^{u}}^{*},{\mathbf{Z}^{i}}^{*})\leq
R^{\text{emp}}_{\text{NCF}}=R^{\text{emp}}(\hat{\boldsymbol{\theta}^{ui}},\hat{\mathbf{Z}^{u}},\hat{\mathbf{Z}^{i}}).$
(11)

∎

We use the following three lemmas to prove the inequality of the Eq. (11).

######  Lemma 2.

At convergence, the training error of the learning algorithms is equal to the
empirical error of their returned hypothesis:

$R^{\text{emp}}_{\text{Inp-NCF}}=E_{\text{InP-
NCF}}(\boldsymbol{\theta}^{*},\mathbf{U}^{*},\mathbf{V}^{*}),\quad\quad
R^{\text{emp}}_{\text{NCF}}=E_{\text{NCF}}(\hat{\boldsymbol{\theta}}).$ (12)

###### Proof.

The proof is in the supplementary material. ∎

######  Lemma 3.

Training error of InP-NCF in Eq. (5), which uses alternating optimization
(explained in the supplementary material), is smaller than or equal to the NCF
in Eq. (4), i.e., $E_{\text{InP-
NCF}}(\boldsymbol{\theta}^{*},\mathbf{U}^{*},\mathbf{V}^{*})\leq
E_{\text{NCF}}(\hat{\boldsymbol{\theta}})$.

###### Proof.

The proof is in the supplementary material. ∎

######  Lemma 4.

At convergence, empirical error of the hypothesis returned by the InP-NCF is
smaller than or equal to the one returned by NCF:

$R^{\text{emp}}_{\text{Inp-NCF}}\leq R^{\text{emp}}_{\text{NCF}}$ (13)

###### Proof.

The lemma holds because 1) from Lemma 2, we have that the value of the
empirical error is the same as the training error, and 2) from Lemma 3, we
have that training error of the InP-NCF is smaller than the training error of
the NCF. ∎

In the supplementary material section 7, we have put the details of the
equations and discussions on how to achieve the exact form of generalization
bound.

##  5 Experiments

###  5.1 Experimental setup

##### Datasets.

For rating prediction, we use four datasets: 1) ml100k [8] dataset, which
contains $100\,000$ ratings from around $1\,000$ users on $1\,600$ movies, 2)
ml1m [8] dataset, which contains $1$ million ratings of around $6\,000$ users
on $4\,000$ movies, 3) Amazon review data (Grocery and Gourmet Food) [9]
dataset, which contains $508\,800$ Amazon’s Grocery and Gourmet Food product
review from $86\,400$ users on $108\,500$ items, and 4) Ichiba dataset, which
contains $1.5$ million Rakuten
Ichiba111https://rit.rakuten.com/data_release/’s product review from
$324\,000$ users on $294\,000$ items. In each of the datasets, the
ratings/reviews are integer numbers between $1$ and $5$.

For each dataset, we randomly select $80\%$ of the ratings as the training
set, $10\%$ as the validation set, and $10\%$ as the test set. We repeat the
process three times to create three training/validation/test sets. For each
evaluation metric, we report the mean of each method on these three sets. The
supplementary material section 7 contains the standard deviation of the
methods and a set of additional experiments that are not listed here.

For the implicit feedback prediction, we use two datasets: 1) ml1m [8]
dataset, with the same number of users, items, and interactions as the one in
the rating prediction task and 2) Amazon music (AMusic)[9], which contains
$1\,700$ users, $13\,000$ items, and $46\,000$ ratings. Implicit feedback is
achieved by turning all ratings to $1$. Similar to [5, 11], we use the leave-
one-out evaluation, where the latest interaction of each user is held-out in
the test set and the rest are considered as the training set.

Table 1: Number of neural network (NN) and input parameters in two network architectures used in Table 2 and Table 4. | $\mathbf{g}^{u},\mathbf{g}^{i},f=[1,1,2]$ | $\mathbf{g}^{u},\mathbf{g}^{i},f=[3,3,4]$
---|---|---
| ml100k | ml1m | Ichiba | ml100k | ml1m | Ichiba
NN | $283K$ | $3.0M$ | $61.9M$ | $1.7M$ | $11.5M$ | $62.0M$
Input | $160K$ | $1.6M$ | $2.4M$ | $160K$ | $1.6M$ | $2.4M$

##### Evaluation metrics.

We report the root mean square error (RMSE) and average precision to evaluate
the rating prediction performance. In RMSE we measure the error between the
predicted and actual rating. In precision, for each user, we retrieve the top
p% of the items with the highest predicted ratings and compare them with the
actual top p% of items. We compute the precision for each user and report the
average score.

We report Normalized Discounted Cumulative Gain (NDCG) and Hit Ratio (HR) to
evaluate the implicit feedback prediction performance. We follow the same
protocols as [5, 11] and truncate the rank list at $10$ for both metrics. HR
measures whether the actual test item exists in the top-ranked list. NDCG is a
measure of ranking quality and gives higher scores to the hits at top
positions in the ranked list. We compute the HR and NDCG for each user and
report the average score.

We have put the details and equations of all the evaluation metrics in the
supplementary material section 7.

##### Implementation details.

We implemented our method using Keras with TensorFlow 2 backend. We ran all
the experiments on a $12$GB GPU. For each method, we tried a set of activation
functions (ReLU, SELU, and TanH), a range of learning rates and regularization
parameters from $10^{-1}$ to $10^{-5}$, a set of optimizers (Adam, SGD, and
RMSprop), and picked the one that works best. The supplementary material
section 7 contains the details of the experimental setting.

##### Number of network and input parameters.

In our tables, the notation $\mathbf{g}^{i},\mathbf{g}^{u},f=[x,y,z]$ means
that the three MLPs $\mathbf{g}^{i}$, $\mathbf{g}^{u}$, and $f$ contain $x$,
$y$, and $z$ hidden layers, respectively. Table 1 contains the number of
network and input parameters of two network architectures in the three
datasets. We call the network with smaller parameters
($\mathbf{g}^{i},\mathbf{g}^{u},f=[1,1,2]$) shallow and the one with the
larger number of parameters ($\mathbf{g}^{i},\mathbf{g}^{u},f=[3,3,4]$) deep.

The number of network parameters is mainly determined by the size of the first
layer of $\mathbf{g}^{u}$ and $\mathbf{g}^{i}$, which we called the implicit
embedding layer. The size of this layer is proportional to the number of users
and items in the dataset. We can see in Table 1 that the number of neural
network parameters in Ichiba is significantly more than ml1m. The reason is
that the number of users and items in Ichiba is around $60$ times larger than
ml1m. We can also see that the number of inputs is always smaller than the
network parameters. The difference between the input and network parameters is
huge in Ichiba. This indicates that the main gain of our model is not from the
number of parameters, but from the better generalization with learned input

###  5.2 Experimental results

##### Rating prediction: learning the input improves the performance.

In our experiments, NCF stands for neural collaborative filtering with the
fixed interaction vector as the input, where the objective function can be
found in Eq. (4) and the architecture can be found in Fig. 1. Our method is
denoted by InP-NCF.

We try two different values to initialize the inputs: 1) we use the ratings as
the input and denote the methods NCF (R) and InP-NCF (R) and 2) we turn all
ratings into $1$ (making them implicit) and denote the methods by NCF (I) and
InP-NCF (I). These changes do not affect the outputs and in both cases the
goal is to predict the ratings.

In Table 2, we compare RMSE and precision of InP-NCF with NCF on ml100k, ml1m,
and Ichiba datasets. By comparing NCF (R) with InP-NCF (R) and NCF (I) with
InP-NCF (I), we can see that learning the input consistently improves the
results and gives lower RMSE and higher precision.

The results of Table 2 show that, even when we fix the inputs, explicit
ratings are not always the best inputs for NCF models. In multiple cases,
specifically in the Ichiba dataset, NCF with the implicit feedback as the
input outperforms NCF with the ratings as the input.

Note that our objective function is highly nonconvex so different input
initializations will lead to different results. While in both ml1m and ml100k
datasets explicit rating initialization leads to slightly better results, it
is in the Ichiba dataset where implicit feedback provides better results.

Table 2: Rating prediction. We compare InP-NCF (learning the input and
parameters) and NCF (fixed input). Our approach consistently achieves better
results. We report the mean of three runs. Supplementary material section 7
contains standard variation of methods and more results.

| RMSE
---|---
| $\mathbf{g}^{u},\mathbf{g}^{i},f=[1,1,2]$ | $\mathbf{g}^{u},\mathbf{g}^{i},f=[3,3,4]$
| ml100k | ml1m | Ichiba | ml100k | ml1m | Ichiba
NCF (R) | $0.903$ | $0.858$ | $0.883$ | $0.897$ | $0.856$ | $0.884$
InP-NCF (R) | $\mathbf{0.892}$ | $\mathbf{0.845}$ | $\mathbf{0.871}$ | $\mathbf{0.894}$ | $\mathbf{0.845}$ | $\mathbf{0.873}$
NCF (I) | $0.905$ | $0.860$ | $0.875$ | $0.896$ | $0.854$ | $0.874$
InP-NCF (I) | $\mathbf{0.892}$ | $\mathbf{0.846}$ | $\mathbf{0.867}$ | $\mathbf{0.894}$ | $\mathbf{0.844}$ | $\mathbf{0.863}$

| precision
---|---
| $\mathbf{g}^{u},\mathbf{g}^{i},f=[1,1,2]$ | $\mathbf{g}^{u},\mathbf{g}^{i},f=[3,3,4]$
| ml100k | ml1m | Ichiba | ml100k | ml1m | Ichiba
NCF (R) | $\mathbf{69.8\%}$ | $69.4\%$ | $79.5\%$ | $69.3\%$ | $70\%$ | $79.4\%$
InP-NCF (R) | $\mathbf{69.8\%}$ | $\mathbf{70.3\%}$ | $\mathbf{79.8\%}$ | $\mathbf{70.0\%}$ | $\mathbf{70.4\%}$ | $\mathbf{79.6\%}$
NCF (I) | $69.4\%$ | $69.3\%$ | $79.5\%$ | $69.7\%$ | $69.8\%$ | $79.6\%$
InP-NCF (I) | $\mathbf{70.0\%}$ | $\mathbf{70.0\%}$ | $\mathbf{79.8\%}$ | $\mathbf{69.8\%}$ | $\mathbf{70.2\%}$ | $\mathbf{80.1\%}$

Table 3: Implicit feedback prediction. We train three different neural network architectures proposed in [5] with and without learning the inputs. The input learning strategy consistently improves the results. Our method also performs better than NAIS [13], which is an attention-based CF method. | ml1m | Amazon music
---|---|---
method | HR | NDCG | HR | NDCG
CFNet-rl | $70.7\%$ | $43.1\%$ | $39.2\%$ | $24.3\%$
InP-CFNet-rl | $\mathbf{71.5}\%$ | $\mathbf{43.3}\%$ | $\mathbf{40.0}\%$ | $\mathbf{24.6}\%$
CFNet-ml | $70.4\%$ | $42.5\%$ | $40.1\%$ | $24.5\%$
InP-CFNet-ml | $\mathbf{71.2}\%$ | $\mathbf{43.3}\%$ | $\mathbf{41.0}\%$ | $\mathbf{25.2}\%$
CFNet | $70.4\%$ | $42.8\%$ | $39.0\%$ | $24.6\%$
InP-CFNet | $\mathbf{71.8}\%$ | $\mathbf{43.7}\%$ | $\mathbf{39.7}\%$ | $\mathbf{25.1}\%$
NAIS | $68.4\%$ | $40.6\%$ | $35.2\%$ | $20.1\%$

##### Implicit feedback prediction: learning the input improves the
performance.

In [5], three different neural network architectures are used to create the
representations in NCF. These architectures are called CFNet-rl, CFNet-ml, and
CFNet. CFNet-rl uses MLPs on top of user/item input interaction vectors to
generate user/item representation and uses element-wise product to combine
them. CFNet-ml uses a single linear layer to generate representations and uses
concatenation to combine them. The CFNet architecture combines the
representations of the CFNet-rl and CFNet-ml. Note that the input is fixed to
the implicit interaction vector and the goal is to predict the implicit
feedback. We ran these three models using the authors’ code, which is publicly
available 222https://github.com/familyld/DeepCF. The preprocessed datasets are
also available within the code. We have put the HR and NDCG of these models in
Table 3.

To learn the input parameters in addition to the model parameters, we slightly
changed the original code without changing the hyper-parameters. As we can see
in Table 3, the input learning strategy consistently improves the HR and NDCG
of all the architectures.

We provide more details about CFNet and how our approach can improve its
results in the supplementary material section 7.

##### Comparison with the attention-based CF.

In Table 3, we have put the results of NAIS and compared it with NCF and InP-
NCF. We ran NAIS using the authors’ code, which is publicly available
333https://github.com/AaronHeee/Neural-Attentive-Item-Similarity-Model. As we
can see, InP-NCF achieves better results than NAIS on both datasets.

Table 4: Training and validation RMSE of InP-NCF and NCF at different epochs.
Our approach achieves lower RMSE using both deep and shallow networks.

ml1m, shallow network
---
# epochs | $0$ | $2$ | $4$ | $6$ | $10$ | $15$ | best
NCF train | $1.61$ | $0.858$ | $0.835$ | $0.824$ | $0.792$ | $0.764$ |
NCF val | $1.60$ | $0.880$ | $0.867$ | $0.867$ | $0.861$ | $0.872$ | $0.861$
InP-NCF train | $1.61$ | $0.849$ | $0.834$ | $0.798$ | $0.767$ | $0.732$ |
InP-NCF val | $1.60$ | $0.868$ | $0.876$ | $0.853$ | $0.858$ | $0.864$ | $0.853$

ml1m, deep network
---
# epochs | $0$ | $2$ | $4$ | $6$ | $10$ | $15$ | best
NCF train | $2.29$ | $0.870$ | $0.834$ | $0.816$ | $0.790$ | $0.753$ |
NCF val | $2.27$ | $0.885$ | $0.868$ | $0.859$ | $0.861$ | $0.865$ | $0.857$
InP-NCF train | $2.29$ | $0.865$ | $0.820$ | $0.811$ | $0.763$ | $0.721$ |
InP-NCF val | $2.27$ | $0.887$ | $0.860$ | $0.859$ | $0.852$ | $0.865$ | $0.852$

Table 5: We report RMSE and precision of InP-NCF using end-to-end optimization
and alternating optimization. The results seem very similar regardless of the
optimization approach. We run each experiments three times and report mean and
standard deviation.

| RMSE
---|---
| ml100k | ml1m | Ichiba
end-to-end | $0.892\pm 0.003$ | $0.845\pm 0.001$ | $0.871\pm 0.004$
alt-opt | $0.893\pm 0.001$ | $0.845\pm 0.000$ | $0.869\pm 0.005$

| precision
---|---
| ml100k | ml1m | Ichiba
end-to-end | $69.8\%\pm 0.5$ | $70.3\%\pm 0.09$ | $79.8\%\pm 0.3$
alt-opt | $69.9\%\pm 0.5$ | $70.2\%\pm 0.1$ | $79.5\%\pm 0.2$

##### Input learning with a shallow network outperforms fixed input with a
deep network.

In Table 2, we report RMSE of InP-NCF and NCF using a shallow network
($\mathbf{g}^{i},\mathbf{g}^{u},f=[1,1,2]$) and a deep network
($\mathbf{g}^{i},\mathbf{g}^{u},f=[3,3,4]$). In the ml100k dataset, the
results get slightly better as we make the networks deeper. In ml1m, which has
more training data, the improvements are more significant than ml100k, as we
make the networks deeper. In Ichiba, there is no improvement by making the
network deeper.

An important point about the results of Table 2 is that our approach InP-NCF
with a shallow network achieves better results than NCF (fixed input) with a
deep network. For example, our method achieves RMSE of $0.845$ in ml1m dataset
using the shallow architecture, while NCF with fixed input achieves RMSE of
$0.856$ with the deep network.

To find the reason, we report RMSE of both methods on the training and
validation sets using the shallow and the deep network on ml1m dataset in
Table 4. The first six columns contain RMSE from initialization to epoch $15$
and the last column contains the best RMSE on the validation set. There are
three important points in these results. First, we can see that even using a
shallow network, overfitting happens after $10$ epochs. That is why the
methods do not gain much improvement by increasing the number of layers (i.e.,
number of parameters). Second, at epoch $15$, the training error of InP-NCF
using the shallow network is smaller than the training error of NCF using the
deep network. This means that while the number of input variables is smaller
than the number of model parameters in ml1m, input variables are more
important in decreasing the error. Finally, the results of Table 4 confirm our
theoretical results. In both cases of deep and shallow networks, InP-NCF
achieves a lower empirical error and a better validation error than NCF.

##### Optimization.

We optimize our InP-NCF approach in two different ways: 1) the end-to-end
optimization, which is followed by a post-input optimization, and 2)
alternating optimization over the inputs and parameters. Table 5 shows the
results on three dataset. We can see that the RMSE and precision of InP-NCF is
very similar regardless of the optimization approaches.

##### Post-optimization of inputs.

In our experiments, we observed that model parameters and input parameters
overfit at different rates. Based on this observation, we first optimize all
the parameters together until we see overfitting. Then, as a second step, we
fix the parameters of the model and continue optimization over the inputs for
a few more epochs.

In Table 4, we have shown the training and validation RMSE of InP-NCF for $15$
epochs. We continue the optimization only over the input parameters for a few
more epochs and put the results in Table 6. As we can see, this strategy
decreases both training and validation RMSEs.

Table 6: Post-optimization over the input variables. We fix the model
parameters and continue the optimization of the InP-NCF models of Table 4 over
the inputs.

ml1m, shallow network
---
# epochs | $0$ | $1$ | $3$ | $5$ | $7$
InP-NCF train | $0.791$ | $0.782$ | $0.775$ | $0.771$ | $0.767$
InP-NCF val | $0.853$ | $0.847$ | $0.846$ | $0.845$ | $0.845$

ml1m, deep network
---
# epochs | $0$ | $1$ | $3$ | $5$ | $7$
InP-NCF train | $0.761$ | $0.749$ | $0.742$ | $0.737$ | $0.733$
InP-NCF val | $0.852$ | $0.8473$ | $0.8470$ | $0.875$ | $0.848$

##### Comparison with the state-of-the-art methods.

We compare our method with several baselines and recent works by reporting
RMSE and precision in Table 7 and Table 8. MF [17] and NeuMF [11] are
collaborating filtering (CF) methods with the ID as the input. MF uses dot
product and NeuMF uses MLPs to model the interaction between the user and item
representations and to predict the ratings. Autorec [24] and DeepCF [5] are CF
methods with the ratings as the input. Autorec uses autoencoders to
reconstruct the ratings and DeepCF uses the MLPs to model user-item
interaction. DHA [19] and aSDAE [4] are two autoencoder-based hybrid methods,
which try to reconstruct the side information and the ratings of the users and
items. HIRE [21] is a hybrid method that considers the hierarchical user and
item side information. DSSM [15] is a content-based recommender method, which
uses deep neural networks to learn the representations.

NeuMF, DeepCF, and DSSM were originally proposed for the prediction of
implicit feedback. To make these methods applicable to the explicit feedback
prediction, we modify their objective function and use a mean squared error
loss function. For the hybrid and content-based methods, we create bag of
words (BoW) features from the user and item side information, such as age,
gender, occupation, movie title, genre, etc. DSSM is not applicable in the
Amazon dataset, as there is no user side information.

We got an out-of-memory (OOM) error in the training of HIRE, DHA, and aSDAE in
Amazon and Ichiba datasets. HIRE’s code (publicly available by the authors)
needs the dense interaction matrix in training, which can not be stored in
memory for Amazon and Ichiba datasets. DHA and aSDAE reconstruct the users’
and items’ interaction vectors. This makes the first and the last layer of
their autoencoders huge in Amazon and Ichiba datasets and makes their model’s
size larger than the $12GB$ memory of our GPU.

Table 7: We compare RMSE of our approach, InP-NCF, with the hybrid and collaborative filtering methods. We put ”OM” in the tables whenever we get an out-of-memory error. Our approach outperforms the rest of the methods.  method | ml100k | ml1m | Amazon | Ichiba
---|---|---|---|---
MF | $0.906\pm 0.002$ | $0.857\pm 0.0005$ | $1.107\pm 0.003$ | $0.876\pm 0.003$
Autorec | $0.900\pm 0.002$ | $0.855\pm 0.0003$ | $1.108\pm 0.01$ | $0.876\pm 0.059$
NeuMF | $0.948\pm 0.005$ | $0.886\pm 0.001$ | $1.140\pm 0.004$ | $0.900\pm 0.004$
DSSM | $0.934\pm 0.002$ | $0.941\pm 0.0004$ | NA | $0.913\pm 0.003$
DHA | $0.939\pm 0.002$ | $0.865\pm 0.001$ | OM | OM
aSDAE | $0.946\pm 0.005$ | $0.879\pm 0.005$ | OM | OM
HIRE | $0.930\pm 0.006$ | $0.861\pm 0.004$ | OM | OM
DeepCF | $0.900\pm 0.002$ | $0.866\pm 0.001$ | $1.123\pm 0.002$ | $0.886\pm 0.003$
InP-NCF | $\mathbf{0.892\pm 0.004}$ | $\mathbf{0.845\pm 0.001}$ | $\mathbf{1.101\pm 0.003}$ | $\mathbf{0.867\pm 0.003}$
Table 8: We report precision of our approach and the state-of-the-art methods. We report the precision by creating the relevant and retrieved sets using top $10\%$ and $25\%$ of the items. We put ”OM” in the tables whenever we get an out-of-memory error. Our approach outperforms the rest of the methods.  | ml1m | Amazon review
---|---|---
method | top $10\%$ | top $25\%$ | top $10\%$ | top $25\%$
MF | $55.6\%\pm 0.16$ | $68.05\%\pm 0.45$ | $64.9\%\pm 0.04$ | $71.5\%\pm 0.67$
Autorec | $57.6\%\pm 0.26$ | $69.5\%\pm 0.43$ | $64.6\%\pm 0.98$ | $71.3\%\pm 0.62$
NeuMF | $56.8\%\pm 0.12$ | $68.9\%\pm 0.48$ | $66.8\%\pm 0.30$ | $72.6\%\pm 0.09$
DSSM | $54.7\%\pm 0.35$ | $67.2\%\pm 0.30$ | NA | NA
DHA | $57.4\%\pm 0.78$ | $69.3\%\pm 0.23$ | OM | OM
aSDAE | $56.4\%\pm 0.39$ | $68.0\%\pm 0.42$ | OM | OM
HIRE | $57.4\%\pm 0.08$ | $69.4\%\pm 0.55$ | OM | OM
DeepCF | $57.1\%\pm 0.16$ | $69.2\%\pm 0.29$ | $67.7\%\pm 0.53$ | $73.9\%\pm 0.2$
InP-NCF | $\mathbf{58.6\%\pm 0.04}$ | $\mathbf{70.1\%\pm 0.38}$ | $\mathbf{69.3\%\pm 0.34}$ | $\mathbf{75.5\%\pm 0.00}$

We compare the RMSE (Table 7) and the precision (Table 8) on four datasets.
Our method achieves significantly better results than the state-of-the-art
methods in all the experiments. These results confirm the advantage of
simultaneous learning of the inputs and parameters in NCF.

##  6 Conclusion

In this paper, we studied the role of the input in neural collaborative
filtering. We showed that there is an implicit user/item embedding matrix in
the first hidden layer of the MLPs, which takes the interaction vector as the
input. The non-zero elements of this vector determine which embedding vectors
to choose. The output of the first hidden layer is a weighted sum of the
embedding vectors, where the weights are determined by the value of the non-
zero elements. We proposed to learn the value of the non-zero elements of the
interaction vector with the network parameters jointly to achieve more
powerful representations. We theoretically analyzed our approach and proved
that it achieves a better generalization bound than previous works. Extensive
experiments on predicting implicit and explicit feedback on several datasets
verified the effectiveness of our approach.

## References

  * Bartlett et al. [2019] Peter L. Bartlett, Nick Harvey, Christopher Liaw, and Abbas Mehrabian.  Nearly-tight VC-dimension and pseudodimension bounds for piecewise linear neural networks.  _Journal of Machine Learning Research (JMLR)_ , 2019.
  * Chen et al. [2020] Long Chen, Yuan Yao, Feng Xu, Miao Xu, and Hanghang Tong.  Trading personalization for accuracy: Data debugging in collaborative filtering.  In _Proceedings of the 33rd International Conference on Neural Information Processing Systems (NeurIPS)_ , 2020.
  * Cheng et al. [2016] Heng-Tze Cheng, Levent Koc, Jeremiah Harmsen, Tal Shaked, Tushar Chandra, Hrishi Aradhye, Glen Anderson, Greg Corrado, Wei Chai, Mustafa Ispir, Rohan Anil, Zakaria Haque, Lichan Hong, Vihan Jain, Xiaobing Liu, and Hemal Shah.  Wide & deep learning for recommender systems.  In _Proceedings of the 1st Workshop on Deep Learning for Recommender Systems (DLSRS)_ , 2016.  doi: 10.1145/2988450.2988454.
  * Dong et al. [2017] Xin Dong, Lei Yu, Zhonghuo Wu, Yuxia Sun, Lingfeng Yuan, and Fangxi Zhang.  A hybrid collaborative filtering model with deep structure for recommender systems.  In _Proceedings of the 31st AAAI Conference on Artificial Intelligence_ , 2017.
  * Dong et al. [2019] Zhi-Hong Dong, Ling Huang, Chang-Dong Wang, Jian-Huang Lai, and Philip S Yu.  DeepCF: a unified framework of representation learning and matching function learning in recommender system.  In _Proceedings of the 33rd AAAI Conference on Artificial Intelligence_ , 2019.
  * Fan et al. [2019] Wenqi Fan, Yao Ma, Qing Li, Yuan He, Eric Zhao, Jiliang Tang, and Dawei Yin.  Graph neural networks for social recommendation.  In _Proceedings of the 28th International Conference on World Wide Web (WWW)_ , 2019.
  * Guo et al. [2017] Huifeng Guo, Ruiming Tang, Yunming Ye, Zhenguo Li, and Xiuqiang He.  DeepFM: a factorization-machine based neural network for CTR prediction.  In _Proceedings of the 26th International Joint Conference on Artificial Intelligence (IJCAI)_ , 2017.
  * Harper and Konstan [2015] F. Maxwell Harper and Joseph A. Konstan.  The MovieLens datasets.  _ACM Transactions on Interactive Intelligent Systems_ , 5(4):1–19, 2015.  doi: 10.1145/2827872.
  * He and McAuley [2016] Ruining He and Julian McAuley.  Ups and downs: Modeling the visual evolution of fashion trends with one-class collaborative filtering.  In _Proceedings of the 25th International Conference on World Wide Web (WWW)_ , 2016.  doi: 10.1145/2872427.2883037.
  * He and Chua [2017] Xiangnan He and Tat-Seng Chua.  Neural factorization machines for sparse predictive analytics.  In _Proceedings of the 40th International ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR)_ , 2017\.  doi: 10.1145/3077136.3080777.
  * He et al. [2017] Xiangnan He, Lizi Liao, Hanwang Zhang, Liqiang Nie, Xia Hu, and Tat-Seng Chua.  Neural collaborative filtering.  In _Proceedings of the 26th International Conference on World Wide Web (WWW)_ , 2017.
  * He et al. [2018a] Xiangnan He, Xiaoyu Du, Xiang Wang, Feng Tian, Jinhui Tang, and Tat-Seng Chua.  Outer product-based neural collaborative filtering.  In _Proceedings of the 27th International Joint Conference on Artificial Intelligence (IJCAI)_ , 2018a.
  * He et al. [2018b] Xiangnan He, Zhankui He, Jingkuan Song, Zhenguang Liu, Yu-Gang Jiang, and Tat-Seng Chua.  NAIS: Neural attentive item similarity model for recommendation.  _IEEE Transactions on Knowledge and Data Engineering_ , pages 2354–2366, 2018b.
  * He et al. [2020] Xiangnan He, Kuan Deng, Xiang Wang, Yan Li, Yongdong Zhang, and Meng Wang.  LightGCN: Simplifying and powering graph convolutionnetwork for recommendation.  In _Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval_ , 2020.
  * Huang et al. [2013] Po-Sen Huang, Xiaodong He, Jianfeng Gao, Li Deng, Alex Acero, and Larry Heck.  Learning deep structured semantic models for web search using clickthrough data.  In _Proceedings of the 22nd ACM International on Conference on Information and Knowledge Management (CIKM)_ , 2013.  doi: 10.1145/2505515.2505665.
  * Koren [2008] Yehuda Koren.  Factorization meets the neighborhood:a multifaceted collaborative filtering model.  In _Proceedings of the 14th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD)_ , 2008.  doi: 10.1145/1401890.1401944.
  * Koren et al. [2009] Yehuda Koren, Robert Bell, and Chris Volinsky.  Matrix factorization techniques for recommender systems.  _Computer_ , 42(8):30–37, 2009.  doi: 10.1109/mc.2009.263.
  * Li et al. [2015] Sheng Li, Jaya Kawale, and Yun Fu.  Deep collaborative filtering via marginalized denoising auto-encoder.  In _Proceedings of the 24th ACM International on Conference on Information and Knowledge Management (CIKM)_ , 2015.  doi: 10.1145/2806416.2806527.
  * Li et al. [2018] Tianyu Li, Yukun Ma, Jiu Xu, Bjorn Stenger, Chen Liu, and Yu Hirate.  Deep heterogeneous autoencoders for collaborative filtering.  In _Proceedings of the 18th IEEE International Conference Data Mining (ICDM)_ , 2018.
  * Lian et al. [2018] Jianxun Lian, Xiaohuan Zhou, Fuzheng Zhang, Zhongxia Chen, Xing Xie, and Guangzhong Sun.  xDeepFM: combining explicit and implicit feature interactions for recommender systems.  In _Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD)_ , 2018.  doi: 10.1145/3219819.3220023.
  * Liu et al. [2019] Tianqiao Liu, Zhiwei Wang, Jiliang Tang, Songfan Yang, Gale Yan Huang, and Zitao Liu.  Recommender systems with heterogeneous side information.  In _Proceedings of the 28th International Conference on World Wide Web (WWW)_ , 2019.  doi: 10.1145/3308558.3313580.
  * Neyshabur et al. [2018] Behnam Neyshabur, Srinadh Bhojanapalli, and Nathan Srebro.  A PAC-bayesian approach to spectrally-normalized margin bounds for neural networks.  In _6th International Conference on Learning Representations (ICLR)_ , 2018.
  * Ricci et al. [2011] Francesco Ricci, Lior Rokach, Bracha Shapira, and Paul B. Kantor, editors.  _Recommender Systems Handbook_.  Springer US, 2011.  doi: 10.1007/978-0-387-85820-3.
  * Sedhain et al. [2015] Suvash Sedhain, Aditya Krishna Menon, Scott Sanner, and Lexing Xie.  AutoRec: Autoencoders meet collaborative filtering.  In _Proceedings of the 24th International Conference on World Wide Web (WWW)_ , 2015.  doi: 10.1145/2740908.2742726.
  * Shai Shalev-Shwartz [2014] Shai Ben-David Shai Shalev-Shwartz.  _Understanding Machine Learning_.  Cambridge University Pr., 2014.  ISBN 1107057132.  URL https://www.ebook.de/de/product/22370006/shai_shalev_shwartz_shai_ben_david_understanding_machine_learning.html.
  * Springenberg et al. [2016] Jost Tobias Springenberg, Aaron Klein, Stefan Falkner, and Frank Hutter.  Bayesian optimization with robust bayesian neural networks.  In _Proceedings of the 30th International Conference on Neural Information Processing Systems (NIPS)_ , 2016.
  * Steck [2020] Harald Steck.  Autoencoders that don’t overfit towards the identity.  In _Proceedings of the 33rd International Conference on Neural Information Processing Systems (NeurIPS)_ , 2020.
  * Strub et al. [2016] Florian Strub, Romaric Gaudel, and Jérémie Mary.  Hybrid recommender system based on autoencoders.  In _Proceedings of the 1st Workshop on Deep Learning for Recommender Systems (DLSRS)_ , 2016.  doi: 10.1145/2988450.2988456.
  * Sun et al. [2019] Jianing Sun, Yingxue Zhang, Chen Ma, Mark Coates, Huifeng Guo, Ruiming Tang, and Xiuqiang He.  Multi-graph convolution collaborative filtering.  In _Proceedings of the 19th IEEE International Conference Data Mining (ICDM)_ , 2019.
  * Takács et al. [2008] Gábor Takács, István Pilászy, Bottyán Németh, and Domonkos Tikk.  Matrix factorization and neighbor based algorithms for the netflix prize problem.  In _Proceedings of the 2nd ACM Conference on Recommender Systems (RecSys)_ , 2008.  doi: 10.1145/1454008.1454049.
  * van den Berg et al. [2018] Rianne van den Berg, Thomas N. Kipf, and Max Welling.  Graph convolutional matrix completion.  In _Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD)_ , 2018.
  * Vapnik [1995] Vladimir Vapnik.  _The Nature of Statistical Learning Theory_.  Springer-Verlag New York, 1995.  doi: 10.1007/978-1-4757-3264-1.
  * Velickovic et al. [2018] Petar Velickovic, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio.  Graph attention networks.  In _6th International Conference on Learning Representations (ICLR)_ , 2018.
  * Wang et al. [2015] Hao Wang, Naiyan Wang, and Dit-Yan Yeung.  Collaborative deep learning for recommender systems.  In _Proceedings of the 21st ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD)_ , 2015.  doi: 10.1145/2783258.2783273.
  * Wang et al. [2019] Xiang Wang, Xiangnan He, Meng Wang, Fuli Feng, and Tat-Seng Chua.  Neural graph collaborative filtering.  In _Proceedings of the 42nd International ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR)_ , 2019\.  doi: 10.1145/3331184.3331267.
  * Wei et al. [2021] Ying Wei, Peilin Zhao, and Junzhou Huang.  Meta-learning hyperparameter performance prediction with neural processes.  In _Proceedings of the 38th International Conference on Machine Learning (ICML)_ , 2021.
  * Xue et al. [2017] Hong-Jian Xue, Xinyu Dai, Jianbing Zhang, Shujian Huang, and Jiajun Chen.  Deep matrix factorization models for recommender systems.  In _Proceedings of the 26th International Joint Conference on Artificial Intelligence (IJCAI)_ , 2017.  doi: 10.24963/ijcai.2017/447.
  * Ying et al. [2018] Rex Ying, Ruining He, Kaifeng Chen, Pong Eksombatchai, William L. Hamilton, and Jure Leskovec.  Graph convolutional neural networks for web-scale recommender systems.  In _Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD)_ , 2018.  doi: 10.1145/3219819.3219890.
  * Zhang et al. [2017a] Shuai Zhang, Lina Yao, and Xiwei Xu.  AutoSVD++: An efficient hybrid collaborative filtering model via contractive auto-encoders.  In _Proceedings of the 40th International ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR)_ , 2017a.  doi: 10.1145/3077136.3080689.
  * Zhang et al. [2017b] Yongfeng Zhang, Qingyao Ai, Xu Chen, and W. Bruce Croft.  Joint representation learning for Top-N recommendation with heterogeneous information sources.  In _Proceedings of the 26th ACM International on Conference on Information and Knowledge Management (CIKM)_ , 2017b.  doi: 10.1145/3132847.3132892.

##  7 Supplementary material

This supplementary material contains the following: 1) proof of the lemmas in
the main script, 2) the exact form of the generalization bound of InP-NCF and
NCF, 3) analysis on applying our input learning approach to the NCF framework
of CFNet [5], 4) an extension of our experiments, and 5) the experimental
settings of each method in our paper, which includes number of layers,
learning rate, optimizer, etc.

###  7.1 Proof of the lemmas

We assume the learning algorithms return the following parameters at the
convergence:

${\boldsymbol{\theta}^{ui}}^{*},{\mathbf{Z}^{u}}^{*},{\mathbf{Z}^{i}}^{*}=\mathcal{A}_{\text{InP-
NCF}}(\mathcal{D}),\qquad\qquad\hat{\boldsymbol{\theta}^{ui}},\hat{\mathbf{Z}^{u}},\hat{\mathbf{Z}^{i}}=\mathcal{A}_{\text{NCF}}(\mathcal{D}).$
(14)

We first prove that the empirical risks of the NCF and InP-NCF at convergence
is the same as their training errors. Then, we prove that InP-NCF’s training
error is smaller than the NCF’s training error.

Let us assume that NCF converges to the network parameters
$\hat{\boldsymbol{\theta}}=[\hat{\boldsymbol{\theta}^{ui}},\hat{\boldsymbol{\theta}^{u}},\hat{\boldsymbol{\theta}^{i}}]$,
where
$\hat{\mathbf{Z}^{u}}=\mathbf{g}^{u}(\mathbf{R};\hat{\boldsymbol{\theta}^{u}})$
and
$\hat{\mathbf{Z}^{i}}=\mathbf{g}^{i}(\mathbf{R};\hat{\boldsymbol{\theta}^{i}})$.
Also, assume that InP-NCF converges to network parameters
$\boldsymbol{\theta}^{*}=[{\boldsymbol{\theta}^{ui}}^{*},{\boldsymbol{\theta}^{u}}^{*},{\boldsymbol{\theta}^{i}}^{*}]$
and input parameters [$\mathbf{U}^{*},\mathbf{V}^{*}$], where
${\mathbf{Z}^{u}}^{*}=\mathbf{g}^{u}(\mathbf{U}^{*};{\boldsymbol{\theta}^{u}}^{*})$
and
${\mathbf{Z}^{i}}^{*}=\mathbf{g}^{i}(\mathbf{V}^{*};{\boldsymbol{\theta}^{i}}^{*})$.

######  Lemma 5.

At convergence, the training error of the learning algorithms is equal to the
empirical error of their returned hypothesis:

$R^{\text{emp}}_{\text{Inp-NCF}}=E_{\text{InP-
NCF}}(\boldsymbol{\theta}^{*},\mathbf{U}^{*},\mathbf{V}^{*}),\quad\quad
R^{\text{emp}}_{\text{NCF}}=E_{\text{NCF}}(\hat{\boldsymbol{\theta}}).$ (15)

###### Proof.

We prove the lemma only for the InP-NCF, as the one for the NCF can be proved
in a very similar way. Let us start by writing the empirical error of the InP-
NCF using Eq. (8) and Eq. (7):

$\displaystyle R^{\text{emp}}_{\text{InP-
NCF}}=R^{\text{emp}}({\boldsymbol{\theta}^{ui}}^{*},{\mathbf{Z}^{u}}^{*},{\mathbf{Z}^{i}}^{*})=\frac{1}{mn}\sum_{j=1}^{m}\sum_{k=1}^{n}L(R_{jk},f(\mathbf{z}_{jk};{\boldsymbol{\theta}^{ui}}^{*})))$
(16)
$\displaystyle\text{s.t.}\quad\mathbf{z}_{jk}=[\mathbf{z}^{u}_{j},\mathbf{z}^{i}_{k}]\quad\mathbf{z}^{u}_{j}=\mathbf{I}^{u}_{j}{\mathbf{Z}^{u}}^{*},\quad\mathbf{z}^{i}_{k}=\mathbf{I}^{i}_{k}{\mathbf{Z}^{i}}^{*}$

The main term of the Eq. (16) is the same as the main term of the NCF
objective in Eq. (4), which is also the main term of the InP-NCF objective
function in Eq. (5). But, the constraints seem to be different. We rewrite the
constraints of the Eq. (16) as follows:

$\mathbf{z}^{u}_{j}=\mathbf{I}^{u}_{j}{\mathbf{Z}^{u}}^{*}=\mathbf{I}^{u}_{j}\mathbf{g}^{u}(\mathbf{U}^{*};{\boldsymbol{\theta}^{u}}^{*})=\mathbf{g}^{u}({\mathbf{U}}^{*}_{j,:};{\boldsymbol{\theta}^{u}}^{*}),\quad\quad\mathbf{z}^{i}_{k}=\mathbf{I}^{i}_{k}{\mathbf{Z}^{i}}^{*}=\mathbf{I}^{i}_{k}\mathbf{g}^{i}(\mathbf{V}^{*};{\boldsymbol{\theta}^{i}}^{*})=\mathbf{g}^{i}(\mathbf{V}^{*}_{k,:};{\boldsymbol{\theta}^{i}}^{*}).$
(17)

By replacing the constraints of the Eq. (16) with the ones in Eq. (17), we can
see that both the main terms and constraints of the Eq. (16) and Eq. (5) are
the same, which means that $R^{\text{emp}}_{\text{Inp-NCF}}=E_{\text{InP-
NCF}}(\boldsymbol{\theta}^{*},\mathbf{U}^{*},\mathbf{V}^{*})$ at convergence.
We can prove this fact for NCF in the same way. ∎

Since the value of the training error is the same as the empirical error, we
focus on comparing the training errors of the InP-NCF and NCF, instead of the
empirical errors.

Let us assume that both InP-NCF and NCF converge to their optimal solutions.
In other words, assume that $\hat{\boldsymbol{\theta}}$ is the optimal
solution of NCF and [$\boldsymbol{\theta}^{*},\mathbf{U}^{*},\mathbf{V}^{*}$]
is the optimal solution of InP-NCF.

######  Lemma 6.

At the optimal solution, training error of InP-NCF is smaller than or equal to
the NCF, i.e., $E_{\text{InP-
NCF}}(\boldsymbol{\theta}^{*},\mathbf{U}^{*},\mathbf{V}^{*})\leq
E_{\text{NCF}}(\hat{\boldsymbol{\theta}})$.

###### Proof.

NCF fixes the input to the ratings ($\mathbf{U}=\mathbf{R}$ and
$\mathbf{V}=\mathbf{R}^{T}$) and learns the network parameters. Since
[$\boldsymbol{\theta}^{*},\mathbf{U}^{*},\mathbf{V}^{*}$] is the optimal
solution of InP-NCF, we have:

$E_{\text{NCF}}(\hat{\boldsymbol{\theta}})=E_{\text{InP-
NCF}}(\hat{\boldsymbol{\theta}},\mathbf{R},\mathbf{R}^{T})\geq E_{\text{InP-
NCF}}(\boldsymbol{\theta}^{*},\mathbf{U}^{*},\mathbf{V}^{*}).$

∎

In practice, the objective functions are highly non-convex and the models will
not converge to the optimal solutions. So we have to compare the empirical
risks of the models at their local minima. With our end-to-end optimization of
the parameters and the inputs, we do not have enough information about the the
convergence point of InP-NCF and how it is compared with the NCF. To ensure
that InP-NCF achieves a lower training error than NCF, no matter how we choose
the functions $f()$, $\mathbf{g}^{u}()$ and $\mathbf{g}^{i}()$, we have
designed the following alternating optimization algorithm.

We apply alternating optimization over the input parameters
($\mathbf{U}$,$\mathbf{V}$) and the network parameters $\boldsymbol{\theta}$
to minimize the objective function of Eq. (5). We start the optimization from
$\boldsymbol{\theta}$ since it is initialized randomly, as opposed to the
input which can be initialized by the interaction vector. Formally, we
initialize $\mathbf{U}^{0}=\mathbf{R}$ and $\mathbf{V}^{0}=\mathbf{R}^{T}$ and
repeat the following steps until convergence ($t\geq 1$):

$\text{(a):}\
\boldsymbol{\theta}^{t}=\operatorname*{argmin}_{\boldsymbol{\theta}}E_{\text{InP-
NCF}}(\boldsymbol{\theta},\mathbf{U}^{t-1},\mathbf{V}^{t-1}),\quad\text{(b):}\
\mathbf{U}^{t},\mathbf{V}^{t}=\operatorname*{argmin}_{\mathbf{U},\mathbf{V}}E_{\text{InP-
NCF}}(\boldsymbol{\theta}^{t},\mathbf{U},\mathbf{V})$ (18)

######  Lemma 7.

Training error of InP-NCF in Eq. (5), which uses alternating optimization of
Eq. (18), is smaller than or equal to the NCF in Eq. (4), i.e., $E_{\text{InP-
NCF}}(\boldsymbol{\theta}^{*},\mathbf{U}^{*},\mathbf{V}^{*})\leq
E_{\text{NCF}}(\hat{\boldsymbol{\theta}})$.

###### Proof.

NCF fixes the input to the ratings ($\mathbf{U}=\mathbf{R}$ and
$\mathbf{V}=\mathbf{R}^{T}$) and learns the network parameters. This is
equivalent to step (a) in Eq. (18) at the first iteration ($t=1$) of InP-NCF.
In other words, the training error of NCF can be written as
$E_{\text{NCF}}(\hat{\boldsymbol{\theta}})=E_{\text{InP-
NCF}}(\boldsymbol{\theta}^{1},\mathbf{U}^{0},\mathbf{V}^{0})$. InP-NCF
decreases the training error at each step of Eq. (18), so we have:

$E_{\text{NCF}}(\hat{\boldsymbol{\theta}})=E_{\text{InP-
NCF}}(\boldsymbol{\theta}^{1},\mathbf{U}^{0},\mathbf{V}^{0})\geq E_{\text{InP-
NCF}}(\boldsymbol{\theta}^{1},\mathbf{U}^{1},\mathbf{V}^{1})\geq\dots\geq
E_{\text{InP-NCF}}(\boldsymbol{\theta}^{*},\mathbf{U}^{*},\mathbf{V}^{*}).$
(19)

∎

Note that we only need the alternating optimization of InP-NCF for our
theoretical analysis. In our experiments, we will show that the performance of
the end-to-end optimization and alternating optimization of InP-NCF generate
similar results.

######  Lemma 8.

At convergence, empirical error of the hypothesis returned by the InP-NCF is
smaller than or equal to the one returned by NCF:

$R^{\text{emp}}_{\text{Inp-NCF}}\leq R^{\text{emp}}_{\text{NCF}}$ (20)

###### Proof.

The lemma holds because 1) in Lemma 5 we proved that the value of the
empirical error is the same as the training error, and 2) in Lemma 7 we proved
that training error of the InP-NCF is smaller than the training error of the
NCF. ∎

###  7.2 Exact form of the generalization bound of InP-NCF and NCF

As mentioned in the main script, the prediction model of the latent factor-
based collaborative filtering methods (using concatenation to combine the
representations and an MLP $f()$ to predict the interaction) can be written
as:

$\hat{R}_{jk}=f(\mathbf{z}_{jk};\boldsymbol{\theta}^{ui})\quad\text{s.t.}\quad\mathbf{z}_{jk}=[\mathbf{z}^{u}_{j},\mathbf{z}^{i}_{k}],\
\mathbf{z}^{u}_{j}=\mathbf{I}^{u}_{j}\mathbf{Z}^{u},\
\mathbf{z}^{i}_{k}=\mathbf{I}^{i}_{k}\mathbf{Z}^{i},$ (21)

where $\mathbf{I}^{u}_{j}$ and $\mathbf{I}^{i}_{k}$ are the one-hot encoding
vectors of the $j$th user and $k$th item. The input to this model is the user
and item IDs and the parameters are $\boldsymbol{\theta}^{ui}$,
$\mathbf{Z}^{u}$, and $\mathbf{Z}^{i}$.

Here, the goal is to write the exact form of the generalization bound for our
model in Eq. (21). To achieve this, we make a few assumptions. First, let us
assume that the joint representation $\mathbf{z}^{ui}$ is achieved by the
summation of the user and item representations. In that case, we can compute
$\mathbf{z}^{ui}$ by as single vector-matrix multiplication:

$\mathbf{z}^{ui}_{jk}=\mathbf{I}^{ui}_{jk}\mathbf{Z}^{ui}\quad\text{s.t.}\quad\mathbf{I}^{ui}_{jk}=[\mathbf{I}^{u}_{j},\mathbf{I}^{i}_{k}],\
\mathbf{Z}^{ui}=[\mathbf{Z}^{u},\mathbf{Z}^{i}],$ (22)

where $\mathbf{Z}^{ui}$ is achieved by appending $\mathbf{Z}^{i}$ to the end
of $\mathbf{Z}^{u}$.

The second assumption changes the objective function of NCF from regression or
binary cross-entropy losses to the hinge loss. Let us assume there are $p$
unique interaction values, i.e., $R_{jk}\in\\{1,2,\dots,p\\}$. In case of
implicit feedback, we have $p=2$. In case of explicit feedback, $p$ is the
number of unique rating values. We define $\mathbf{f}()$ as an MLP with
$L_{f}$ hidden layers and $d$ units per layer, which takes $\mathbf{z}_{jk}$
as the input and generates a $p$-dimensional vector as the output. The output
of $\mathbf{f}()$ is a score for each of the interaction values, where the
interaction with the maximum score will be selected as the predicted
interaction. We define the objective function using the hinge loss with margin
of $\gamma$ as follows:

$E_{\text{NCF}}(\mathbf{z}_{jk},\boldsymbol{\theta}^{ui})=\frac{1}{N}\sum_{j=1}^{m}\sum_{k=1}^{n}\mathbbm{1}(R_{jk}>0)\max(0,\gamma+\max_{y\neq
R_{jk}}(\mathbf{f}(\mathbf{z}_{jk};\boldsymbol{\theta}^{ui})[y])-\mathbf{f}(\mathbf{z}_{jk};\boldsymbol{\theta}^{ui})[R_{jk}]),$
(23)

where $N$ is the number of non-zero elements of the interaction matrix
$\mathbf{R}$ and $\mathbf{f}(\mathbf{z}_{jk};\boldsymbol{\theta}^{ui})[y]$
returns the value of the $y$th index of
$\mathbf{f}(\mathbf{z}_{jk};\boldsymbol{\theta}^{ui})$. By setting $\gamma=0$,
the hinge loss counts the number of misclassified interactions.

Based on the above assumptions, the number of learnable parameters in the
model of Eq. (21) is

$\pi=(n+m+p)\times d+(L_{f}-1)(d\times d),$ (24)

where $p$ is the number of unique interaction values and $d$ is the dimension
of the representations in $\mathbf{Z}^{u}$ and $\mathbf{Z}^{i}$ and the number
of hidden units in each layer of the MLP $\mathbf{f}()$.

Note that the learnable parameters include
$\mathbf{Z}^{u}\in\mathbb{R}^{m\times d}$,
$\mathbf{Z}^{i}\in\mathbb{R}^{n\times d}$, and the weights of the MLP
$\mathbf{f}()$, which contains $d\times d$ weight matrix in each of the first
$L_{f}$ layers and $p\times d$ weight matrix in the last (output) layer.

Because of the above assumptions, the rating of the user $j$ on item $k$ can
be estimated by a feedforward neural network, where the input is
$\mathbf{I}^{ui}_{jk}$, the weight matrix of the first layer is
$\mathbf{Z}^{ui}$, and the layers of $f()$ construct the second to the last
layers. Bartlett et al. [1] gives the following generalization bound for our
feedforward network with ReLU activation functions:

$E^{exp}\leq E^{tr}+\tilde{O}(\sqrt{\frac{(L_{f}+1)\pi}{N}}),$ (25)

where $\tilde{O}$ is the upper bound of the complexity up to a logarithmic
factor, $\pi$ is the number of parameters defined in Eq. (24), and $N$ is the
number of samples (non-zero interactions).

The bound in Eq. (25) is linear in the number of parameters of the neural
network, which becomes weak as the network becomes deep. This bound explains
why InP-NCF outperforms NCF using shallow neural networks, which have one or
two hidden layers and a few hundred units per layer. For deeper networks, we
could use the bound proposed by Neyshabur et al. [22] to show that InP-NCF has
a smaller upper bound for generalization error than NCF. This bound depends on
the norm of the weights of network, which makes it more suitable for deeper
networks.

###  7.3 Input learning with the NCF framework of CFNet [5]

Let us first review the NCF framework of the CFNet [5] and see how it predicts
the implicit feedback. CFNet learns two types of joint user-item
representations. The first one is achieved by applying MLPs to the user and
item representations and computing their element-wise product:

$\mathbf{z}_{jk}^{(1)}=\mathbf{z}^{u}_{j}\odot\mathbf{z}^{i}_{k}\quad\text{s.t.}\quad\mathbf{z}^{u}_{j}=\mathbf{g}^{u}(\mathbf{R}_{j,:};\boldsymbol{\theta}^{u}_{L}),\quad\mathbf{z}^{i}_{k}=\mathbf{g}^{i}(\mathbf{R}_{:,k};\boldsymbol{\theta}^{i}_{L}),$
(26)

where $\mathbf{g}^{u}$ and $\mathbf{g}^{i}$ are user and item MLPs, and
$\odot$ is an element-wise product.

The second joint representation is generated in three steps: 1) computing
linear transformation of the user and item interaction vectors, 2)
concatenating the two output vectors, and 3) applying an MLP to the
concatenation:

$\mathbf{z}_{jk}^{(2)}=\mathbf{h}(\mathbf{v}_{jk};\boldsymbol{\theta}^{h}_{L})\quad\text{s.t.}\quad\mathbf{v}_{jk}=[\mathbf{v}_{j},\mathbf{v}_{k}],\quad\mathbf{v}_{j}=\mathbf{R}_{j,:}\mathbf{A}^{u},\quad\mathbf{v}_{k}=\mathbf{R}_{:,k}^{T}\mathbf{A}^{i}$
(27)

where $\mathbf{A}^{u}\in\mathbb{R}^{m\times d}$ and
$\mathbf{A}^{i}\in\mathbb{R}^{n\times d}$ are used for linear transformation
and $\mathbf{h}()$ is an MLP.

The final objective function can be written as:

$E_{\text{CFNet}}(\boldsymbol{\theta}^{u}_{L},\boldsymbol{\theta}^{i}_{L},\mathbf{A}^{u},\mathbf{A}^{i},\boldsymbol{\theta}^{h},\boldsymbol{\theta}^{ui})=\frac{1}{mn}\sum_{j=1}^{m}\sum_{k=1}^{n}L(R_{jk},f([\mathbf{z}_{jk}^{(1)},\mathbf{z}_{jk}^{(2)}];\boldsymbol{\theta}^{ui})),$
(28)

where $\mathbf{z}_{jk}^{(1)}$ and $\mathbf{z}_{jk}^{(2)}$ are defined in Eq.
(26) and Eq. (27). In CFNet, the MLP $\mathbf{f}()$ contains a single
nonlinear layer.

####  7.3.1 Input learning in CFNet

We define the same notations as the ones in our main script. For the $j$th
user, we define the set $N_{j}=\\{l|R_{jl}\neq 0,1\leq l\leq n\\}$, which
contains the index of all the items interacted by the $j$th user. We define
the set of user input vectors as $\mathbf{U}\in\mathbb{R}^{m\times n}$, where
$\mathbf{U}_{j,:}$ is the input vector of the $j$th user. We learn $U_{jl}$ if
$l\in N_{j}$ and fix it to $0$ otherwise.

For the $k$th item, we define the set $N_{k}=\\{l|R_{lk}\neq 0,1\leq l\leq
m\\}$, which contains the index of all the users who interacted with the $k$th
item. We also define the set of item input vectors as
$\mathbf{V}\in\mathbb{R}^{n\times m}$. We learn $V_{kl}$ if $l\in N_{k}$ and
fix it to $0$ otherwise.

We consider $\mathbf{P}^{u}$ and $\mathbf{P}^{i}$ as the weights of the first
layer of the MLPs $\mathbf{g}^{u}$ and $\mathbf{g}^{i}$, respectively. Our
objective function is defined as follows:

$\begin{split}&E_{\text{InP-
CFNet}}(\boldsymbol{\theta},\mathbf{U},\mathbf{V})=E_{\text{CFNet}}(\boldsymbol{\theta}^{u}_{L},\boldsymbol{\theta}^{i}_{L},\mathbf{A}^{u},\mathbf{A}^{i},\boldsymbol{\theta}^{h},\boldsymbol{\theta}^{ui})\quad\text{s.t.}\\\
&\mathbf{z}^{u}_{j}=\mathbf{g}^{u}(\mathbf{y}^{u}_{j};\boldsymbol{\theta}^{u}_{L-1}),\quad\mathbf{y}^{u}_{j}=\sigma(\sum_{l\in
N_{j}}U_{jl}\mathbf{P}^{u}_{l,:}),\quad\mathbf{v}^{u}_{j}=\sigma(\sum_{l\in
N_{j}}U_{jl}\mathbf{A}^{u}_{l,:}),\\\
&\mathbf{z}^{i}_{k}=\mathbf{g}^{i}(\mathbf{y}^{i}_{k};\boldsymbol{\theta}^{i}_{L-1}),\quad\mathbf{y}^{i}_{k}=\sigma(\sum_{l\in
N_{k}}V_{kl}\mathbf{P}^{i}_{l,:}),\quad\mathbf{v}^{i}_{k}=\sigma(\sum_{l\in
N_{k}}V_{kl}\mathbf{A}^{i}_{l,:})\end{split}$ (29)

where
$\boldsymbol{\theta}=[\boldsymbol{\theta}^{u}_{L-1},\mathbf{P}^{u},\boldsymbol{\theta}^{i}_{L-1},\mathbf{P}^{i},\mathbf{A}^{u},\mathbf{A}^{i},\boldsymbol{\theta}^{h},\boldsymbol{\theta}^{ui}]$
contains all the parameters of the CFNet network, $\mathbf{P}^{u}$ and
$\mathbf{P}^{i}$ contain the weights of the first layer of the
$\mathbf{g}^{u}$ and $\mathbf{g}^{i}$, respectively, and $\mathbf{y}^{u}_{j}$
and $\mathbf{y}^{i}_{k}$ are the output of the first layer of the
$\mathbf{g}^{u}()$ and $\mathbf{g}^{i}()$, respectively. By setting
$\smash{U_{jl}=R_{jl}}$ and $\smash{V_{kl}=R_{lk}}$, our objective in Eq. (29)
becomes equivalent to the previous CFNet’s objective function in Eq. (28).

####  7.3.2 Theoretical analysis of InP-CFNet

Similar to our main theorem in the main script, we can prove that InP-CFNet
achieves a smaller generalization bound than CFNet. Since the details are very
similar to our proof in the main script, and to avoid repetition, we review
the main ideas.

As mentioned in our main script, collaborative filtering (matrix completion)
methods, including ours, assume that the model has seen all users and items
and a small subset of their interactions in the training set. So, the model
for both CFNet and InP-CFNet can be written as:

$\begin{split}&\hat{R}_{jk}=f([\mathbf{z}_{jk}^{(1)},\mathbf{z}_{jk}^{(2)}];\boldsymbol{\theta}^{ui})\\\
&\mathbf{z}_{jk}^{(1)}=\mathbf{z}^{u}_{j}\odot\mathbf{z}^{i}_{k}\quad\text{s.t.}\quad\mathbf{z}^{u}_{j}=\mathbf{I}^{u}_{j}\mathbf{Z}^{u},\quad\mathbf{z}^{i}_{k}=\mathbf{I}^{i}_{k}\mathbf{Z}^{i}\\\
&\mathbf{z}_{jk}^{(2)}=\mathbf{h}(\mathbf{v}_{jk};\boldsymbol{\theta}^{h}_{L})\quad\text{s.t.}\quad\mathbf{v}_{jk}=[\mathbf{v}_{j},\mathbf{v}_{k}],\quad\mathbf{v}_{j}=\mathbf{I}^{u}_{j}\mathbf{V}^{u},\quad\mathbf{v}_{k}=\mathbf{I}^{i}_{k}\mathbf{V}^{i}\end{split}$
(30)

The inputs of the above model are the user and item IDs, and the parameters
are $\boldsymbol{\theta}^{ui}$, $\boldsymbol{\theta}^{h}_{L}$,
$\mathbf{Z}^{u}$, $\mathbf{Z}^{i}$, $\mathbf{V}^{u}$, and $\mathbf{V}^{i}$.

The key point here is that InP-CFNet and CFNet are both learning algorithms,
which train their own objective function and return the parameters of the
model in Eq. (30). Similar to our theorem for the NCF and InP-NCF, the
learning algorithm with the smaller empirical error gives a better bound. We
can prove the the following facts in the same way we did for NCF and InP-NCF:

  * •

At convergence, the empirical risk of the InP-CFNet and CFNet are the same as
their training errors.

  * •

At convergence, InP-CFNet has a smaller training error than CFNet:
$E^{\text{tr}}_{\text{Inp-CFNet}}\leq E^{\text{tr}}_{\text{CFNet}}$. We can
prove this using an alternating optimization over the inputs and network
parameters of the InP-CFNet and initializing the inputs using the interaction
values in the first step.

Since the InP-CFNet achieves a lower training error than CFNet, InP-CFNet has
a smaller generalization bound than CFNet.

Initilization | After learning
---|---
|
Figure 3: Visualization of the input vectors of $10$ users in ml100k dataset.
Each row corresponds to the ratings of one user.

###  7.4 Additional experimental results

####  7.4.1 Visualization of the values of the input vectors.

In Fig. 3, we visualize the values of the input vectors at the initialization
(left panel) and after learning them with our approach (right panel), in
ml100k dataset. We randomly select $10$ users and extract their ratings on
$20$ items.

Each row of the two matrices in Fig. 3 corresponds to one user. At the
initialization, the input vectors contain the ratings of the users on items.
There are $5$ unique ratings (from $1$ to $5$) in ml100k dataset. We divide
the ratings by $5$, so the input values are between $0.2$ to $1$. Note that
there are a few $0$s at the initialization. That’s because some of the
selected users have rated less than $20$ items.

At the right panel of Fig. 3, we show the input values of those $10$ users
after learning the input with the InP-NCF. We can see that there are many more
unique values. Also, sometimes the input values change significantly from
their initial values. To see this better, note that the range of input values
at initialization is between $0$ and $1$. When we learn the input, some values
will change to $1.4$ (look at the yellow colors in the right panel). We have
set the range of the colorbar from $0$ to $1.4$ in both panels of the Fig 3 to
keep the colors consistent and to make the comparison easier.

####  7.4.2 Evaluation metrics.

We report the root mean square error (RMSE) and average precision to evaluate
the rating prediction performance. RMSE is defined as:

$\text{RMSE}=\textstyle\sqrt{\frac{1}{|T|}\sum_{R_{jk}\in
T}(R_{jk}-\hat{R}_{jk})^{2}}$ (31)

where set $T$ contains all the ratings in the test set and $R_{jk}\in T$ and
$\hat{R}_{jk}$ are the actual rating and predicted rating of the user $j$ on
item $k$, respectively.

To compute precision, we define set $S_{j}$ as the set of items rated by the
user $j$, which are not included in the training set. For user $j$, the sets
$relevant_{j}$ (groundtruth) and $retrieved_{j}$ are defined as the top $p\%$
of the items in $S_{j}$ with the highest ratings and the highest predicted
ratings, respectively. The average precision is computed as:

$\text{precision}=\frac{1}{m}\sum_{j=1}^{m}\frac{|relevant_{j}|\cap|retrieved_{j}|}{|retrieved_{j}|}.$
(32)

We report Normalized Discounted Cumulative Gain (NDCG) and Hit Ratio (HR) to
evaluate the implicit feedback prediction performance. Note that for each
user, we have only one relevant item in the test set, which is the last
interacted item. For each user $j$, we call this relevant item $relevant_{j}$.
We follow the same protocols as [5, 11] and truncate the rank list at $10$ for
both metrics. We call this list $retrieved_{j}$. HR measures whether the
actual test item exists in the top-ranked list:

$\text{HR}=\frac{1}{m}\sum_{j=1}^{m}\mathbbm{1}(relevant_{j}\in
retrieved_{j}),$ (33)

where $\mathbbm{1}(arg)=1$ if $arg$ is true, and $\mathbbm{1}(arg)=0$
otherwise.

NDCG is a measure of ranking quality and gives higher scores to the hits at
top positions in the ranked list. Let us define $index_{j}$ as position of the
$relevant_{j}$ in the ranked list $retrieved_{j}$. Then, NDCG is defined as:

$\text{NDCG}=\frac{1}{m}\sum_{j=1}^{m}\mathbbm{1}(relevant_{j}\in
retrieved_{j})\frac{1}{\log 2(index_{j}+1)}.$ (34)

####  7.4.3 Learning the input improves the prediction performance.

In Table 2 of section 5, we compare RMSE of InP-NCF with NCF on ml100k, ml1m,
and Ichiba datasets. Here, in Table 9, we have an extension of those
experiments, where we report the mean and standard deviation of precision and
RMSE on neural networks with different number of layers. The top, middle, and
bottom sections of the Table 9 contains results of the ml100k, ml1m, and
Ichiba datasets, respectively. The notation
$\mathbf{g}^{u},\mathbf{g}^{i},f=[a,b,c]$ means that the MLPs
$\mathbf{g}^{u}()$, $\mathbf{g}^{i}()$, and $f()$ have $a$, $b$, and $c$
hidden layers. In other words, the neural networks become deeper from left
column to the right column of Table 9.

By comparing NCF (R) with InP-NCF (R) and NCF (I) with InP-NCF (I), we can see
that learning the input consistently improves the results and gives lower RMSE
and higher precision. Additionally, in almost all cases, our approach InP-NCF
with a shallow network achieves better results than NCF (fixed input) with a
deep network.

Table 9: Extension of the experiments reported in Table 2 of section 5. We
compare our approach InP-NCF with NCF (fixed inputs) in different datasets.
Our method consistently achieves better results.

ml100k
---
# layers | $\mathbf{g}^{u},\mathbf{g}^{i},f=[1,1,2]$ | $\mathbf{g}^{u},\mathbf{g}^{i},f=[2,2,3]$ | $\mathbf{g}^{u},\mathbf{g}^{i},f=[3,3,4]$
| RMSE
NCF (R) | $0.903\pm 0.003$ | $0.900\pm 0.004$ | $0.897\pm 0.002$
InP-NCF (R) | $\mathbf{0.892\pm 0.003}$ | $\mathbf{0.892\pm 0.002}$ | $\mathbf{0.894\pm 0.001}$
NCF (I) | $0.905\pm 0.004$ | $0.900\pm 0.003$ | $0.896\pm 0.002$
InP-NCF (I) | $\mathbf{0.892\pm 0.004}$ | $\mathbf{0.894\pm 0.002}$ | $\mathbf{0.895\pm 0.002}$
| precision
NCF (R) | $69.8\%\pm 0.7$ | $69.7\%\pm 0.6$ | $69.3\%\pm 0.6$
InP-NCF (R) | $\mathbf{69.8\%\pm 0.5}$ | $\mathbf{70.0\%\pm 0.6}$ | $\mathbf{70.0\%\pm 0.6}$
NCF (I) | $69.4\%\pm 0.4$ | $69.5\%\pm 0.7$ | $69.7\%\pm 0.5$
InP-NCF (I) | $\mathbf{70.0\%\pm 0.3}$ | $\mathbf{70.2\%\pm 0.3}$ | $\mathbf{69.8\%\pm 0.5}$

ml1m
---
# layers | $\mathbf{g}^{u},\mathbf{g}^{i},f=[1,1,2]$ | $\mathbf{g}^{u},\mathbf{g}^{i},f=[2,2,3]$ | $\mathbf{g}^{u},\mathbf{g}^{i},f=[3,3,4]$
| RMSE
NCF (R) | $0.858\pm 0.000$ | $0.857\pm 0.002$ | $0.856\pm 0.000$
InP-NCF (R) | $\mathbf{0.845\pm 0.001}$ | $\mathbf{0.843\pm 0.000}$ | $\mathbf{0.845\pm 0.002}$
NCF (I) | $0.860\pm 0.000$ | $0.859\pm 0.001$ | $0.854\pm 0.002$
InP-NCF (I) | $\mathbf{0.846\pm 0.000}$ | $\mathbf{0.846\pm 0.000}$ | $\mathbf{0.844\pm 0.001}$
| precision
NCF (R) | $69.4\%\pm 0.3$ | $69.7\%\pm 0.2$ | $70.0\%\pm 0.3$
InP-NCF (R) | $\mathbf{70.3\%\pm 0.09}$ | $\mathbf{70.3\%\pm 0.21}$ | $\mathbf{70.4\%\pm 0.16}$
NCF (I) | $69.3\%\pm 0.3$ | $69.7\%\pm 0.1$ | $69.8\%\pm 0.3$
InP-NCF (I) | $\mathbf{69.9\%\pm 0.19}$ | $\mathbf{70.0\%\pm 0.15}$ | $\mathbf{70.2\%\pm 0.2}$

Table 10: Same as Table 9, but for Ichiba dataset. Ichiba
---
# layers | $\mathbf{g}^{u},\mathbf{g}^{i},f=[1,1,2]$ | $\mathbf{g}^{u},\mathbf{g}^{i},f=[2,2,3]$ | $\mathbf{g}^{u},\mathbf{g}^{i},f=[3,3,4]$
| RMSE
NCF (R) | $0.883\pm 0.003$ | $0.885\pm 0.001$ | $0.884\pm 0.004$
InP-NCF (R) | $\mathbf{0.871\pm 0.004}$ | $\mathbf{0.874\pm 0.003}$ | $\mathbf{0.873\pm 0.002}$
NCF (I) | $0.875\pm 0.003$ | $0.875\pm 0.001$ | $0.874\pm 0.003$
InP-NCF(I) | $\mathbf{0.867\pm 0.003}$ | $\mathbf{0.867\pm 0.004}$ | $\mathbf{0.863\pm 0.003}$
| precision
NCF (R) | $79.5\%\pm 0.3$ | $79.2\%\pm 0.0$ | $79.4\%\pm 0.3$
InP-NCF (R) | $\mathbf{79.8\%\pm 0.3}$ | $\mathbf{79.6\%\pm 0.3}$ | $\mathbf{79.6\%\pm 0.03}$
NCF (I) | $79.5\%\pm 0.2$ | $79.6\%\pm 0.2$ | $79.6\%\pm 0.2$
InP-NCF (I) | $\mathbf{79.7\%\pm 0.2}$ | $\mathbf{80.0\%\pm 0.5}$ | $\mathbf{80.0\%\pm 0.3}$
Table 11: Implementation details: optimization method (optimizer), learning
rate (lr), regularization (regu.), activation function (activ.).

| ml100k | ml1m
---|---|---
| optimizer | lr | regu. | activ. | optimizer | lr | regu. | activ.
InP-NCF | RMSprop | $0.001$ | $0$ | selu | SGD | $0.0005$ | $0$ | selu
DeepCF | RMSprop | $0.001$ | $0$ | relu | SGD | $0.0005$ | $0$ | relu
aSDAE | SGD | $0.1$ | $10^{-5}$ | tanh | RMSprop | $0.001$ | $10^{-5}$ | tanh
DHA | SGD | $0.1$ | $10^{-5}$ | tanh | RMSprop | $0.001$ | $10^{-5}$ | tanh
Autorec | Adam | $0.001$ | $0.005$ | tanh | Adam | $0.001$ | $0.001$ | tanh
NeuMF | RMSprop | $0.001$ | $0.01$ | selu | RMSprop | $0.001$ | $0.01$ | selu
DSSM | RMSprop | $0.001$ | $0.001$ | selu | SGD | $0.0005$ | $0$ | selu
MF | SGD | $0.1$ | $0.0001$ | NA | SGD | $0.1$ | $0.0001$ | NA

| Amazon | Ichiba
---|---|---
| optimizer | lr | regu. | activ. | optimizer | lr | regu. | activ.
InP-NCF | RMSprop | $0.001$ | $0$ | selu | SGD | $0.0005$ | $0$ | selu
DeepCF | RMSprop | $0.001$ | $0$ | relu | SGD | $0.0005$ | $0$ | relu
aSDAE | OM | OM | OM | OM | OM | OM | OM | OM
DHA | OM | OM | OM | OM | OM | OM | OM | OM
Autorec | RMSprop | $0.001$ | $0$ | selu | Adam | $0.001$ | $0.001$ | tanh
NeuMF | RMSprop | $0.00001$ | $0.001$ | selu | SGD | $0.0001$ | $0.01$ | selu
DSSM | NA | NA | NA | NA | SGD | $0.0005$ | $0.001$ | selu
MF | SGD | $0.1$ | $0.0001$ | NA | SGD | $0.1$ | $0.0001$ | NA

###  7.5 Experimental settings

We implement our method using Keras with TensorFlow 2 backend. We ran all the
experiments on a $12$GB GPU. For each method, we tried a set of activation
functions (relu, selu, and tanh), a range of learning rates and regularization
parameters from $10^{-1}$ to $10^{-5}$, a set of optimizers (Adam, SGD, and
RMSprop), and picked the one that works best. For a fair comparison, all
autoencoder methods have the same structure (# of layers, neurons, etc.).
Table 11 lists these details for all the methods.

In implicit feedback prediction, we use the same hyper-parameters used in
DeepCF code, which is available online. In the following, we give more
detailed information about the rating prediction, such as structure of the
neural network and other hyper-parameters of each method. The notation
$[a,b,c]$ denotes a network with three fully connected layers, where $a,b,$
and $c$ are the number of neurons in each layer.

  * •

InP-NCF. In ml100k, both $\mathbf{g}^{u}$ and $\mathbf{g}^{i}$ are MLPs with
$[100,200,100]$ and $f$ is an MLP with $[500,200,100,1]$. In ml1m, both
$\mathbf{g}^{u}$ and $\mathbf{g}^{i}$ are MLPs with $[500,300,100]$ and $f$ is
an MLP with $[500,200,100,1]$. In Amazon, both $g^{u}$ and $g^{i}$ are MLPs
with $[500,300,100]$ and $f$ is an MLP with $[200,200,100,1]$. In Ichiba, both
$\mathbf{g}^{u}$ and $\mathbf{g}^{(i)}$ are MLPs with $[100,100,100]$ and $f$
is an MLP with $[100,100,100,1]$.

Note that we use a post-input optimization over parameters of the networks and
the input. The details of the network optimization can be found in Table 11.
For the post-input optimization, we use SGD with the learning rate $0.1$,
$0.1$, $0.1$, and $0.5$ in ml100k, ml1m, Amazon, and Ichiba datasets,
respectively.

  * •

DeepCF. We use the same structure as InP-NCF for the MLPs in the two branches.
In ml100k, ml1m, Amazon, and ichiba, the MLPs are [$500$, $200$, $100$],
[$1000$, $500$, $300$, $100$], [$500$, $300$, $100$], [$200$, $100$, $100$].

  * •

DHA [19] and aSDAE [4]. The encoders are $[500,200,100]$,
$[1000,500,300,100]$, $[500,300,100]$, and $[500,300,100]$ in ml100k, ml1m,
Amazon, and Ichiba datasets. These two methods have a large number of hyper-
parameters and we tried a large range of values to get the best results. We
have set $\lambda_{2}=\lambda_{3}=0.5$ and $\lambda_{1}=1$. We use SGD with
learning rate of $0.1$ for the optimization over the variables $\mathbf{U}$
and $\mathbf{V}$.

  * •

HIRE [21]. We used the code provided by the authors without changing the
hyper-parameters.

  * •

NeuMF [11]. This method has one deep and one shallow branches. The structure
of the deep branch is the same as the encoder network of the DHA in all
datasets.

  * •

Autorec [24] . We implemented the I-Autorec, which reconstructs the ratings of
the items. This method overfits to the training data fast, even using small
networks. The autoencoder is $[m,500,m]$ in ml100k, as suggested by the
original paper, and $[m,500,300,100,300,500,m]$ in ml1m, Amazon, and Ichiba
datasets, where $m$ is the number of users.

  * •

DSSM [15] Each branch has the same structure as the encoder network of DHA.