How to build a convolutional neural network using theano?

This recipe helps you to build convolutional neural network using theano.

Recipe Objective - How to build a convolutional neural network using theano?

Convolutional neural network consists of several terms:
1. filters = 4D collection of kernels
2. input_shape = (batch size (b), input channels (c), input rows (i1), input columns (i2))
3. filter_shape = (output channels (c1), input channels (c2), filter rows (k1), filter columns (k2))
4. border_mode = 'valid', 'half', 'full' or (p_1, p_2)
5. subsample = (s1, s2)

Learn to use RNN for Text Classification with Source Code

For more related projects -

/projects/data-science-projects/keras-deep-learning-projects
/projects/data-science-projects/neural-network-projects

Example -

# Importing libraries
import theano

# Creating cnn model with zero padding
output = theano.tensor.nnet.conv2d( input, filters, input_shape=(1, 1, 5, 5), filter_shape=(1, 1, 3, 3), border_mode=(1, 1), subsample=(2, 2))

# Creating cnn model with Half padding
output = theano.tensor.nnet.conv2d( input, filters, input_shape=(1, 1, 5, 5), filter_shape=(1, 1, 3, 3), border_mode='half', subsample=(1, 1))

# Creating cnn model with Full padding
output = theano.tensor.nnet.conv2d( input, filters, input_shape=(1, 1, 5, 5), filter_shape=(1, 1, 3, 3), border_mode='full', subsample=(1, 1))

# To implement 2D maxpulling
#out = theano.tensor.signal.downsample.max_pool_2d(input, ds=(2, 2))

In this way, we can create a convolutional neural network using theano.

What Users are saying..

profile image

Gautam Vermani

Data Consultant at Confidential
linkedin profile url

Having worked in the field of Data Science, I wanted to explore how I can implement projects in other domains, So I thought of connecting with ProjectPro. A project that helped me absorb this topic... Read More

Relevant Projects

Image Classification Model using Transfer Learning in PyTorch
In this PyTorch Project, you will build an image classification model in PyTorch using the ResNet pre-trained model.

MLOps Project to Build Search Relevancy Algorithm with SBERT
In this MLOps SBERT project you will learn to build and deploy an accurate and scalable search algorithm on AWS using SBERT and ANNOY to enhance search relevancy in news articles.

Recommender System Machine Learning Project for Beginners-4
Collaborative Filtering Recommender System Project - Comparison of different model based and memory based methods to build recommendation system using collaborative filtering.

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.

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 Logistic Regression Model in Python from Scratch
Regression project to implement logistic regression in python from scratch on streaming app 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.

Time Series Project to Build a Multiple Linear Regression Model
Learn to build a Multiple linear regression model in Python on Time Series Data

Build a Churn Prediction Model using Ensemble Learning
Learn how to build ensemble machine learning models like Random Forest, Adaboost, and Gradient Boosting for Customer Churn Prediction using Python

Deep Learning Project for Time Series Forecasting in Python
Deep Learning for Time Series Forecasting in Python -A Hands-On Approach to Build Deep Learning Models (MLP, CNN, LSTM, and a Hybrid Model CNN-LSTM) on Time Series Data.