![]() |
VOOZH | about |
Whenever we think of Machine Learning, the first thing that comes to our mind is a dataset. While there are many datasets that you can find on websites such as Kaggle, sometimes it is useful to extract data on your own and generate your own dataset. Generating your own dataset gives you more control over the data and allows you to train your machine-learning model. In this article, we will generate random datasets using sklearn.datasets library in Python.
Example 1: The 2d binary classification data generated by make_circles() have a spherical decision boundary.
Output:
Example 2: Two interlocking half circles represent the 2d binary classification data produced by the make_moons() function.
Output:
Example 1: Data generated by the function make_blobs() are blobs that can be utilized for clustering.
Output:
Example 2: To generate data by the function make_classification() need to balance between n_informative, n_redundant and n_classes attributes X[:, :n_informative + n_redundant + n_repeated]
Output:
Example 3:A random multi-label classification data is created by the function make make_multilabel_classification()
Output:
X1 X2 Label1 Label2 0 14.0 34.0 0 1 1 30.0 22.0 1 1 2 29.0 19.0 1 1 3 21.0 19.0 1 1 4 16.0 32.0 0 1
Example 1: Generate a 1-dimensional feature and target for linear regression using make_regression
Output:
Output:
Output: