Skip to content

Instantly share code, notes, and snippets.

@arwankhoiruddin
Last active October 25, 2022 02:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arwankhoiruddin/2d13fe6beb6429a0deb1187704a8b1b8 to your computer and use it in GitHub Desktop.
Save arwankhoiruddin/2d13fe6beb6429a0deb1187704a8b1b8 to your computer and use it in GitHub Desktop.
Generate synthetic data for classification using sklearn
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