Created
December 4, 2017 19:00
-
-
Save kevinykuo/a77e4df850fe6d05fae0b6407bb83eb2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tfestimators) | |
library(keras) | |
latitude_buckets <- list(33.641336, 33.887157, 99) | |
latitude_fc <- column_bucketized(column_numeric('latitude'), latitude_buckets) | |
longitude_buckets <- list(-84.558798, -84.287259, 99) | |
longitude_fc <- column_bucketized(column_numeric('longitude'), longitude_buckets) | |
boxed_fc <- column_crossed(c(latitude_fc, longitude_fc), hash_bucket_size = 1000) | |
features <- reticulate::dict(list( | |
latitude = tf$placeholder(tf$float32, shape = list(NULL, 1L)), | |
longitude = tf$placeholder(tf$float32, shape = list(NULL, 1L)) | |
)) | |
tf_input_layer <- input_layer(features, column_indicator(boxed_fc)) | |
model <- keras_model_sequential() | |
model$add(tf$keras$layers$InputLayer(input_tensor = tf_input_layer)) | |
model | |
# Model | |
# _______________________________________________________________ | |
# Layer (type) Output Shape Param # | |
# =============================================================== | |
# input_7 (InputLayer) (None, 1000) 0 | |
# =============================================================== | |
# Total params: 0 | |
# Trainable params: 0 | |
# Non-trainable params: 0 | |
# _______________________________________________________________ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment