I have build a model in the R version of keras and deployed it through Google Cloud ML
The model is trained on numerical inputs which have been converted from strings
When It comes to making predictions, I convert the strings to numeric using a lookup table and then pass the numerical input to the model
This is simple to do on the local machine:
library(tidyverse)
library(cloudml)
# lookup table
lookup <- tibble(int = c(1, 2, 3),
str = c('A1', 'B1', 'C1'))
# input strings
a <- 'A1'
b <- 'B1'
# convert to numeric
a_ <- lookup %>% filter(str == a) %>% select(int) %>% pull()
b_ <- lookup %>% filter(str == b) %>% select(int) %>% pull()
# send to deployed model and receive predictions
cloudml_predict(
instances = list(c(a_, b_)),
name = "size_predictor",
version = "a_1",
verbose = T
)
However I can't work out where I need to put the lookup table on cloud ml. It is a few million rows long. Do I need to add another layer to the keras model at the beginning to do the conversion?
Alternatively can I store the lookup table in BigQuery and divert inputs through this beforehand?
The answers I have found so far apply only to python, for example this: Add Tensorflow pre-processing to existing Keras model (for use in Tensorflow Serving)