プリンキピア

第21章推薦システム

21.10.1. Model Architectures21.10.1 モデルの構造

DeepFM consists of an FM component and a deep component which are integrated in a parallel structure. The FM component is the same as the 2-way factorization machines which is used to model the low-order feature interactions. The deep component is an MLP that is used to capture high-order feature interactions and nonlinearities. These two components share the same inputs/embeddings and their outputs are summed up as the final prediction. It is worth pointing out that the spirit of DeepFM resembles that of the Wide & Deep architecture which can capture both memorization and generalization. The advantages of DeepFM over the Wide & Deep model is that it reduces the effort of hand-crafted feature engineering by identifying feature combinations automatically.
英語のヒント
DeepFMは、並列の構造で統合されたFMの構成要素と深層の構成要素からなる。FMの構成要素は2次の因子分解機と同じで、低次の特徴の相互作用をモデル化するのに使われる。深層の構成要素はMLPで、高次の特徴の相互作用と非線形性をとらえるのに使われる。この二つの構成要素は同じ入力/埋め込みを共有し、それらの出力が足し合わされて最終的な予測になる。DeepFMの考え方が、記憶と汎化の両方をとらえられるWide & Deepの構造の考え方に似ていることは、指摘しておく価値がある。Wide & Deepのモデルと比べたDeepFMの利点は、特徴の組み合わせを自動的に見つけることで、手作りの特徴エンジニアリングの手間を減らすことである。
We omit the description of the FM component for brevity and denote the output as yˆ(FM). Readers are referred to the last section for more details. Let 𝐞i∈ℝk denote the latent feature vector of the ith field. The input of the deep component is the concatenation of the dense embeddings of all fields that are looked up with the sparse categorical feature input, denoted as:
英語のヒント
簡潔にするためFMの構成要素の説明は省き、その出力をyˆ(FM)と表す。詳しくは前の節を参照されたい。𝐞i∈ℝkをithのフィールドの潜在特徴ベクトルとする。深層の構成要素の入力は、疎なカテゴリの特徴の入力で引かれた、すべてのフィールドの密な埋め込みの連結であり、次のように表される。
𝐳(0)=[𝐞1,𝐞2,...,𝐞f],(21.10.1)
where f is the number of fields. It is then fed into the following neural network:
英語のヒント
ここでfはフィールドの数である。これは次のニューラルネットワークに入力される。
𝐳(l)=α(𝐖(l)𝐳(l−1)+𝐛(l)),(21.10.2)
where α is the activation function. 𝐖l and 𝐛l are the weight and bias at the lth layer. Let yDNN denote the output of the prediction. The ultimate prediction of DeepFM is the summation of the outputs from both FM and DNN. So we have:
英語のヒント
ここでαは活性化関数である。𝐖lと𝐛lは、lthの層での重みとバイアスである。yDNNを予測の出力とする。DeepFMの最終的な予測は、FMとDNNの両方の出力の和である。したがって、次の式が得られる。
yˆ=σ(yˆ(FM)+yˆ(DNN)),(21.10.3)
where σ is the sigmoid function. The architecture of DeepFM is illustrated below.
英語のヒント
ここでσはシグモイド関数である。DeepFMの構造を以下に図解する。
It is worth noting that DeepFM is not the only way to combine deep neural networks with FM. We can also add nonlinear layers over the feature interactions (He and Chua, 2017).
英語のヒント
DeepFMが、深層ニューラルネットワークとFMを組み合わせる唯一の方法ではないことに注意しよう。特徴の相互作用の上に非線形の層を加えることもできる(He and Chua, 2017)。
import os
from mxnet import gluon, init, np, npx
from mxnet.gluon import nn
from d2l import mxnet as d2l

npx.set_np()