Last active
October 25, 2022 02:37
-
-
Save arwankhoiruddin/2d13fe6beb6429a0deb1187704a8b1b8 to your computer and use it in GitHub Desktop.
Generate synthetic data for classification using sklearn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.datasets import make_classification | |
import pandas as pd | |
num_column = 100 | |
num_rows = 10 | |
X, Y = make_classification(n_features=num_column, n_redundant=0, n_informative=5, n_classes=3, n_clusters_per_class=1, n_samples=num_rows) | |
cols = [] | |
for i in range(0, num_column): | |
cols.append(f'{i}') | |
x = pd.DataFrame(X, columns=cols) | |
y = pd.DataFrame(Y, columns=['Class']) | |
x['Class'] = Y | |
print(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment