R bloggers

Fitting a TensorFlow Linear Classifier with tfestimators

FavoriteLoadingAdd to favorites

In a recent post, I mentioned three avenues for working with TensorFlow from R:* The keras package, which uses the Keras API for building scaleable, deep learning models * The tfestimators package, which wraps Google’s Estimators API for fitting models with pre-built estimators* The tensorflow package, which provides an interface to Google’s low-level TensorFlow API In this post, Edgar and I use the linear_classifier() function, one of six pre-built models currently in the tfestimators package, to train a linear classifier using data from the titanic package. library(tfestimators) library(tensorflow) library(tidyverse) library(titanic) The titanic_train data set contains 12 fields of information on 891 passengers from the Titanic. First, we load the data, split it into training and test sets, and have a look at it. titanic_set <- titanic_train %>% filter(!is.na(Age)) # Split the data into training and test data sets indices <-…
Original Post: Fitting a TensorFlow Linear Classifier with tfestimators