A substantial effort was put into Deep Learning for Maple 2021, including offering a variety of new specialty forms of neural networks.
These commands are new for Maple 2021:
New types of neural networks
The addition of Layer objects offers an easy mechanism for building specialized types of neural networks, including the following:
Convolutional neural networks: using ConvolutionLayer. These networks are often used for tasks such as image and video recognition.
Recurrent neural networks: using GatedRecurrentUnitLayer or LongShortTermMemoryLayer. These networks are often used for text processing or classification.
The new Sequential command allows one or more Layers to be stacked together, feeding the output from one layer into the next as input. This allows you to build sophisticated special-purpose neural networks by composing layers of different types.
Both Layer objects and the composite models created by the Sequential command are examples of Model objects. A Model can be fed new data to generate predictions and can also be saved to a file in the standard HDF5 file format.
Sequential Model: The Pima Diabetes Dataset
In this example we build a Sequential model with DenseLayers to model the Pima diabetes dataset, generating predictions about whether individuals will be diagnosed with a diabetes based on other diagnostic measurements included in the dataset.
This dataset is originally from the United States National Institute of Diabetes and Digestive and Kidney Diseases. All patients here are females at least 21 years old of Pima Indian heritage.
Pima Indian Diabetes Database, https://www.kaggle.com/uciml/pima-indians-diabetes-database. Data originally published in:
Smith, J.W., Everhart, J.E., Dickson, W.C., Knowler, W.C., & Johannes, R.S. (1988). Using the ADAP learning algorithm to forecast the onset of diabetes mellitus. In Proceedings of the Symposium on Computer Applications and Medical Care (pp. 261--265). IEEE Computer Society Press.
We first load the data into a DataFrame:
dataset â‰” Import⁡datasets/pima-epidemiology-diabetes.csv,base=datadir
As before, we divide the dataset into training and test data. We are attempting to predict the last column, Outcome.
training_data,test_data â‰” dataset1..600,..,dataset601..−1,..
We define a neural network using the Sequential command which stacks one or more neural network layers.
model â‰” Sequential⁡DenseLayer⁡12,activation=relu,DenseLayer⁡8,activation=relu,DenseLayer⁡1,activation=sigmoid
DeepLearning:-Model⁡<Python object: <tensorflow.python.keras.engine.sequential.Sequential object at 0x138244bb0>>
We can train the data easily with the Fit command:
<Python object: <tensorflow.python.keras.callbacks.History object at 0x13838f430>>
We now have a trained model whose accuracy we can test against the test data or against any new data. The accuracy is not especially high but nevertheless useful for predictive purposes.
To get a sense of what how this model behaves on individuals within the dataset, we can take a slice from the test data and compare the observed vs. predicted outcome.
predictions â‰” model:-Predict⁡test_data760..768,1..8
The DeepLearning package is implemented using Google TensorFlow™ and now provides access to a subset of the TensorFlow Python API, version 2.2.0.
The DeepLearning package is currently not supported on the following platforms: Macs powered by Apple's M1 chip (Apple Silicon).
Download Help Document