Skip to main content

SAS Deep Learning Interface

Project description

DLPy - SAS Viya Deep Learning API for Python

SAS Deep Learning Icon

An efficient way to apply deep learning methods to image, text, and audio data.

SAS Viya Version Python Version Python Version

Overview

DLPy is a high-level Python library for the SAS Deep learning features available in SAS Viya. DLPy is designed to provide an efficient way to apply deep learning methods to image, text, and audio data. DLPy APIs are created following the Keras APIs with a touch of PyTorch flavor.

Recently Added Features

  • DLPy now supports the DLModelzoo action through the use of MZModel.
  • Real-time plots for hyper-parameter tuning are available with DLModelzoo.
  • New examples are available for APIs with DLModelzoo.
  • Segmentation models can produce PNG/base64 output.
  • Additional pre-defined network architectures are available. Examples include ENet and Efficient-Net.

Prerequisites

  • You must use Python version 3.3 or greater.
  • You must install SAS Scripting Wrapper for Analytics Transfer (SWAT) for Python. You can install the package from PyPI by using the command pip install swat or from the SAS conda repository by using conda install -c sas-institute swat.
  • You must have access to a SAS Viya 4.0 environment that has Machine Learning licensed.
  • To use time series APIs, you must have access to either SAS Econometrics or SAS Visual Forecasting.
  • You must have a user login to your SAS Viya back-end. See your system administrator for details if you do not have a SAS Viya account.
  • It is recommended that you install the open source graph visualization software called Graphviz to enable graphic visualizations of the DLPy deep learning models.
  • Install DLPy using pip install sas-dlpy or conda install -c sas-institute sas-dlpy.

SAS Viya and DLPY Versions

DLPy versions are aligned with SAS Viya versions. Below is the versions matrix.

DLPy SAS Viya
1.3.x 4.0
1.2.x 3.5
1.1.x 3.4
1.0.x 3.4

The table above can be read as follows: DLPy versions between 1.0 (inclusive) to 1.1 (exclusive) are designed to work with the SAS Viya 3.4.

External Libraries

The following versions of external libraries are supported:

  • ONNX: versions >= 1.5.0
  • Keras: versions >= 2.1.3

Getting Started

To connect to a SAS Viya server, import SWAT and use the swat.CAS class to create a connection:

Note: The default CAS port is 5570.

>>> import swat
>>> sess = swat.CAS('mycloud.example.com', 5570)

Next, import the DLPy package, and then build a simple convolutional neural network (CNN) model.

Import DLPy model functions:

>>> from dlpy import Model, Sequential
>>> from dlpy.layers import *

Use DLPy to create a sequential model and name it Simple_CNN:

>>> model1 = Sequential(sess, model_table = 'Simple_CNN')

Define an input layer to add to model1:

# The input shape contains RGB images (3 channels)
# The model images are 224 px in height and 224 px in width

>>> model1.add(InputLayer(3,224,224))

NOTE: Input layer added.

Add a 2-D convolution layer and a pooling layer:

# Add 2-Dimensional Convolution Layer to model1
# that has 8 filters and a kernel size of 7. 

>>> model1.add(Conv2d(8,7))

NOTE: Convolutional layer added.

# Add Pooling Layer of size 2

>>> model1.add(Pooling(2))

NOTE: Pooling layer added.

Add an additional pair of 2-D convolution and pooling layers:

# Add another 2D convolution Layer that has 8 filters and a kernel size of 7 

>>> model1.add(Conv2d(8,7))

NOTE: Convolutional layer added.

# Add a pooling layer of size 2 to # complete the second pair of layers. 

>>> model1.add(Pooling(2))

NOTE: Pooling layer added.

Add a fully connected layer:

# Add Fully-Connected Layer with 16 units

>>> model1.add(Dense(16))

NOTE: Fully-connected layer added.

Finally, add the output layer:

# Add an output layer that has 2 nodes and uses
# the Softmax activation function 

>>> model1.add(OutputLayer(act='softmax',n=2))

NOTE: Output layer added.
NOTE: Model compiled successfully 

Additional Resources

Contributing

Have something cool to share? We gladly accept pull requests on GitHub! See the Contributor Agreement for details.

Licensing

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You can obtain a copy of the License at LICENSE.txt

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sas-dlpy-1.3.0.tar.gz (51.8 MB view details)

Uploaded Source

File details

Details for the file sas-dlpy-1.3.0.tar.gz.

File metadata

  • Download URL: sas-dlpy-1.3.0.tar.gz
  • Upload date:
  • Size: 51.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.4

File hashes

Hashes for sas-dlpy-1.3.0.tar.gz
Algorithm Hash digest
SHA256 8d922026f19d7f1e12221032cec6773dcba5299bc83aa48a100cb2898e0579e4
MD5 c95642947819e5d87dd74a6ac63bd9c6
BLAKE2b-256 d9152f30e3ee8f4f643201fc49ff142f1c30d364ac85f2ca89e8a746774bb061

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page