code: def main():
      data = datasets.load_digits()
      X = data.data
      y = data.target
  
      digit1 = 1
      digit2 = 8
      idx = np.append(
          np.where(y == digit1)[0], np.where(y == digit2)[0]
      )
      y = data.target[idx]
      # Change labels to {-1, 1}
      y[y == digit1] = -1
      y[y == digit2] = 1
      X = data.data[idx]
  
      X_train, X_test, y_train, y_test = train_test_split(
          X, y, test_size=0.5
      )
  
      # Adaboost classification with 5 weak classifiers
      clf = Adaboost(n_clf=5)
      clf.fit(X_train, y_train)
      y_pred = clf.predict(X_test)
  
      accuracy = accuracy_score(y_test, y_pred)
      print("Accuracy:", accuracy)
  
      # Reduce dimensions to 2d using pca and plot the results
      Plot().plot_in_2d(
          X_test, y_pred, title="Adaboost", accuracy=accuracy
      )
  
file_path: ML-From-Scratch/mlfromscratch/supervised_learning/adaboost.py
imports: from __future__ import division, print_function
  import numpy
  import math
  from sklearn import datasets
  import matplotlib.pyplot
  import pandas
  from mlfromscratch.utils import train_test_split, accuracy_score, Plot
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types