DeepLearning
Estimator
estimator object
Description
Generating Estimators
Operations with Estimators
Examples
Compatibility
An Estimator is an object which encapsulates a high-level interface which encapsulates tasks for training, evaluation, and prediction with machine learning models.
To construct an Estimator object encapsulating a certain classification or regression task, see the DeepLearning Overview section on Estimators.
The following functions can be performed with an Estimator.
Evaluate
Predict
Train
Train a deep neural network classifier to recognize whether a point is within a circle centered at the origin with radius 1. We begin by generating some input data to train the model.
N≔1000:
X≔Statistics:-RandomVariable⁡Uniform⁡−1.,1.:
training_data≔DataFrame⁡Statistics:-Sample⁡X,N,2,columns=x,y:
class≔DataSeries⁡seq⁡`if`⁡training_dataxi2+training_datayi2<1,1,0,i=1..N:
We can now define an Estimator, in this case a DNNClassifier, to process the input.
with⁡DeepLearning:
fc≔seq⁡NumericColumn⁡u,shape=1,uinx,y
fc≔Feature ColumnNumericColumn(key='x', shape=(1,), default_value=None, dtype=tf.float32, normalizer_fn=None),Feature ColumnNumericColumn(key='y', shape=(1,), default_value=None, dtype=tf.float32, normalizer_fn=None)
classifier≔DNNClassifier⁡fc,hidden_units=10,20,10,num_classes=2
classifier≔DeepLearning Estimator<tensorflow_estimator.python.estimator.canned.dnn.DNNClassifierV2 object at 0x7f91b0847f50>
classifier:-Train⁡training_data,class,steps=2000,num_epochs=none,shuffle=true
DeepLearning Estimator<tensorflow_estimator.python.estimator.canned.dnn.DNNClassifierV2 object at 0x7f91b0847f50>
With our classifier thus trained, we can make predictions about additional points.
test_data≔DataFrame⁡Statistics:-Sample⁡X,5,2,columns=x,y:
result≔classifier:-Predict⁡test_data,num_epochs=1,shuffle=false:
The DeepLearning[Estimator] command was introduced in Maple 2018.
For more information on Maple 2018 changes, see Updates in Maple 2018.
See Also
DeepLearning Overview
Download Help Document