レコメンデーション ベクトル構成(16次元)

ユーザーベクトル(ニーズ)

idx カラム 計算式 データ出どころ 取得方法
0 calories max(0, target - actual) / target NutritionSummary.Calories gRPC → nutrition サービス(GetNutrition)
1 protein max(0, target - actual) / target NutritionSummary.Protein 同上
2 fat max(0, target - actual) / target NutritionSummary.Fat 同上
3 carbs max(0, target - actual) / target NutritionSummary.Carbs 同上
4 fiber 常に 0(NutritionSummary 未対応)
targets[4] = 20 ハードコード
5 salt 常に 0(NutritionSummary 未対応)
targets[5] = 8 ハードコード
6 onigiri 頻度 catCount[onigiri] / 総記録数 Record[].Product.Category gRPC → records サービス(ListAllRecords)
7 bento 頻度 同上 同上 同上
8 sandwich 頻度 同上 同上 同上
9 salad 頻度 同上 同上 同上
10 soup 頻度 同上 同上 同上
11 noodle 頻度 同上 同上 同上
12 bread 頻度 同上 同上 同上
13 sweets 頻度 同上 同上 同上
14 drink 頻度 同上 同上 同上
15 side_dish 頻度 同上 同上 同上

商品ベクトル(特徴量)

idx カラム 計算式 データ出どころ 取得方法
0 calories nutrition.calories / 2000 Product.Nutrition.Calories gRPC → products サービス(SearchProducts)
1 protein nutrition.protein / 65 Product.Nutrition.Protein 同上
2 fat nutrition.fat / 55 Product.Nutrition.Fat 同上
3 carbs nutrition.carbs / 300 Product.Nutrition.Carbs 同上
4 fiber nutrition.fiber / 20 Product.Nutrition.Fiber 同上
5 salt nutrition.salt / 8 Product.Nutrition.Salt 同上
6-15 category one-hot(該当カテゴリ = 1、他 = 0) Product.Category 同上

スコア計算

gRPC 接続先まとめ

サービス gRPC アドレス 呼び出すRPC 取得データ
nutrition localhost:1057 GetNutrition(userId, date) 当日の栄養サマリー(actual/target/ratio/status)
products localhost:7112 SearchProducts(limit:1000) 全商品リスト(栄養素・カテゴリ含む)
records localhost:8811 ListAllRecords(userId) ユーザーの全食事記録(商品情報含む)
products localhost:7112 GetProduct(productId) キャッシュヒット時の商品詳細取得