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

Ed Godalle

Director Data Analytics at EY / EY Tech
linkedin profile url

I am the Director of Data Analytics with over 10+ years of IT experience. I have a background in SQL, Python, and Big Data working with Accenture, IBM, and Infosys. I am looking to enhance my skills... Read More

Relevant Projects

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

Learn to Build an End-to-End Machine Learning Pipeline - Part 2
In this Machine Learning Project, you will learn how to build an end-to-end machine learning pipeline for predicting truck delays, incorporating Hopsworks' feature store and Weights and Biases for model experimentation.

Build a Text Generator Model using Amazon SageMaker
In this Deep Learning Project, you will train a Text Generator Model on Amazon Reviews Dataset using LSTM Algorithm in PyTorch and deploy it on Amazon SageMaker.

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

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.

Build a Text Classification Model with Attention Mechanism NLP
In this NLP Project, you will learn to build a multi class text classification model with attention mechanism.

Build Real Estate Price Prediction Model with NLP and FastAPI
In this Real Estate Price Prediction Project, you will learn to build a real estate price prediction machine learning model and deploy it on Heroku using FastAPI Framework.

NLP Project to Build a Resume Parser in Python using Spacy
Use the popular Spacy NLP python library for OCR and text classification to build a Resume Parser in Python.

Tensorflow Transfer Learning Model for Image Classification
Image Classification Project - Build an Image Classification Model on a Dataset of T-Shirt Images for Binary Classification

Loan Eligibility Prediction Project using Machine learning on GCP
Loan Eligibility Prediction Project - Use SQL and Python to build a predictive model on GCP to determine whether an application requesting loan is eligible or not.