How to create a dataset using PyBrain

This recipe helps you create a dataset using PyBrain

Recipe Objective - How to create a dataset using PyBrain?

Datasets are data to be given to test, validate and train on networks.
To create a dataset, we need to use the pybrain dataset package: pybrain.datasets.
Pybrain supports dataset classes like SupervisedDataset, SequentialDataset, ClassificationDataSet. We are going to use SupervisedDataset to create our data set. The dataset to use depends on the machine learning task that the user is trying to implement. SupervisedDataset is the simplest, and we will use the same here.

Apply Machine Learning to Demand Forecasting Data Science Problems

For more related projects -

https://www.projectpro.io/projects/data-science-projects/tensorflow-projects
https://www.projectpro.io/projects/data-science-projects/keras-deep-learning-projects

Let's try to create an AND truth table. The inputs given are like a two-dimensional array, and we get 1 output. Here the input becomes the size, and the target becomes the output, which is 1. So the inputs that are used for our dataset are 2,1.

# importing supervised dataset
from pybrain.datasets import SupervisedDataSet

# Creating object
supervised_dataset = SupervisedDataSet(2, 1)

# AND table
and_table = [ [(0,0), (0,)], [(0,1), (0,)], [(1,0), (0,)], [(1,1), (1,)], ]

# Adding sample from and_table into supervised_dataset
for input, target in and_table:
  supervised_dataset.addSample(input, target)

print("Input=>\n", supervised_dataset['input'])
print("")
print("Target=>\n", supervised_dataset['target'])

Output -
Input=>
 [[0. 0.]
 [0. 1.]
 [1. 0.]
 [1. 1.]]

Target=>
 [[0.]
 [0.]
 [0.]
 [1.]]

In this way, we can create a dataset using PyBrain.

What Users are saying..

profile image

Abhinav Agarwal

Graduate Student at Northwestern University
linkedin profile url

I come from Northwestern University, which is ranked 9th in the US. Although the high-quality academics at school taught me all the basics I needed, obtaining practical experience was a challenge.... Read More

Relevant Projects

Build and Deploy an AI Resume Analyzer with OpenAI and Azure
In this AI Resume Analyzer project, you will learn to build and deploy AI resume analyzer that helps job seekers assess how effectively their resumes match job descriptions using OpenAI's language models and Azure's cloud infrastructure.

Build a Autoregressive and Moving Average Time Series Model
In this time series project, you will learn to build Autoregressive and Moving Average Time Series Models to forecast future readings, optimize performance, and harness the power of predictive analytics for sensor data.

GCP MLOps Project to Deploy ARIMA Model using uWSGI Flask
Build an end-to-end MLOps Pipeline to deploy a Time Series ARIMA Model on GCP using uWSGI and Flask

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.

Hands-On Approach to Master PyTorch Tensors with Examples
In this deep learning project, you will learn how to perform various operations on the building block of PyTorch : Tensors.

Build a CNN Model with PyTorch for Image Classification
In this deep learning project, you will learn how to build an Image Classification Model using PyTorch CNN

PyTorch Project to Build a GAN Model on MNIST Dataset
In this deep learning project, you will learn how to build a GAN Model on MNIST Dataset for generating new images of handwritten digits.

Build an optimal End-to-End MLOps Pipeline and Deploy on GCP
Learn how to build and deploy an end-to-end optimal MLOps Pipeline for Loan Eligibility Prediction Model in Python on GCP

End-to-End Snowflake Healthcare Analytics Project on AWS-2
In this AWS Snowflake project, you will build an end to end retraining pipeline by checking Data and Model Drift and learn how to redeploy the model if needed

Locality Sensitive Hashing Python Code for Look-Alike Modelling
In this deep learning project, you will find similar images (lookalikes) using deep learning and locality sensitive hashing to find customers who are most likely to click on an ad.