API Reference¶
ImageTable¶
The ImageTable
class is a specialized version of swat.CASTable
that includes extra methods for working with images.
Constructors¶
|
Specialized CASTable for Image Data |
|
Create an ImageTable from a CASTable |
|
Create ImageTable from files in path |
Saving¶
|
Save the images in the original format under the specified directory |
|
Save the ImageTable to a sashdat file |
Utilities¶
|
Create a copy of the ImageTable |
|
Display a grid of images |
Image Processing¶
|
Crop the images in the ImageTable |
|
Resize the images in the ImageTable |
|
Generate patches from the images in the ImageTable |
|
Generate random patches from the images in the ImageTable |
|
Generate random mutations from the images in the ImageTable |
AudioTable¶
The AudioTable
class is a specialized version of swat.CASTable
that includes extra methods for working with audio data.
Constructors¶
|
CAS Table for Audio |
|
Creates an Audio table and takes care of all the necessary steps |
Creates an Audio table and takes care of all the necessary steps |
|
|
Create an AudioTable from a sashdat file |
|
Load audio files from path |
Audio Processing¶
Extracts audio features from the audio table and create a new CASTable that contains the features. |
|
|
Extracts audio features from the audio files |
|
Pre-process and loads the metadata |
Pre-process and loads the metadata |
Timeseries¶
|
Create a timeseries line plot from a CASTable or pandas DataFrame |
TimeseriesTable¶
The TimeseriesTable
class is a specialized version of swat.CASTable
that includes extra methods for working with timeseries.
Constructors¶
|
Table for preprocessing timeseries |
|
Create an TimeseriesTable from a CASTable |
|
Create an TimeseriesTable from a pandas DataFrame or Series |
|
Create an TimeseriesTable from a file on the client side. |
|
Create an TimeseriesTable from a file on the server side |
Utilities¶
Format the TimeseriesTable |
|
Accumulate the TimeseriesTable into regular consecutive intervals |
|
Prepare the subsequences that will be pass into RNN |
|
Split the dataset into training, validation and testing set |
Layers¶
|
Base class for all layers |
|
Input layer |
|
Batch normalization layer |
|
Channel Shuffle layer |
|
Concat layer Concatenate source layers’ outputs along the last dimension |
|
Convolution layer in 1D |
|
Convolution layer in 2D |
|
Transpose Convolution layer in 2D |
|
Fully connected layer |
|
Detection layer |
|
EmbeddingLoss layer |
|
FastRCNN layer |
|
FCMP layer |
|
Global Average Pooling layer in 2D |
|
Group Convolution layer in 2D |
|
Keypoints layer |
|
Layer normalization layer |
|
Multi-head attention layer from “Attention is All You Need” (Vaswani et al., NIPS 2017) |
|
Pooling layer |
|
Projection layer |
|
RNN layer |
|
Region proposal layer |
|
Residual layer Element-wise addition |
|
Reshape layer |
|
ROIPooling layer |
|
Scale layer |
|
Segmentation layer |
|
Split layer |
|
Survival layer |
|
Output layer |
Model¶
The Model
class is a specialized version of dlpy.Network
that adds training, evaluation, tuning, and feature analysis routines.
Constructors¶
|
|
|
Create a Model object from CAS table that defines a deep learning model |
|
Generate a model object from a Keras model object |
|
Generate a model object from a Caffe model proto file (e.g. *.prototxt), and convert the weights (e.g. *.caffemodel) to a SAS capable file (e.g. *.caffemodel.h5). |
|
Generate a Model object from ONNX model. |
|
Generate a model object using the model information in the sashdat file |
|
Load the deep learning model architecture from existing table |
Model Setup¶
|
Overrides the labels already in the model |
|
Assign weights to the Model object |
|
Load the weights from a data file specified by ‘path’ |
|
Load the model weights from a HDF5 file |
|
Load the model weights from a HDF5 file |
Load the weights from a file |
|
|
Attach the weights attribute to the model weights |
|
Load the weights attribute form a sashdat file |
Training¶
|
Fitting a deep learning model. |
|
Fitting a deep learning model while visulizing the fit and loss at each iteration. |
|
Tunes hyper parameters for the deep learning model. |
|
Display the training iteration history. |
Inference, Evaluation, and Analysis¶
|
Evaluate the deep learning model on a specified validation data set |
|
Make forecasts based on deep learning models trained on TimeseriesTable. |
|
Evaluate the deep learning model on a specified validation data set |
|
Evaluate the deep learning model on a specified validation data set. |
|
Plot the bar chart of the classification predictions |
|
Extract the feature maps for a single image |
|
Extract linear features for a data table from the layer specified by dense_layer |
|
Conduct a heat map analysis on table of images |
|
Display the heat maps analysis results |
Saving¶
|
Save the model to an astore object, and write it into a file. |
|
Save the model as SAS dataset |
|
Deploy the deep learning model to a data file |
Architecture Information¶
Count the total number of parameters in the model |
|
Display a table that summarizes the model architecture |
|
Display a graph that summarizes the model architecture. |
|
Return the information about the model table |
Solvers¶
|
Solver object |
|
Natural gradient solver object |
|
LBFG solver object |
|
Adam solver object |
|
Momentum solver object |
|
Vanilla solver object |
Learning Rate Scheduler¶
|
FCMP learning rate scheduler. |
|
Fixed learning rate scheduler |
|
Step learning rate scheduler The learning rate is reduced by a factor(gamma) at certain intervals(step_size) Example: # reduce learning rate every 2 epochs lr_scheduler = StepLR(learning_rate=0.0001, gamma=0.1, step_size=2) solver = MomentumSolver(lr_scheduler = lr_scheduler, clip_grad_max = 100, clip_grad_min = -100) |
|
Multiple steps learning rate scheduler The initial learning rate is decayed by gamma once the number of epoch reaches one of the steps. Example: # reduce learning rate by 0.1 at 20th, 50th, 80th epochs lr_scheduler = MultiStepLR(learning_rate=0.0001, gamma=0.1, steps=[20, 50, 80]) solver = MomentumSolver(lr_scheduler = lr_scheduler, clip_grad_max = 100, clip_grad_min = -100). |
|
Polynomial learning rate scheduler Applies a polynomial decay to the learning rate calculated by: lr = initial_lr * (1 −iter / maxiter ) ^ power |
|
Reduce learning rate on plateau learning rate scheduler Reduce learning rate when loss has stopped improving for a certain number of epochs(patience). Example: lr_scheduler = ReduceLROnPlateau(conn=sess, cool_down_iters=2, gamma=0.1, learning_rate=0.01, patience=3) solver = MomentumSolver(lr_scheduler = lr_scheduler, clip_grad_max = 100, clip_grad_min = -100). |
|
Cyclic learning rate scheduler The policy cycles the learning rate between two boundaries[learning_rate, max_lr] with a constant frequency which can be adjusted by factor. The learning rate changes after every batch. batch_size and data are necessary to determine how many batches an epoch requires. Example: lr_scheduler = CyclicLR(conn=sess, data=my_images, max_lr=0.01, batch_size=1, factor=2, learning_rate=0.0001) solver = MomentumSolver(lr_scheduler = lr_scheduler, clip_grad_max = 100, clip_grad_min = -100). |
Parameters¶
|
Data spec parameters. |
|
Data spec numeric nominal parameters. |
|
Sequence parameters object |
|
Text parameters object |
|
Gpu parameters object. |
Metrics¶
|
Computes the classification accuracy score. |
|
Computes the confusion matrix of a classification task. |
|
Plot the receiver operating characteristic (ROC) curve for binary classification tasks. |
|
Plot the precision recall(PR) curve for binary classification tasks. |
|
Compute the area under the receiver operating characteristic (ROC) curve for binary classification tasks. |
|
Compute the average precision score for binary classification tasks. |
|
Compute the f1 score of the binary classification task. f1 score is defined as |
|
Compute the explained variance score for a regression task. |
|
Compute the mean absolute error of a regression task. |
|
Compute the mean squared error of a regression task. |
|
Compute the mean squared logarithmic error of the regression tasks. |
|
Compute the R^2 (coefficient of determination) regression score. |
Feature Maps¶
Constructor¶
|
Feature Maps object |
Utilities¶
|
Display the feature maps |
Sequential Model¶
Constructor¶
|
Model for sequentially building of deep learning models |
Utilities¶
|
Add layer(s) to model |
|
Delete layer(s) from model and return it |
|
Switch the order of two layers in the model. |
Convert the layer objects into CAS action parameters |
Residual Networks¶
|
Base class for the residual blocks. |
|
Convert the block structure into DLPy layer definitions. |
|
Residual block for Residual Network with batch normalization. |
|
Convert the block structure into DLPy layer definitions. |
|
Residual block for Residual Network with batch normalization. |
|
Compile the block structure into DLPy layer definitions. |
|
Bidirectional RNN layers |
|
Convert the options into DLPy layer definition. |
Pre-Built Models for Computer Vision Tasks¶
Image Classification¶
|
Generates a deep learning model with the LeNet5 architecture. |
|
Generates a deep learning model with the VGG11 architecture. |
|
Generates a deep learning model with the VGG13 architecture. |
|
Generates a deep learning model with the VGG16 architecture. |
|
Generates a deep learning model with the VGG19 architecture. |
|
Generates a deep learning model with the ResNet18 architecture. |
|
Generates a deep learning model with the ResNet18 architecture with convolution shortcut. |
|
Generates a deep learning model with the ResNet34 architecture. |
|
Generates a deep learning model with the ResNet34 architecture with convolution shortcut. |
|
Generates a deep learning model with the ResNet50 architecture. |
|
Generates a deep learning model with the ResNet50 architecture with convolution shortcut. |
|
Generates a deep learning model with the ResNet101 architecture. |
|
Generates a deep learning model with the ResNet101 architecture with convolution shortcut. |
|
Generates a deep learning model with the SAS ResNet152 architecture. |
|
Generates a deep learning model with the ResNet152 architecture with convolution shortcut |
|
Generate a deep learning model with Wide ResNet architecture. |
|
Generates a deep learning model with the DenseNet architecture. |
|
Generates a deep learning model with the DenseNet121 architecture. |
|
Generate a deep learning model with the Darknet architecture. |
|
Generates a deep learning model with the Darknet_Reference architecture. |
|
Generates a deep learning model with the Inceptionv3 architecture with batch normalization layers. |
|
Generates a deep learning model with the MobileNetV1 architecture. |
|
Generates a deep learning model with the MobileNetV2 architecture. |
|
Generates a deep learning model with the ShuffleNetV1 architecture. |
Object Detection¶
|
Generates a deep learning model with the Yolo V1 architecture. |
|
Generates a deep learning model with the Yolov2 architecture. |
|
Generates a deep learning model with the Yolov2 architecture. |
|
Generates a deep learning model with the Tiny Yolov1 architecture. |
|
Generate a deep learning model with the Tiny Yolov2 architecture. |
|
Generates a deep learning model with the faster RCNN architecture. |
Image Embedding¶
Image Embedding Table¶
|
Specialized CASTable for Image Embedding Data. |
|
Create ImageEmbeddingTable from files in path |
|
Display a grid of images for ImageEmbeddingTable |
Summarize the distribution of different image pairs in the ImageEmbeddingTable |
Embedding Model¶
|
|
Build an embedding model based on a given model branch and model type |
|
|
Fitting a deep learning model for embedding learning. |
Deploy the deep learning model to a data file |
Pre-Built Models for NLP Tasks¶
|
Generates a text classification model |
|
Generates a text generation model. |
|
Generates a sequence labeling model. |
|
Generates a speech recognition model. |
Speech¶
Constructor¶
|
Class to do speech recognition using SAS Viya. |
Utilities¶
|
Load the RNN acoustic model. |
|
Load the N-gram language model. |
|
Transcribe the audio file into text. |
Speech Utilities¶
|
Read the audio from path into a wave_read object. |
|
Check if the input audio has the desired framerate (sampling rate). |
|
Check if the input audio has the desired sampwidth (byte width). |
|
Convert framerate (sampling rate) of the input fragment. |
|
Convert the sampwidth (byte width) of the input fragment between 1-, 2-, 3-, 4-byte formats. |
|
Calculate the number of frames of every segment split from the audio input. |
|
Segment the audio into pieces shorter than segment_len. |
|
Remove the temporary listing file and the temporary audio files. |
|
Check if the input audio has 2 channels (stereo). |
|
Convert stereo fragment to mono. |
|
Play a local audio file using soundfile and sounddevice. |
Display spectrogram for a local audio file using soundfile. |
|
Display raw data for a local audio file using soundfile. |
|
|
Convert a local audio file into a wav format that only contains 1 channel with 16 bits and 16K HZ. |
|
Convert audio files under a local path into wave files that only contains 1 channel with 16 bits and 16K HZ. |
Convert a local audio file into a png format with spectrogram. |
|
|
Convert audio files under a local path into the images (PNG) that contain spectrogram. |
Splitting Utilities¶
|
Split image data into training and testing sets |
|
Split image data into training and testing sets |