Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

column_numeric

Construct a Real-Valued Column


Description

Construct a Real-Valued Column

Usage

column_numeric(..., shape = c(1L), default_value = NULL,
  dtype = tf$float32, normalizer_fn = NULL)

Arguments

...

Expression(s) identifying input feature(s). Used as the column name and the dictionary key for feature parsing configs, feature tensors, and feature columns.

shape

An integer vector that specifies the shape of the tensor. An integer can be given which means a single dimension tensor with given width. The tensor representing the column will have the shape of batch_size + shape.

default_value

A single value compatible with dtype or an iterable of values compatible with dtype which the column takes on during parsing if data is missing. A default value of NULL will cause tf$parse_example to fail if an example does not contain this column. If a single value is provided, the same value will be applied as the default value for every item. If an iterable of values is provided, the shape of the default_value should be equal to the given shape.

dtype

The types for values contained in the column. The default value is tf$float32. Must be a non-quantized, real integer or floating point type.

normalizer_fn

If not NULL, a function that can be used to normalize the value of the tensor after default_value is applied for parsing. Normalizer function takes the input Tensor as its argument, and returns the output tensor. (e.g. function(x) {(x - 3.0) / 4.2)}. Please note that even though the most common use case of this function is normalization, it can be used for any kind of Tensorflow transformations.

Value

A numeric column.

Raises

  • TypeError: if any dimension in shape is not an int

  • ValueError: if any dimension in shape is not a positive integer

  • TypeError: if default_value is an iterable but not compatible with shape

  • TypeError: if default_value is not compatible with dtype

  • ValueError: if dtype is not convertible to tf$float32

See Also


tfestimators

Interface to 'TensorFlow' Estimators

v1.9.1
Apache License 2.0
Authors
JJ Allaire [aut], Yuan Tang [aut] (<https://orcid.org/0000-0001-5243-233X>), Kevin Ushey [aut], Kevin Kuo [aut, cre] (<https://orcid.org/0000-0001-7803-7901>), Daniel Falbel [ctb, cph], RStudio [cph, fnd], Google Inc. [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.