BaşlayınÜcretsiz Başlayın

Define the ensemble

In the following set of exercises, you'll work with the Indian Liver Patient Dataset from the UCI Machine learning repository.

In this exercise, you'll instantiate three classifiers to predict whether a patient suffers from a liver disease using all the features present in the dataset.

The classes LogisticRegression, DecisionTreeClassifier, and KNeighborsClassifier under the alias KNN are available in your workspace.

Bu egzersiz

Machine Learning with Tree-Based Models in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Instantiate a Logistic Regression classifier and assign it to lr.

  • Instantiate a KNN classifier that considers 27 nearest neighbors and assign it to knn.

  • Instantiate a Decision Tree Classifier with the parameter min_samples_leaf set to 0.13 and assign it to dt.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Set seed for reproducibility
SEED=1

# Instantiate lr
lr = ____(random_state=SEED)

# Instantiate knn
knn = ____(n_neighbors=____)

# Instantiate dt
dt = ____(min_samples_leaf=____, random_state=SEED)

# Define the list classifiers
classifiers = [('Logistic Regression', lr), ('K Nearest Neighbours', knn), ('Classification Tree', dt)]
Kodu Düzenle ve Çalıştır