Introduction to Scikit-learn

Scikit-learn - Chapter 1

Scikit-learn Tutorial

We appreciate your patience while we actively develop and enhance our content for a better experience.

Sample Code
import numpy as np
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import accuracy_score

def main():
    print("This program demonstrates how to use Scikit-learn to create a decision tree classifier and make predictions on the Iris dataset.")

    # Load the Iris dataset
    iris = datasets.load_iris()
    X =
    y =

    # Split the dataset into training and testing sets
    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

    # Create a decision tree classifier and fit it to the training data
    clf = DecisionTreeClassifier(), y_train)

    # Make predictions on the testing set
    y_pred = clf.predict(X_test)

    # Calculate the accuracy of the classifier
    accuracy = accuracy_score(y_test, y_pred)

    print(f"Accuracy of the decision tree classifier: {accuracy * 100:.2f}%")

if __name__ == "__main__":