Javatpoint Logo
Javatpoint Logo

How to Import Datasets using sklearn in PyBrain

In this tutorial, we will explain how to import datasets with Sklearn within PyBrain.

A Dataset can be described as the collection of data that could be used to test, validate as well as train networks. When compared with arrays that are considered to be more flexible, a dataset is thought of as more flexible and easier to work with. A dataset is akin to a two-dimensional array. The data sets are used to execute tasks of machine learning.

Libraries we would be needing for this tutorial are:

  • sklearn
  • Pybrain

Syntax to install these libraries:

Example 1

In this example, firstly, we have imported packages datasets from the sklearn library and ClassificationDataset from pybrain.datasets. After that, we loaded the numbers dataset. In the next line, we will define the feature variables and targets variables. We then create an algorithm for the classification of the dataset by creating 64 inputs, 1 output as well as 15 classes. We then add information to the dataset we created.

Code:

Output:

How to Import Datasets using sklearn in PyBrain

Example 2

In this example, firstly, we have imported packages datasets from the sklearn library and ClassificationDataset from pybrain.datasets. After that, we loaded the Iris dataset. In the next line, we will define the feature variables and the targets variables. Then, we create an algorithm for classifying the dataset by defining four inputs, one output, and two classes. After that, we added data to the newly created dataset.

Code:

Output:

How to Import Datasets using sklearn in PyBrain

Conclusion:

In this tutorial we have discussed how to import various datasets using sklearn library in PyBrain.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA