Back
Close

Computing with Data

elgeish
118.4K views

Classification

Using the iris dataset, we implement a binary classifier that predicts whether a sample is an Iris-Versicolor (denoted by the label 1) or not:

import numpy as np
from sklearn import datasets
from sklearn.linear_model import SGDClassifier
from sklearn.metrics import accuracy_score
# constant seed to reproduce the same results every time
np.random.seed(28)
iris = datasets.load_iris()
# prepare labels for binary classification task
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants