Matthew Scarpino

Matthew Scarpino has been a programmer and engineer for more than 20 years. He has worked extensively with machine learning applications, especially those involving financial analysis, cognitive modeling, and image recognition. Matthew is a Google Certified Data Engineer and blogs about TensorFlow at tfblog.com.

Articles & Books From Matthew Scarpino

Cheat Sheet / Updated 03-02-2022
TensorFlow is Google’s premier framework for machine learning, and each new version brings a wide range of capabilities and features. After you’ve ascended the learning curve, you can write sophisticated machine-learning applications and execute them at high speed.But rising up the learning curve isn’t easy — with great power comes great complexity.
Article / Updated 06-19-2018
The gsutil utility lets you create, access, and modify buckets and objects. For the most part, gsutil commands have the same names and purposes as common *nix commands.This table lists 13 of gsutil's commands. For a more thorough discussion, visit Google's documentation.gsutil Commands Command Description mb [-c class] [-l location].
Article / Updated 06-19-2018
Machine learning applications store a great deal of data in vectors (one-dimensional tensors) and matrices (two-dimensional tensors). To process this data, TensorFlow provides many functions that operate on vectors and matrices. The following table lists these functions and provides a description of each.Vector and Matrix Operations Function Description tensordot(a, b, axes, name=None) Returns the sum of products for the elements in the given axes cross(a, b, name=None) Returns the element-wise cross product diag(diagonal, name=None) Returns a matrix with the given diagonal values, other values set to zero trace(x, name=None) Returns the sum of the diagonal elements transpose(x, perm=None,name='transpose') Switches rows and columns eye(num_rows, num_columns=None,batch_shape=None,dtype=tf.
Article / Updated 06-19-2018
Most of the mathematical routines accept floating-point values as input and return floating-point values as output. But many applications need to convert floating-point values into integer values. For this reason, TensorFlow provides the rounding operations listed in the following table.Rounding and Comparison Operations Function Description round(x, name=None) Rounds to the nearest integer, rounding up if there are two nearest integers rint(x, name=None) Rounds to the nearest integer, rounding to the nearest even integer if there are two nearest integers ceil(x, name=None) Returns the smallest integer greater than the value floor(x, name=None) Returns the greatest integer less than the value maximum(x, y, name=None) Returns a tensor containing the larger element of each input tensor minimum(x, y, name=None) Returns a tensor containing the smaller element of each input tensor argmax(x, axis=None, name=None, dimension=None) Returns the index of the greatest element in the tensor argmin(x, axis=None, name=None, dimension=None) Returns the index of the smallest element in the tensor The table also lists functions that perform comparisons.
Article / Updated 06-19-2018
Machine learning applications frequently need exponents and logarithms to compute errors and probability. To meet this need, TensorFlow provides many of the same functions available in NumPy. The following table lists 11 of them and provides a description of each.Exponential and Logarithmic Operations Function Description square(x, name=None) Returns the square of the argument squared_difference(x, y, name=None) Subtracts the first argument from the second and returns the square sqrt(x, name=None) Returns the square root of the argument rsqrt(x, name=None) Returns the reciprocal of the square root pow(x, y, name=None) Returns elements of the first tensor raised to the power of the elements of the second vector exp(x, name=None) Returns the exponential function of the argument expm1(x, name=None) Returns the exponential function of the argument minus one, exp(x) - 1 log(x, name=None) Returns the natural logarithm of the argument log1p(x, name=None) Returns the natural logarithm of the argument plus 1, log(x + 1) erf(x, name=None) Returns the error function of the argument erfc(x, name=None) Returns the complementary error function of the argument These functions are straightforward to use and understand.
Article / Updated 06-19-2018
Machine learning applications are fundamentally mathematical, and TensorFlow provides a wealth of routines for performing mathematical operations on tensors. Each routine is represented by a function of the tf package, and each function returns a tensor. When it comes to TensorFlow operations, its best to start simple.
Article / Updated 06-19-2018
An application must specify the shape of each tensor to be created. The tf package provides functions that update tensors and their shapes after creation. This table lists these transformation functions and provides a description of each.Functions for Transforming Tensors Function Description cast(tensor, dtype, name=None) Changes the tensor's data type to the given type reshape(tensor, shape, name=None) Returns a tensor with the same elements as the given tensor with the given shape squeeze(tensor, axis=None, name=None, squeeze_dims=None) Removes dimensions of size 1 reverse(tensor, axis, name=None) Reverses given dimensions of the tensor slice(tensor, begin, size, name=None) Extracts a portion of a tensor stack(tensors, axis=0, name='stack') Combines a list of tensors into a tensor of greater rank unstack(tensor, num=None, axis=0, name='unstack') Splits a tensor into a list of tensors of lesser rank Despite its name, reshape doesn't modify an existing tensor.
Article / Updated 06-19-2018
Many TensorFlow applications require tensors that contain random values instead of predetermined values. The tf package provides many functions for creating random-valued tensors and the following table lists five of them.Creating Tensors with Random Values Function Description random_normal(shape, mean=0.
Article / Updated 06-19-2018
If you succeeded in launching jobs locally, deploying your applications to the cloud shouldn't present any difficulty. But be mindful of two issues: You need to upload training/evaluation data to Cloud Storage. The ML Engine may not support the versions of the packages you need. Before you execute either of the applications in the ch13 directory of the TensorFlow For Dummies downloadable code, you’ll need to upload the mnist_test.
Article / Updated 06-19-2018
Just as most programs start by declaring variables, most TensorFlow applications start by creating tensors. A tensor is an array with zero or more dimensions. A zero-dimensional tensor is called a scalar, a one-dimensional tensor is called a vector, and a two-dimensional tensor is called a matrix. Keep in mind these three points about tensors: Every tensor is an instance of the Tensor class.