'How to change output X in sklearn classification?
I am generating a Dataset with the make_classification from sklearn.
I want my output in X to be either 1 or 0 (1 for positive, 0 for negative). Is this possible?
plt.subplot(121)
plt.title("2 informative features, 1 cluster/class", fontsize="small")
X1, Y1 = make_classification(
n_samples=1000,
n_features=2,
n_redundant=0,
n_informative=2,
n_clusters_per_class=1,
weights=[0.92,0.098]
)
plt.scatter(X1[:, 0], X1[:, 1], marker="o", c=Y1, s=25, edgecolor="k")
plt.subplot(122)
plt.title("2 informative features, 2 clusters/class", fontsize="small")
X2, Y2 = make_classification(
n_samples=1000,
n_features=2,
n_redundant=0,
n_informative=2,
weights=[0.92,0.098]
)
plt.scatter(X2[:, 0], X2[:, 1], marker="o", c=Y2, s=25, edgecolor="k")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
