How to use Softplus activation in TF learn

This recipe helps you use Softplus activation in TF learn

Recipe Objective

This recipe explains how to use Softplus.

Build a Multi Touch Attribution Model in Python with Source Code

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

Softplus

It evaluates log(exp(features) + 1)
Its syntax is: tflearn.activations.softplus (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 Softplus 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.softplus(tf.add(tf.matmul(X, u), a))
       tflearn.summaries.monitor_activation(x)
       X = tflearn.softplus(tf.add(tf.matmul(X, v), b))
       tflearn.summaries.monitor_activation(x)
       X = tf.nn.softplus(tf.add(tf.matmul(X, w), c))
       return X
    my_net = net(x)

What Users are saying..

profile image

Ameeruddin Mohammed

ETL (Abintio) developer at IBM
linkedin profile url

I come from a background in Marketing and Analytics and when I developed an interest in Machine Learning algorithms, I did multiple in-class courses from reputed institutions though I got good... Read More

Relevant Projects

Image Segmentation using Mask R-CNN with Tensorflow
In this Deep Learning Project on Image Segmentation Python, you will learn how to implement the Mask R-CNN model for early fire detection.

NLP Project for Multi Class Text Classification using BERT Model
In this NLP Project, you will learn how to build a multi-class text classification model using using the pre-trained BERT model.

Build a Multi Touch Attribution Machine Learning Model in Python
Identifying the ROI on marketing campaigns is an essential KPI for any business. In this ML project, you will learn to build a Multi Touch Attribution Model in Python to identify the ROI of various marketing efforts and their impact on conversions or sales..

Machine Learning Project to Forecast Rossmann Store Sales
In this machine learning project you will work on creating a robust prediction model of Rossmann's daily sales using store, promotion, and competitor data.

Learn Hyperparameter Tuning for Neural Networks with PyTorch
In this Deep Learning Project, you will learn how to optimally tune the hyperparameters (learning rate, epochs, dropout, early stopping) of a neural network model in PyTorch to improve model performance.

Time Series Forecasting with LSTM Neural Network Python
Deep Learning Project- Learn to apply deep learning paradigm to forecast univariate time series data.

Skip Gram Model Python Implementation for Word Embeddings
Skip-Gram Model word2vec Example -Learn how to implement the skip gram algorithm in NLP for word embeddings on a set of documents.

Build a Music Recommendation Algorithm using KKBox's Dataset
Music Recommendation Project using Machine Learning - Use the KKBox dataset to predict the chances of a user listening to a song again after their very first noticeable listening event.

Deep Learning Project for Beginners with Source Code Part 1
Learn to implement deep neural networks in Python .

Insurance Pricing Forecast Using XGBoost Regressor
In this project, we are going to talk about insurance forecast by using linear and xgboost regression techniques.