Perceptron classifier
With scikit-learn, you can explore the perceptron classifier and relate it to other classification procedures within scikit-learn. Additionally, perceptrons are the building blocks of neural networks, which are a very prominent part of machine learning, particularly computer vision.
Getting ready
Let's get started. The process is as follows:
- Load the UCI diabetes classification dataset.
- Split the dataset into training and test sets.
- Import a perceptron.
- Instantiate the perceptron.
- Then train the perceptron.
- Try the perceptron on the testing set or preferably compute
cross_val_score
.
Load the UCI diabetes dataset:
import numpy as np import pandas as pd data_web_address = "https://archive.ics.uci.edu/ml/machine-learning-databases/pima-indians-diabetes/pima-indians-diabetes.data" column_names = ['pregnancy_x', 'plasma_con', 'blood_pressure', 'skin_mm', 'insulin', 'bmi', 'pedigree_func', 'age', 'target'] feature_names = column_names[:-1] all_data = pd.read_csv(data_web_address...