How to use SELU activation in TF learn

This recipe helps you use SELU activation in TF learn

Recipe Objective

This recipe explains how to use SELU.

Importing Libraries

We'll import tflearn, tensorflow as tf and tflearn.datasets.mnist as mnist.

import tflearn
import tensorflow as tf
import tflearn.datasets.mnist as mnist
from __future__ import division, print_function, absolute_import

SELU

SELU stands for Scaled Exponential Linear Unit.
Its syntax is: tflearn.activations.selu (x)
We have combined TFLearn built-in ops with Tensorflow graph. We have built this using MNIST Dataset.
To create a multilayer perceptron we have used TFLearn SELU activations ops.

with tf.Graph().as_default():

    x = tf.placeholder("float", [None, 784])
    y = tf.placeholder("float", [None, 10])
    u = tf.Variable(tf.random_normal([784, 256]))
    v = tf.Variable(tf.random_normal([256, 256]))
    w = tf.Variable(tf.random_normal([256, 10]))
    a = tf.Variable(tf.random_normal([256]))
    b = tf.Variable(tf.random_normal([256]))
    c = tf.Variable(tf.random_normal([10]))
    def net(X):
       X = tflearn.selu(tf.add(tf.matmul(X, u), a))
       tflearn.summaries.monitor_activation(x)
       X = tflearn.selu(tf.add(tf.matmul(X, v), b))
       tflearn.summaries.monitor_activation(x)
       X = tf.nn.selu(tf.add(tf.matmul(X, w), c))
       return X
    my_net = net(x)

What Users are saying..

profile image

Ray han

Tech Leader | Stanford / Yale University
linkedin profile url

I think that they are fantastic. I attended Yale and Stanford and have worked at Honeywell,Oracle, and Arthur Andersen(Accenture) in the US. I have taken Big Data and Hadoop,NoSQL, Spark, Hadoop... Read More

Relevant Projects

Census Income Data Set Project-Predict Adult Census Income
Use the Adult Income dataset to predict whether income exceeds 50K yr based oncensus data.

Azure Deep Learning-Deploy RNN CNN models for TimeSeries
In this Azure MLOps Project, you will learn to perform docker-based deployment of RNN and CNN Models for Time Series Forecasting on Azure Cloud.

Build a Customer Churn Prediction Model using Decision Trees
Develop a customer churn prediction model using decision tree machine learning algorithms and data science on streaming service data.

AWS MLOps Project for ARCH and GARCH Time Series Models
Build and deploy ARCH and GARCH time series forecasting models in Python on AWS .

OpenCV Project for Beginners to Learn Computer Vision Basics
In this OpenCV project, you will learn computer vision basics and the fundamentals of OpenCV library using Python.

Predict Churn for a Telecom company using Logistic Regression
Machine Learning Project in R- Predict the customer churn of telecom sector and find out the key drivers that lead to churn. Learn how the logistic regression model using R can be used to identify the customer churn in telecom dataset.

Many-to-One LSTM for Sentiment Analysis and Text Generation
In this LSTM Project , you will build develop a sentiment detection model using many-to-one LSTMs for accurate prediction of sentiment labels in airline text reviews. Additionally, we will also train many-to-one LSTMs on 'Alice's Adventures in Wonderland' to generate contextually relevant text.

Model Deployment on GCP using Streamlit for Resume Parsing
Perform model deployment on GCP for resume parsing model using Streamlit App.

Medical Image Segmentation Deep Learning Project
In this deep learning project, you will learn to implement Unet++ models for medical image segmentation to detect and classify colorectal polyps.

NLP and Deep Learning For Fake News Classification in Python
In this project you will use Python to implement various machine learning methods( RNN, LSTM, GRU) for fake news classification.