PyBrain – Importing Data For Datasets
In this article, we will learn how to import data for datasets in PyBrain.
Datasets are the data to be given to test, validate and train on networks. The type of dataset to be used depends on the tasks that we are going to do with Machine Learning. The most commonly used datasets that Pybrain supports are SupervisedDataSet and ClassificationDataSet. As their name suggests ClassificationDataSet is used in the classification problems and the SupervisedDataSet for supervised learning tasks.
Method 1: Importing Data For Datasets Using CSV Files
This is the simplest method of importing any dataset from a CSV file. For this we will be using the Panda, so importing the Pandas library is a must.
Syntax: pd.read_csv(‘path of the csv file’)
Consider the CSV file we want to import is price.csv.
Method 2: Importing Data For DatasetsUsing Sklearn
There are many premade datasets available on the Sklearn library. Three main kinds of dataset interfaces can be used to get datasets depending on the desired type of dataset.
- The dataset loaders – They can be used to load small standard datasets, described in the Toy datasets section.
Example 1: loading Iris dataset
<pybrain.datasets.classification.ClassificationDataSet at 0x7f7004812a50>
Example 2: Loading digit Dataset
<pybrain.datasets.classification.ClassificationDataSet at 0x5d4054612v80>
- The dataset fetchers – They can be used to download and load larger datasets
- The dataset generation functions – They can be used to generate controlled synthetic datasets, described in the Generated datasets section. These functions return a tuple (X, y) consisting of a n_samples * n_features NumPy array X and an array of length n_samples containing the targets y.
Please Login to comment...