y_min, y_max = X[:, 1].min() - 0.5, X[:, 1].max() + 0.5
xx, yy = np.meshgrid(
    np.arange(x_min, x_max, 0.02),
    np.arange(y_min, y_max, 0.02)
)

# Predict the class for each point
Z = logreg.predict(np.c_[xx.ravel(), yy.ravel()])
Z = Z.reshape(xx.shape)

# Plot decision regions and data points
plt.pcolormesh(xx, yy, Z, cmap=plt.cm.Paired, shading='auto')
plt.scatter(X[:, 0], X[:, 1], c=y, edgecolors='k', cmap=plt.cm.Paired)

plt.xlabel('Sepal Length')
plt.ylabel('Sepal Width')
plt.title('Multi-class Logistic Regression')
plt.show()

# Display accuracy
print("Accuracy:", logreg.score(X, y))

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: