Predict - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

DeepLearning/Model/Predict

predict with model object

 Calling Sequence mdl:-Predict(x, opts)

Parameters

 mdl - a Model object x - (optional) list, Array, DataFrame, DataSeries, Matrix, or Vector; input data

Options

 • batchsize = posint or none
 Number of samples per gradient update. If unspecified, batchsize will default to 32.
 • steps = integer or none
 Total number of steps (batches of samples) before declaring the evaluation round finished. Ignored with the default value of none.

Description

 • Predict constructs an executable version of a Model which can be used for training, testing, and prediction.

Details

 • The implementation of Predict uses the predict method from tf.keras.Model in the TensorFlow Python API. Consult the TensorFlow Python API documentation for tf.keras.Model for more information on its use during TensorFlow computations.

Examples

 > $\mathrm{with}\left(\mathrm{DeepLearning}\right)$
 $\left[{\mathrm{AddMultiple}}{,}{\mathrm{ApplyOperation}}{,}{\mathrm{BatchNormalizationLayer}}{,}{\mathrm{BidirectionalLayer}}{,}{\mathrm{BucketizedColumn}}{,}{\mathrm{CategoricalColumn}}{,}{\mathrm{Classify}}{,}{\mathrm{Concatenate}}{,}{\mathrm{Constant}}{,}{\mathrm{ConvolutionLayer}}{,}{\mathrm{DNNClassifier}}{,}{\mathrm{DNNLinearCombinedClassifier}}{,}{\mathrm{DNNLinearCombinedRegressor}}{,}{\mathrm{DNNRegressor}}{,}{\mathrm{Dataset}}{,}{\mathrm{DenseLayer}}{,}{\mathrm{DropoutLayer}}{,}{\mathrm{EinsteinSummation}}{,}{\mathrm{EmbeddingLayer}}{,}{\mathrm{Estimator}}{,}{\mathrm{FeatureColumn}}{,}{\mathrm{Fill}}{,}{\mathrm{FlattenLayer}}{,}{\mathrm{GRULayer}}{,}{\mathrm{GatedRecurrentUnitLayer}}{,}{\mathrm{GetDefaultGraph}}{,}{\mathrm{GetDefaultSession}}{,}{\mathrm{GetEagerExecution}}{,}{\mathrm{GetVariable}}{,}{\mathrm{GradientTape}}{,}{\mathrm{IdentityMatrix}}{,}{\mathrm{LSTMLayer}}{,}{\mathrm{Layer}}{,}{\mathrm{LinearClassifier}}{,}{\mathrm{LinearRegressor}}{,}{\mathrm{LongShortTermMemoryLayer}}{,}{\mathrm{MaxPoolingLayer}}{,}{\mathrm{Model}}{,}{\mathrm{NumericColumn}}{,}{\mathrm{OneHot}}{,}{\mathrm{Ones}}{,}{\mathrm{Operation}}{,}{\mathrm{Optimizer}}{,}{\mathrm{Placeholder}}{,}{\mathrm{RandomTensor}}{,}{\mathrm{ResetDefaultGraph}}{,}{\mathrm{Restore}}{,}{\mathrm{Save}}{,}{\mathrm{Sequential}}{,}{\mathrm{Session}}{,}{\mathrm{SetEagerExecution}}{,}{\mathrm{SetRandomSeed}}{,}{\mathrm{SoftMaxLayer}}{,}{\mathrm{SoftmaxLayer}}{,}{\mathrm{Tensor}}{,}{\mathrm{Variable}}{,}{\mathrm{Variables}}{,}{\mathrm{VariablesInitializer}}{,}{\mathrm{Zeros}}\right]$ (1)
 > $\mathrm{v1}≔\mathrm{Vector}\left(8,i↦i,\mathrm{datatype}=\mathrm{float}\left[8\right]\right)$
 ${\mathrm{v1}}{≔}\left[\begin{array}{c}{1.}\\ {2.}\\ {3.}\\ {4.}\\ {5.}\\ {6.}\\ {7.}\\ {8.}\end{array}\right]$ (2)
 > $\mathrm{v2}≔\mathrm{Vector}\left(8,\left[-1.0,1.0,5.0,11.0,19.0,29.0,41.0,55.0\right],\mathrm{datatype}=\mathrm{float}\left[8\right]\right)$
 ${\mathrm{v2}}{≔}\left[\begin{array}{c}{-1.}\\ {1.}\\ {5.}\\ {11.}\\ {19.}\\ {29.}\\ {41.}\\ {55.}\end{array}\right]$ (3)
 > $\mathrm{model}≔\mathrm{Sequential}\left(\left[\mathrm{DenseLayer}\left(1,\mathrm{inputshape}=\left[1\right]\right)\right]\right)$
 ${\mathrm{model}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Model}}\\ {\mathrm{}}\end{array}\right]$ (4)
 > $\mathrm{model}:-\mathrm{Compile}\left(\mathrm{optimizer}="sgd",\mathrm{loss}="mean_squared_error"\right)$
 > $\mathrm{model}:-\mathrm{Fit}\left(\mathrm{v1},\mathrm{v2},\mathrm{epochs}=500\right)$
 ${">"}$ (5)
 > $\mathrm{model}:-\mathrm{Predict}\left(\left[10\right]\right)$
 $⟨⟨{62.1977691650391}⟩⟩$ (6)

Compatibility

 • The DeepLearning/Model/Predict command was introduced in Maple 2021.
 • For more information on Maple 2021 changes, see Updates in Maple 2021.