3: Model Building¶
Introduction¶
In this session we shall try to understand the different types of machine learning, the most commonly used models, python packages used in machine learning and much more!
Python Packages¶
The following are the python packages that are most commonly used in machine learning:
Sklearn
numpy
Pandas
Tensorflow
Keras
Pytorch
OpenCV
Pillow
Beautiful Soup
Requests
Although there are many more, these are commonly used in the industry and that's why they're in the list.
Types of Machine Learning¶
Machine Learning can broadly be classified into two types:
- Supervised Learning
- Unsupervised Learning.
Here's a brief explanantion of what they are.
Supervised Learning¶
As the name indicates, supervised learning involves machine learning algorithms that learn under the presence of a supervisor. Supervised machine learning relies on labelled input and output training data.
Examples:
- Predicting house prices
- Image classification
- Weather Forecasting
- Text classification
Unsupervised Learning¶
In unsupervised learning, even though we do not have any labels for data points, we do have the actual data points. This means we can draw references from observations in the input data.
Unsupervised learning processes unlabelled or raw data.
Examples:
- Finding customer segments
- Reducing the complexity of a problem
- Feature selection
Throughout this session we shall focus mostly on the different types of supervised learning.
Commonly Used Machine Learning Algorithms¶
Supervised Learning¶
- Linear Regression
- Multiple Regression
- Naive Bayesian Model - Decision Trees
- Random Forest
- Neural Networks
- Support Vector Machines
- KNN (K Nearest Neighbor)
Unsupervised Learning¶
- K-Means Clustering
- Association
Over the course of this session, we shall understand Linear regression and KNN.
1. Linear Regression¶
Linear Regression is usually the first machine learning algorithm that every data scientist comes across. It is a simple model but everyone needs to master it as it lays the foundation for other machine learning algorithms.
It can be used to forecast sales in the coming months by analyzing the sales data for previous months. It can also be used to gain various insights about customer behaviour.
Here are the 5 basic steps when implementing linear regression.
- Import the packages and classes you need.
- Provide data to work with and eventually do appropriate transformations.
- Create a regression model and fit it with existing data.
- Check the results of model fitting to know whether the model is satisfactory.
- Apply the model for predictions.
These steps are more or less general for most of the regression approaches and implementations.
We shall try to predict the grades of the students using the example given below.
Step 1: Import packages and classes¶
import pandas as pd
import numpy as np
import sklearn
from sklearn import linear_model
from sklearn.utils import shuffle
The class sklearn.linear_model.LinearRegression
will be used to perform linear regression and make predictions accordingly.
Step 2: Provide data¶
data = pd.read_csv("student-mat.csv", sep=";")
# Since our data is seperated by semicolons we need to do sep=";"b
data.head()
school | sex | age | address | famsize | Pstatus | Medu | Fedu | Mjob | Fjob | ... | famrel | freetime | goout | Dalc | Walc | health | absences | G1 | G2 | G3 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | GP | F | 18 | U | GT3 | A | 4 | 4 | at_home | teacher | ... | 4 | 3 | 4 | 1 | 1 | 3 | 6 | 5 | 6 | 6 |
1 | GP | F | 17 | U | GT3 | T | 1 | 1 | at_home | other | ... | 5 | 3 | 3 | 1 | 1 | 3 | 4 | 5 | 5 | 6 |
2 | GP | F | 15 | U | LE3 | T | 1 | 1 | at_home | other | ... | 4 | 3 | 2 | 2 | 3 | 3 | 10 | 7 | 8 | 10 |
3 | GP | F | 15 | U | GT3 | T | 4 | 2 | health | services | ... | 3 | 2 | 2 | 1 | 1 | 5 | 2 | 15 | 14 | 15 |
4 | GP | F | 16 | U | GT3 | T | 3 | 3 | other | other | ... | 4 | 3 | 2 | 1 | 2 | 5 | 4 | 6 | 10 | 10 |
5 rows × 33 columns
Now we need to choose the most suitable coulmns.
data = data[["G1", "G2", "G3", "studytime", "failures", "absences"]]
Step 3: Create a model and fit it¶
predict = "G3"
X = np.array(data.drop([predict], 1)) # Features
y = np.array(data[predict]) # Labels
x_train, x_test, y_train, y_test = sklearn.model_selection.train_test_split(X, y, test_size = 0.1)
linear = linear_model.LinearRegression()
The function LinearRegression()
has other paramaters such as:
fit_intercept
is a Boolean (True by default) that decides whether to calculate the intercept 𝑏₀ (True) or consider it equal to zero (False).normalize
is a Boolean (False by default) that decides whether to normalize the input variables (True) or not (False).copy_X
is a Boolean (True by default) that decides whether to copy (True) or overwrite the input variables (False).n_jobs
is an integer or None (default) and represents the number of jobs used in parallel computation. None usually means one job and -1 to use all processors.
linear.fit(x_train, y_train)
acc = linear.score(x_test, y_test) # acc stands for accuracy
print(acc)
0.8567890220083849
print('Coefficient: \n', linear.coef_) # These are each slope value
print('Intercept: \n', linear.intercept_) # This is the intercept
Coefficient: [ 0.16672657 0.96369032 -0.19684191 -0.27743914 0.03254111] Intercept: -1.438174445680957
Step 4: Get results¶
Once you have your model fitted, you can get the results to check whether the model works satisfactorily and interpret it.
print('Coefficient: \n', linear.coef_) # These are each slope value
print('Intercept: \n', linear.intercept_) # This is the intercept
Coefficient: [ 0.16672657 0.96369032 -0.19684191 -0.27743914 0.03254111] Intercept: -1.438174445680957
print('coefficient of determination:', r_sq)
coefficient of determination: 0.7158756137479542
When you’re applying .score()
, the arguments are also the predictor x
and regressor y
, and the return value is 𝑅²
.
We can get the intercept and the slope of the line using the model.intercept_
and model.coef_
commands.
Step 5: Predict response¶
Once there is a satisfactory model, you can use it for predictions with either existing or new data.
predictions = linear.predict(x_test) # Gets a list of all predictions
for x in range(len(predictions)):
print(f"Predicted: {predictions[x]}, actual: {y_test[x]}")
Predicted: 3.4696627554374073, actual: 5 Predicted: 5.476917103456871, actual: 7 Predicted: 8.83403139834456, actual: 10 Predicted: 7.648808981949109, actual: 8 Predicted: 9.238906601772648, actual: 10 Predicted: 9.334104148442279, actual: 10 Predicted: 12.331671007054274, actual: 14 Predicted: 7.992925608753779, actual: 8 Predicted: 12.096712937861891, actual: 12 Predicted: 7.621421999133414, actual: 7 Predicted: 14.719412956813049, actual: 15 Predicted: 7.0496018426953455, actual: 8 Predicted: 12.156178819434402, actual: 13 Predicted: 9.370666302230253, actual: 9 Predicted: -0.8616141579668186, actual: 0 Predicted: 5.096238322864227, actual: 8 Predicted: 11.733144452915091, actual: 11 Predicted: 18.545761149340354, actual: 18 Predicted: 11.222301251854967, actual: 11 Predicted: 13.760574175098895, actual: 14 Predicted: 3.709513637268808, actual: 0 Predicted: 8.435496039599911, actual: 10 Predicted: 9.602475086719448, actual: 10 Predicted: 7.211476879588844, actual: 0 Predicted: 8.537140403621626, actual: 10 Predicted: 16.99154509819021, actual: 18 Predicted: 10.269274411072622, actual: 12 Predicted: 14.159109533843544, actual: 14 Predicted: 3.351477274798544, actual: 0 Predicted: 5.6563461335631535, actual: 9 Predicted: -0.1645925245091111, actual: 0 Predicted: 9.602475086719448, actual: 10 Predicted: 9.465863848899886, actual: 10 Predicted: 14.024093576014108, actual: 14 Predicted: -0.6346569108395803, actual: 0 Predicted: 9.752091365329056, actual: 10 Predicted: 3.679398300832916, actual: 0 Predicted: 7.539691699613883, actual: 10 Predicted: 7.435243566735831, actual: 8 Predicted: 15.719772402345772, actual: 15
Now we can see the results predicted by our model and the actual result in the model.
2. KNN
(K-Nearest Neighbours)¶
KNN stands for K-Nearest Neighbors. KNN is a machine learning algorithm used for classifying data. Rather than coming up with a numerical prediction such as a students grade or stock price it attempts to classify data into certain categories.
In the coming sections, we will be using this algorithm to classify cars in 4 categories based upon certain features.
How does KNN Work?¶
In short, K-Nearest Neighbors works by looking at the K closest points to the given data point (the one we want to classify) and picking the class that occurs the most to be the predicted value. This is why this algorithm typically works best when we can identify clusters of points in our data set
Step 1 : Importing Modules¶
from sklearn import preprocessing
import sklearn
from sklearn.utils import shuffle
from sklearn.neighbors import KNeighborsClassifier
import pandas as pd
import numpy as np
from sklearn import linear_model, preprocessing
Step 2 : Loading Data¶
data = pd.read_csv("car.data")
print(data.head()) # To check if our data is loaded correctly
buying maint door persons lug_boot safety class 0 vhigh vhigh 2 2 small low unacc 1 vhigh vhigh 2 2 small med unacc 2 vhigh vhigh 2 2 small high unacc 3 vhigh vhigh 2 2 med low unacc 4 vhigh vhigh 2 2 med med unacc
We now need to convert the string data into some kind of a number so that we can train the our KNN model.
le = preprocessing.LabelEncoder()
The method fit_transform() takes a list (each of our columns) and will return to us an array containing our new values.
buying = le.fit_transform(list(data["buying"]))
maint = le.fit_transform(list(data["maint"]))
door = le.fit_transform(list(data["door"]))
persons = le.fit_transform(list(data["persons"]))
lug_boot = le.fit_transform(list(data["lug_boot"]))
safety = le.fit_transform(list(data["safety"]))
cls = le.fit_transform(list(data["class"]))
Now we need to recombine our data into a feature list and a label list. We can use the zip() function to makes things easier.
X = list(zip(buying, maint, door, persons, lug_boot, safety)) # features
y = list(cls) # labels
Finally we will split our data into training and testing data using the same process seen previously.
x_train, x_test, y_train, y_test = sklearn.model_selection.train_test_split(X, y, test_size = 0.1)
Step 3 : Training our Model¶
from sklearn.neighbors import KNeighborsClassifier
model = KNeighborsClassifier(n_neighbors=9)
To train our model we follow precisely the same steps as outlined earlier.
model.fit(x_train, y_train)
KNeighborsClassifier(n_neighbors=9)
Now we can find the accuracy of our model.
acc = model.score(x_test, y_test)
print(acc)
0.9248554913294798
Step 4 : Testing Our Model¶
predicted = model.predict(x_test)
names = ["unacc", "acc", "good", "vgood"]
for x in range(len(predicted)):
print("Predicted: ", names[predicted[x]], "Data: ", x_test[x], "Actual: ", names[y_test[x]])
Predicted: good Data: (1, 2, 1, 2, 2, 1) Actual: good Predicted: good Data: (1, 1, 0, 0, 0, 0) Actual: good Predicted: good Data: (1, 0, 3, 1, 1, 1) Actual: good Predicted: good Data: (2, 0, 3, 0, 2, 2) Actual: good Predicted: good Data: (3, 1, 0, 0, 2, 0) Actual: good Predicted: unacc Data: (1, 0, 3, 1, 2, 0) Actual: unacc Predicted: good Data: (1, 1, 1, 1, 0, 1) Actual: good Predicted: good Data: (3, 3, 0, 0, 0, 0) Actual: good Predicted: good Data: (3, 1, 3, 1, 2, 1) Actual: good Predicted: good Data: (0, 0, 1, 1, 0, 1) Actual: good Predicted: good Data: (3, 3, 0, 2, 1, 1) Actual: good Predicted: unacc Data: (1, 0, 0, 2, 1, 2) Actual: unacc Predicted: good Data: (3, 0, 1, 0, 0, 2) Actual: good Predicted: unacc Data: (1, 2, 2, 1, 2, 0) Actual: acc Predicted: good Data: (0, 0, 2, 0, 0, 1) Actual: good Predicted: unacc Data: (3, 2, 2, 1, 2, 0) Actual: unacc Predicted: good Data: (0, 3, 2, 2, 1, 2) Actual: good Predicted: good Data: (1, 3, 0, 2, 0, 2) Actual: unacc Predicted: good Data: (1, 2, 3, 0, 0, 1) Actual: good Predicted: good Data: (2, 3, 0, 0, 0, 0) Actual: good Predicted: good Data: (0, 2, 2, 1, 2, 1) Actual: good Predicted: vgood Data: (2, 2, 2, 2, 0, 0) Actual: vgood Predicted: good Data: (3, 1, 1, 1, 0, 1) Actual: good Predicted: good Data: (1, 0, 0, 2, 2, 1) Actual: good Predicted: good Data: (0, 3, 0, 0, 0, 2) Actual: good Predicted: good Data: (0, 3, 0, 2, 0, 2) Actual: good Predicted: unacc Data: (3, 2, 2, 2, 0, 0) Actual: unacc Predicted: good Data: (2, 3, 0, 2, 2, 0) Actual: good Predicted: good Data: (1, 1, 0, 0, 1, 0) Actual: good Predicted: good Data: (1, 0, 1, 0, 2, 0) Actual: good Predicted: unacc Data: (0, 2, 3, 2, 0, 2) Actual: unacc Predicted: good Data: (1, 1, 3, 0, 1, 0) Actual: good Predicted: good Data: (2, 1, 0, 2, 2, 0) Actual: good Predicted: unacc Data: (1, 3, 3, 2, 0, 2) Actual: unacc Predicted: good Data: (0, 3, 1, 1, 0, 2) Actual: good Predicted: vgood Data: (1, 1, 3, 1, 1, 0) Actual: vgood Predicted: good Data: (2, 2, 1, 0, 1, 2) Actual: good Predicted: unacc Data: (0, 1, 3, 2, 1, 2) Actual: unacc Predicted: good Data: (0, 1, 2, 0, 2, 1) Actual: good Predicted: good Data: (3, 1, 0, 0, 0, 1) Actual: good Predicted: unacc Data: (2, 1, 3, 1, 2, 2) Actual: unacc Predicted: good Data: (0, 0, 2, 2, 1, 1) Actual: good Predicted: good Data: (0, 0, 2, 0, 1, 2) Actual: good Predicted: good Data: (2, 2, 0, 0, 2, 0) Actual: good Predicted: good Data: (1, 3, 0, 1, 0, 0) Actual: unacc Predicted: good Data: (0, 0, 1, 2, 1, 2) Actual: unacc Predicted: unacc Data: (1, 1, 0, 2, 2, 2) Actual: good Predicted: good Data: (2, 3, 1, 2, 2, 1) Actual: good Predicted: unacc Data: (1, 2, 2, 1, 0, 2) Actual: acc Predicted: unacc Data: (2, 2, 2, 2, 2, 2) Actual: unacc Predicted: good Data: (2, 0, 0, 1, 2, 1) Actual: good Predicted: unacc Data: (0, 0, 2, 1, 1, 0) Actual: unacc Predicted: good Data: (2, 0, 0, 2, 0, 2) Actual: unacc Predicted: unacc Data: (0, 1, 1, 1, 1, 0) Actual: unacc Predicted: unacc Data: (1, 0, 2, 1, 2, 2) Actual: unacc Predicted: good Data: (2, 0, 3, 2, 0, 1) Actual: good Predicted: good Data: (3, 2, 1, 0, 2, 1) Actual: good Predicted: good Data: (3, 1, 0, 1, 2, 2) Actual: good Predicted: good Data: (1, 1, 0, 0, 2, 1) Actual: good Predicted: good Data: (3, 3, 0, 2, 2, 2) Actual: good Predicted: unacc Data: (1, 2, 0, 2, 2, 2) Actual: good Predicted: good Data: (3, 3, 3, 2, 2, 1) Actual: good Predicted: good Data: (0, 1, 1, 1, 1, 2) Actual: good Predicted: good Data: (0, 2, 2, 0, 2, 2) Actual: good Predicted: unacc Data: (1, 0, 2, 1, 0, 2) Actual: unacc Predicted: good Data: (2, 2, 3, 1, 0, 1) Actual: good Predicted: good Data: (2, 1, 1, 0, 2, 1) Actual: good Predicted: good Data: (2, 2, 1, 0, 1, 1) Actual: good Predicted: good Data: (0, 2, 3, 1, 0, 1) Actual: good Predicted: good Data: (1, 2, 3, 1, 1, 1) Actual: good Predicted: unacc Data: (3, 1, 2, 2, 1, 0) Actual: unacc Predicted: good Data: (0, 3, 1, 0, 1, 2) Actual: good Predicted: good Data: (0, 3, 2, 0, 2, 2) Actual: good Predicted: unacc Data: (2, 3, 3, 2, 1, 0) Actual: unacc Predicted: good Data: (3, 1, 1, 0, 1, 1) Actual: good Predicted: good Data: (1, 1, 3, 0, 2, 1) Actual: good Predicted: unacc Data: (0, 0, 3, 2, 2, 0) Actual: unacc Predicted: good Data: (1, 0, 3, 0, 0, 2) Actual: good Predicted: unacc Data: (0, 1, 2, 1, 0, 2) Actual: unacc Predicted: good Data: (2, 3, 3, 0, 2, 1) Actual: good Predicted: good Data: (0, 2, 0, 2, 2, 0) Actual: good Predicted: unacc Data: (3, 2, 0, 2, 0, 0) Actual: unacc Predicted: good Data: (0, 3, 0, 2, 0, 1) Actual: good Predicted: good Data: (3, 0, 0, 0, 2, 1) Actual: good Predicted: good Data: (3, 0, 2, 0, 2, 2) Actual: good Predicted: good Data: (3, 3, 3, 1, 1, 2) Actual: good Predicted: good Data: (0, 2, 1, 0, 0, 2) Actual: good Predicted: good Data: (0, 3, 2, 1, 1, 0) Actual: good Predicted: good Data: (2, 2, 0, 0, 2, 2) Actual: good Predicted: good Data: (1, 1, 1, 2, 1, 1) Actual: good Predicted: unacc Data: (1, 3, 0, 2, 0, 0) Actual: unacc Predicted: good Data: (3, 1, 2, 0, 0, 1) Actual: good Predicted: good Data: (3, 1, 0, 2, 2, 2) Actual: good Predicted: unacc Data: (0, 2, 3, 2, 1, 0) Actual: unacc Predicted: good Data: (3, 3, 2, 1, 1, 1) Actual: good Predicted: good Data: (2, 0, 1, 1, 2, 1) Actual: good Predicted: good Data: (1, 0, 3, 2, 2, 2) Actual: unacc Predicted: good Data: (2, 0, 3, 1, 2, 2) Actual: good Predicted: acc Data: (1, 2, 2, 2, 0, 2) Actual: acc Predicted: unacc Data: (1, 2, 2, 2, 1, 2) Actual: acc Predicted: unacc Data: (2, 3, 0, 1, 1, 0) Actual: unacc Predicted: good Data: (0, 1, 1, 2, 0, 1) Actual: good Predicted: good Data: (3, 2, 0, 0, 2, 0) Actual: good Predicted: good Data: (2, 1, 2, 2, 2, 2) Actual: unacc Predicted: good Data: (1, 1, 0, 2, 2, 1) Actual: good Predicted: good Data: (2, 1, 2, 0, 0, 0) Actual: good Predicted: good Data: (0, 0, 1, 0, 1, 2) Actual: good Predicted: unacc Data: (3, 1, 1, 1, 0, 2) Actual: unacc Predicted: good Data: (3, 0, 2, 0, 0, 2) Actual: good Predicted: good Data: (3, 3, 2, 1, 1, 0) Actual: good Predicted: good Data: (1, 0, 3, 2, 0, 1) Actual: good Predicted: unacc Data: (0, 1, 0, 1, 1, 0) Actual: unacc Predicted: unacc Data: (1, 2, 3, 1, 2, 0) Actual: acc Predicted: good Data: (3, 3, 2, 2, 1, 2) Actual: good Predicted: unacc Data: (2, 3, 2, 2, 1, 2) Actual: unacc Predicted: good Data: (0, 1, 2, 1, 1, 1) Actual: good Predicted: good Data: (0, 2, 3, 0, 2, 0) Actual: good Predicted: good Data: (2, 2, 0, 0, 1, 2) Actual: good Predicted: good Data: (1, 0, 1, 0, 0, 2) Actual: good Predicted: good Data: (2, 0, 2, 2, 0, 1) Actual: good Predicted: good Data: (3, 2, 3, 1, 0, 1) Actual: good Predicted: unacc Data: (1, 3, 1, 2, 0, 2) Actual: unacc Predicted: unacc Data: (2, 0, 3, 1, 1, 0) Actual: unacc Predicted: unacc Data: (3, 1, 0, 2, 0, 0) Actual: unacc Predicted: good Data: (3, 3, 1, 2, 2, 0) Actual: good Predicted: good Data: (3, 0, 1, 0, 1, 0) Actual: good Predicted: good Data: (2, 3, 2, 1, 0, 1) Actual: good Predicted: good Data: (0, 3, 2, 2, 0, 0) Actual: good Predicted: good Data: (2, 1, 2, 2, 1, 1) Actual: good Predicted: good Data: (2, 1, 3, 2, 2, 2) Actual: unacc Predicted: unacc Data: (2, 2, 2, 1, 2, 2) Actual: unacc Predicted: good Data: (1, 2, 0, 0, 0, 2) Actual: good Predicted: good Data: (0, 2, 3, 2, 0, 1) Actual: good Predicted: good Data: (1, 3, 3, 0, 1, 0) Actual: good Predicted: vgood Data: (1, 0, 1, 1, 0, 0) Actual: vgood Predicted: vgood Data: (1, 2, 0, 1, 0, 0) Actual: vgood Predicted: good Data: (3, 1, 1, 0, 0, 2) Actual: good Predicted: acc Data: (1, 1, 1, 1, 2, 0) Actual: acc Predicted: good Data: (3, 1, 3, 1, 2, 2) Actual: good Predicted: good Data: (3, 3, 3, 2, 2, 0) Actual: good Predicted: unacc Data: (0, 2, 3, 2, 0, 0) Actual: unacc Predicted: good Data: (3, 2, 1, 0, 0, 2) Actual: good Predicted: good Data: (2, 2, 1, 0, 2, 1) Actual: good Predicted: good Data: (1, 1, 1, 0, 2, 0) Actual: good Predicted: unacc Data: (0, 0, 1, 1, 1, 0) Actual: unacc Predicted: good Data: (0, 2, 0, 1, 1, 1) Actual: good Predicted: unacc Data: (0, 2, 3, 1, 1, 0) Actual: unacc Predicted: good Data: (3, 0, 1, 0, 1, 2) Actual: good Predicted: good Data: (3, 2, 3, 0, 2, 2) Actual: good Predicted: good Data: (0, 3, 3, 1, 0, 2) Actual: good Predicted: vgood Data: (1, 2, 3, 1, 0, 0) Actual: vgood Predicted: good Data: (0, 0, 3, 0, 2, 1) Actual: good Predicted: good Data: (1, 2, 2, 2, 1, 1) Actual: good Predicted: good Data: (2, 3, 1, 0, 0, 0) Actual: good Predicted: unacc Data: (3, 2, 2, 1, 0, 2) Actual: unacc Predicted: acc Data: (1, 2, 0, 2, 0, 2) Actual: acc Predicted: unacc Data: (2, 2, 3, 1, 1, 2) Actual: unacc Predicted: good Data: (3, 2, 0, 2, 1, 1) Actual: good Predicted: good Data: (0, 3, 3, 2, 0, 0) Actual: good Predicted: good Data: (1, 0, 0, 1, 0, 1) Actual: good Predicted: good Data: (1, 0, 3, 0, 0, 0) Actual: good Predicted: good Data: (3, 3, 2, 1, 0, 1) Actual: good Predicted: unacc Data: (1, 3, 2, 1, 1, 0) Actual: unacc Predicted: unacc Data: (3, 1, 3, 1, 1, 2) Actual: unacc Predicted: good Data: (3, 1, 0, 1, 1, 2) Actual: good Predicted: acc Data: (1, 2, 3, 1, 0, 2) Actual: acc Predicted: unacc Data: (2, 0, 1, 2, 2, 0) Actual: unacc Predicted: good Data: (2, 0, 0, 0, 2, 1) Actual: good Predicted: good Data: (2, 0, 2, 0, 1, 1) Actual: good Predicted: unacc Data: (0, 1, 0, 1, 0, 0) Actual: unacc Predicted: good Data: (1, 3, 2, 0, 1, 0) Actual: good Predicted: unacc Data: (1, 3, 3, 1, 1, 0) Actual: unacc Predicted: unacc Data: (3, 2, 2, 2, 1, 0) Actual: unacc
To see which rows of data were classified incorrectly we can use the code below:
predicted = model.predict(x_test)
names = ["unacc", "acc", "good", "vgood"]
for x in range(len(predicted)):
if names[predicted[x]] != names[y_test[x]]:
print("Predicted: ", names[predicted[x]], "Data: ", x_test[x], "Actual: ", names[y_test[x]])
Predicted: unacc Data: (1, 2, 2, 1, 2, 0) Actual: acc Predicted: good Data: (1, 3, 0, 2, 0, 2) Actual: unacc Predicted: good Data: (1, 3, 0, 1, 0, 0) Actual: unacc Predicted: good Data: (0, 0, 1, 2, 1, 2) Actual: unacc Predicted: unacc Data: (1, 1, 0, 2, 2, 2) Actual: good Predicted: unacc Data: (1, 2, 2, 1, 0, 2) Actual: acc Predicted: good Data: (2, 0, 0, 2, 0, 2) Actual: unacc Predicted: unacc Data: (1, 2, 0, 2, 2, 2) Actual: good Predicted: good Data: (1, 0, 3, 2, 2, 2) Actual: unacc Predicted: unacc Data: (1, 2, 2, 2, 1, 2) Actual: acc Predicted: good Data: (2, 1, 2, 2, 2, 2) Actual: unacc Predicted: unacc Data: (1, 2, 3, 1, 2, 0) Actual: acc Predicted: good Data: (2, 1, 3, 2, 2, 2) Actual: unacc
We can look at the predicted and actual values and compare how accurate they are. The accuracy may always not be the same at all times.
Looking at Neighbors¶
The KNN model has a unique method that allows for us to see the neighbors of a given data point. We can use this information to plot our data and get a better idea of where our model may lack accuracy. We can use model.neighbors to do this.
Note: the .neighbors method takes 2D as input, this means if we want to pass one data point we need surround it with [] so that it is in the right shape.
Parameters: The parameters for .neighbors are as follows: data(2D array), # of neighbors(int), distance(True or False)
Return: This will return to us an array with the index in our data of each neighbor. If distance=True then it will also return the distance to each neighbor from our data point.
predicted = model.predict(x_test)
names = ["unacc", "acc", "good", "vgood"]
for x in range(len(predicted)):
print("Predicted: ", names[predicted[x]], "Data: ", x_test[x], "Actual: ", names[y_test[x]])
# Now we will we see the neighbors of each point in our testing data
n = model.kneighbors([x_test[x]], 9, True)
print("N: ", n)
Predicted: good Data: (1, 2, 1, 2, 2, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[410, 604, 686, 155, 900, 347, 887, 781, 455]])) Predicted: good Data: (1, 1, 0, 0, 0, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 739, 500, 1010, 69, 1041, 1180, 203, 1213, 436]])) Predicted: good Data: (1, 0, 3, 1, 1, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[1545, 200, 239, 741, 683, 322, 516, 1517, 1294]])) Predicted: good Data: (2, 0, 3, 0, 2, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356, 1.41421356]]), array([[ 639, 761, 1528, 465, 787, 317, 163, 1122, 4]])) Predicted: good Data: (3, 1, 0, 0, 2, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[ 676, 1254, 1314, 1487, 1201, 29, 1246, 1025, 1241]])) Predicted: unacc Data: (1, 0, 3, 1, 2, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 640, 621, 516, 1109, 58, 1216, 1545, 966, 1085]])) Predicted: good Data: (1, 1, 1, 1, 0, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 292, 366, 514, 391, 382, 84, 1438, 475, 876]])) Predicted: good Data: (3, 3, 0, 0, 0, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356, 1.41421356]]), array([[ 429, 37, 848, 1199, 767, 375, 1509, 450, 849]])) Predicted: good Data: (3, 1, 3, 1, 2, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[1282, 1333, 1088, 194, 1266, 1055, 1129, 1337, 1447]])) Predicted: good Data: (0, 0, 1, 1, 0, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[1165, 994, 657, 876, 292, 666, 1094, 1147, 969]])) Predicted: good Data: (3, 3, 0, 2, 1, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[228, 469, 182, 68, 897, 364, 115, 987, 880]])) Predicted: unacc Data: (1, 0, 0, 2, 1, 2) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[1551, 177, 1011, 1372, 671, 380, 985, 877, 1127]])) Predicted: good Data: (3, 0, 1, 0, 0, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356, 1.41421356, 1.41421356]]), array([[1275, 1032, 50, 274, 1027, 592, 1173, 644, 387]])) Predicted: unacc Data: (1, 2, 2, 1, 2, 0) Actual: acc N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[1082, 97, 861, 91, 826, 1323, 438, 512, 114]])) Predicted: good Data: (0, 0, 2, 0, 0, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[1340, 1209, 666, 1373, 583, 994, 1048, 856, 1091]])) Predicted: unacc Data: (3, 2, 2, 1, 2, 0) Actual: unacc N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 395, 131, 91, 1236, 731, 1160, 562, 169, 965]])) Predicted: good Data: (0, 3, 2, 2, 1, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 378, 100, 1098, 780, 1538, 904, 1326, 342, 715]])) Predicted: good Data: (1, 3, 0, 2, 0, 2) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356, 1.41421356, 1.41421356]]), array([[1021, 1319, 1401, 734, 648, 1240, 1462, 1421, 631]])) Predicted: good Data: (1, 2, 3, 0, 0, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[1181, 311, 608, 557, 1325, 407, 171, 942, 710]])) Predicted: good Data: (2, 3, 0, 0, 0, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356, 1.41421356]]), array([[ 849, 1509, 145, 1121, 249, 1454, 226, 936, 457]])) Predicted: good Data: (0, 2, 2, 1, 2, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[1190, 20, 1533, 1082, 735, 626, 928, 641, 114]])) Predicted: vgood Data: (2, 2, 2, 2, 0, 0) Actual: vgood N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[1315, 656, 365, 1251, 86, 1113, 1248, 446, 397]])) Predicted: good Data: (3, 1, 1, 1, 0, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 918, 610, 1426, 85, 1050, 1437, 158, 565, 425]])) Predicted: good Data: (1, 0, 0, 2, 2, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 811, 629, 877, 956, 613, 1551, 1288, 647, 1127]])) Predicted: good Data: (0, 3, 0, 0, 0, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[1164, 460, 1210, 312, 379, 1107, 846, 398, 527]])) Predicted: good Data: (0, 3, 0, 2, 0, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356, 1.41421356, 1.41421356]]), array([[ 312, 526, 835, 1240, 1169, 825, 697, 734, 386]])) Predicted: unacc Data: (3, 2, 2, 2, 0, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[ 35, 725, 859, 759, 770, 1257, 1084, 1248, 502]])) Predicted: good Data: (2, 3, 0, 2, 2, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 71, 987, 733, 384, 170, 174, 599, 389, 804]])) Predicted: good Data: (1, 1, 0, 0, 1, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 45, 915, 454, 732, 1530, 1443, 1038, 581, 1496]])) Predicted: good Data: (1, 0, 1, 0, 2, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 983, 472, 251, 489, 67, 1360, 1417, 915, 957]])) Predicted: unacc Data: (0, 2, 3, 2, 0, 2) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[1242, 570, 1023, 1542, 1185, 681, 318, 136, 378]])) Predicted: good Data: (1, 1, 3, 0, 1, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 926, 63, 21, 1149, 762, 532, 569, 1203, 204]])) Predicted: good Data: (2, 1, 0, 2, 2, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 960, 603, 360, 946, 733, 1395, 82, 140, 270]])) Predicted: unacc Data: (1, 3, 3, 2, 0, 2) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 889, 27, 1138, 681, 1255, 1341, 1542, 267, 1071]])) Predicted: good Data: (0, 3, 1, 1, 0, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 312, 379, 1117, 726, 108, 1146, 1162, 526, 1401]])) Predicted: vgood Data: (1, 1, 3, 1, 1, 0) Actual: vgood N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 322, 18, 516, 1116, 1216, 346, 1309, 911, 17]])) Predicted: good Data: (2, 2, 1, 0, 1, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 701, 205, 1022, 1265, 833, 497, 817, 416, 496]])) Predicted: unacc Data: (0, 1, 3, 2, 1, 2) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[1206, 962, 1548, 1185, 250, 655, 6, 1242, 709]])) Predicted: good Data: (0, 1, 2, 0, 2, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[1256, 1235, 20, 641, 1230, 729, 1460, 947, 452]])) Predicted: good Data: (3, 1, 0, 0, 0, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 918, 592, 1532, 482, 1159, 1429, 565, 644, 50]])) Predicted: unacc Data: (2, 1, 3, 1, 2, 2) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[ 494, 1088, 720, 254, 807, 1528, 748, 4, 794]])) Predicted: good Data: (0, 0, 2, 2, 1, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 839, 477, 1327, 1363, 1218, 409, 1161, 1369, 1228]])) Predicted: good Data: (0, 0, 2, 0, 1, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 13, 134, 856, 471, 583, 323, 674, 782, 280]])) Predicted: good Data: (2, 2, 0, 0, 2, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[1201, 1194, 246, 1522, 226, 389, 137, 1234, 61]])) Predicted: good Data: (1, 3, 0, 1, 0, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[ 849, 1191, 145, 1508, 999, 898, 69, 682, 527]])) Predicted: good Data: (0, 0, 1, 2, 1, 2) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 606, 1205, 477, 409, 504, 177, 985, 361, 1364]])) Predicted: unacc Data: (1, 1, 0, 2, 2, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[ 671, 819, 877, 383, 118, 573, 698, 1380, 1127]])) Predicted: good Data: (2, 3, 1, 2, 2, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 604, 369, 71, 347, 793, 1475, 892, 1226, 170]])) Predicted: unacc Data: (1, 2, 2, 1, 0, 2) Actual: acc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[1480, 1414, 1030, 343, 899, 903, 695, 266, 171]])) Predicted: unacc Data: (2, 2, 2, 2, 2, 2) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[1007, 1054, 1076, 1324, 41, 785, 620, 1346, 254]])) Predicted: good Data: (2, 0, 0, 1, 2, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 956, 795, 613, 1074, 997, 290, 1378, 803, 1155]])) Predicted: unacc Data: (0, 0, 2, 1, 1, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[1091, 1400, 1134, 884, 1034, 1526, 1161, 1228, 583]])) Predicted: good Data: (2, 0, 0, 2, 0, 2) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[1472, 1552, 1158, 380, 597, 192, 1372, 124, 1157]])) Predicted: unacc Data: (0, 1, 1, 1, 1, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 427, 1362, 461, 884, 1232, 54, 633, 1099, 530]])) Predicted: unacc Data: (1, 0, 2, 1, 2, 2) Actual: unacc N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 784, 1484, 401, 975, 699, 269, 748, 809, 317]])) Predicted: good Data: (2, 0, 3, 2, 0, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356, 1.41421356]]), array([[ 260, 990, 1357, 1239, 1052, 1316, 868, 225, 223]])) Predicted: good Data: (3, 2, 1, 0, 2, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[1063, 646, 1237, 1501, 800, 815, 324, 1407, 992]])) Predicted: good Data: (3, 1, 0, 1, 2, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[ 411, 1281, 451, 1262, 1123, 1137, 53, 676, 1074]])) Predicted: good Data: (1, 1, 0, 0, 2, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[1038, 1155, 560, 1477, 1443, 390, 980, 986, 509]])) Predicted: good Data: (3, 3, 0, 2, 2, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[ 228, 1298, 215, 182, 858, 855, 1226, 901, 567]])) Predicted: unacc Data: (1, 2, 0, 2, 2, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 410, 455, 1172, 439, 634, 268, 832, 573, 1176]])) Predicted: good Data: (3, 3, 3, 2, 2, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[1220, 1418, 1471, 413, 544, 1339, 1345, 369, 974]])) Predicted: good Data: (0, 1, 1, 1, 1, 2) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 774, 1457, 756, 504, 73, 1527, 427, 1205, 602]])) Predicted: good Data: (0, 2, 2, 0, 2, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[1230, 641, 1190, 168, 1193, 340, 481, 1208, 48]])) Predicted: unacc Data: (1, 0, 2, 1, 0, 2) Actual: unacc N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 784, 933, 1481, 245, 1227, 325, 763, 162, 1030]])) Predicted: good Data: (2, 2, 3, 1, 0, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[1325, 355, 830, 1112, 311, 1252, 879, 868, 871]])) Predicted: good Data: (2, 1, 1, 0, 2, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[1155, 724, 909, 390, 1407, 141, 1246, 803, 665]])) Predicted: good Data: (2, 2, 1, 0, 1, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[1234, 184, 815, 1546, 694, 1271, 1377, 543, 909]])) Predicted: good Data: (0, 2, 3, 1, 0, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 570, 916, 627, 40, 376, 608, 339, 1325, 318]])) Predicted: good Data: (1, 2, 3, 1, 1, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[1116, 916, 717, 1200, 1285, 1181, 1325, 448, 1550]])) Predicted: unacc Data: (3, 1, 2, 2, 1, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 728, 1211, 772, 1413, 860, 725, 1016, 160, 922]])) Predicted: good Data: (0, 3, 1, 0, 1, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 289, 379, 506, 79, 108, 1270, 237, 1164, 467]])) Predicted: good Data: (0, 3, 2, 0, 2, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[ 275, 79, 399, 506, 3, 1075, 10, 342, 988]])) Predicted: unacc Data: (2, 3, 3, 2, 1, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 689, 1549, 853, 1304, 755, 542, 348, 1349, 102]])) Predicted: good Data: (3, 1, 1, 0, 1, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 230, 815, 1119, 158, 909, 1025, 1407, 918, 1159]])) Predicted: good Data: (1, 1, 3, 0, 2, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[1256, 392, 80, 333, 923, 926, 1460, 135, 21]])) Predicted: unacc Data: (0, 0, 3, 2, 2, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[1140, 864, 939, 621, 966, 708, 1085, 1218, 414]])) Predicted: good Data: (1, 0, 3, 0, 0, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[1227, 645, 684, 834, 1403, 1122, 245, 146, 856]])) Predicted: unacc Data: (0, 1, 2, 1, 0, 2) Actual: unacc N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 678, 1527, 430, 1480, 1087, 162, 349, 556, 1030]])) Predicted: good Data: (2, 3, 3, 0, 2, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 746, 329, 75, 259, 424, 89, 218, 520, 1092]])) Predicted: good Data: (0, 2, 0, 2, 2, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[1064, 474, 1365, 723, 940, 1136, 316, 410, 95]])) Predicted: unacc Data: (3, 2, 0, 2, 0, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[ 759, 847, 703, 925, 39, 907, 188, 1553, 111]])) Predicted: good Data: (0, 3, 0, 2, 0, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[ 955, 825, 386, 734, 1449, 1169, 1240, 898, 1146]])) Predicted: good Data: (3, 0, 0, 0, 2, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[ 676, 287, 1412, 290, 1254, 38, 536, 1137, 803]])) Predicted: good Data: (3, 0, 2, 0, 2, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[1261, 677, 913, 639, 993, 336, 428, 975, 122]])) Predicted: good Data: (3, 3, 3, 1, 1, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 129, 541, 670, 466, 1284, 812, 288, 545, 771]])) Predicted: good Data: (0, 2, 1, 0, 0, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 379, 605, 1270, 309, 1117, 460, 823, 882, 602]])) Predicted: good Data: (0, 3, 2, 1, 1, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[1351, 1385, 1258, 820, 672, 775, 715, 476, 749]])) Predicted: good Data: (2, 2, 0, 0, 2, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 687, 1312, 246, 470, 817, 1425, 891, 70, 229]])) Predicted: good Data: (1, 1, 1, 2, 1, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 92, 1115, 271, 887, 984, 781, 391, 43, 514]])) Predicted: unacc Data: (1, 3, 0, 2, 0, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[ 188, 734, 1449, 579, 1013, 1014, 479, 898, 631]])) Predicted: good Data: (3, 1, 2, 0, 0, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 619, 918, 1375, 1468, 30, 610, 1279, 796, 658]])) Predicted: good Data: (3, 1, 0, 2, 2, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[ 198, 383, 855, 1329, 1153, 700, 196, 1123, 1233]])) Predicted: unacc Data: (0, 2, 3, 2, 1, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[ 788, 1212, 318, 90, 2, 1108, 916, 1000, 624]])) Predicted: good Data: (3, 3, 2, 1, 1, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 974, 32, 888, 736, 1284, 288, 235, 707, 395]])) Predicted: good Data: (2, 0, 1, 1, 2, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 803, 995, 665, 98, 598, 691, 890, 1331, 574]])) Predicted: good Data: (1, 0, 3, 2, 2, 2) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 317, 1408, 1310, 269, 941, 263, 449, 1545, 680]])) Predicted: good Data: (2, 0, 3, 1, 2, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356, 1.41421356]]), array([[ 317, 4, 1310, 975, 538, 761, 1545, 494, 465]])) Predicted: acc Data: (1, 2, 2, 2, 0, 2) Actual: acc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 912, 1542, 199, 320, 648, 27, 1023, 757, 266]])) Predicted: unacc Data: (1, 2, 2, 2, 1, 2) Actual: acc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 378, 785, 432, 1176, 266, 1098, 601, 1324, 1285]])) Predicted: unacc Data: (2, 3, 0, 1, 1, 0) Actual: unacc N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 849, 1508, 987, 1466, 880, 1018, 1509, 61, 599]])) Predicted: good Data: (0, 1, 1, 2, 0, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[1094, 1444, 271, 255, 743, 989, 391, 852, 876]])) Predicted: good Data: (3, 2, 0, 0, 2, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356, 1.41421356]]), array([[ 800, 646, 393, 1095, 511, 389, 246, 1194, 226]])) Predicted: good Data: (2, 1, 2, 2, 2, 2) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[1461, 353, 501, 219, 1506, 254, 584, 117, 432]])) Predicted: good Data: (1, 1, 0, 2, 2, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 781, 92, 960, 410, 509, 946, 1455, 573, 1551]])) Predicted: good Data: (2, 1, 2, 0, 0, 0) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 619, 662, 773, 404, 1336, 30, 978, 1139, 1525]])) Predicted: good Data: (0, 0, 1, 0, 1, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[1006, 227, 702, 1205, 602, 1103, 1482, 666, 777]])) Predicted: unacc Data: (3, 1, 1, 1, 0, 2) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[1106, 473, 1275, 1391, 262, 478, 1430, 1173, 425]])) Predicted: good Data: (3, 0, 2, 0, 0, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356, 1.41421356]]), array([[ 913, 1126, 327, 658, 796, 1306, 428, 1428, 381]])) Predicted: good Data: (3, 3, 2, 1, 1, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 696, 797, 102, 1077, 395, 731, 502, 1520, 659]])) Predicted: good Data: (1, 0, 3, 2, 0, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 223, 683, 225, 1294, 1543, 224, 296, 709, 1366]])) Predicted: unacc Data: (0, 1, 0, 1, 1, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[625, 581, 530, 49, 758, 45, 910, 633, 921]])) Predicted: unacc Data: (1, 2, 3, 1, 2, 0) Actual: acc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 448, 426, 1216, 1283, 1039, 1179, 1116, 1125, 1323]])) Predicted: good Data: (3, 3, 2, 2, 1, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 321, 400, 466, 112, 824, 235, 288, 651, 1007]])) Predicted: unacc Data: (2, 3, 2, 2, 1, 2) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[1098, 503, 1324, 96, 1432, 417, 1353, 620, 920]])) Predicted: good Data: (0, 1, 2, 1, 1, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[1161, 349, 345, 884, 20, 1087, 841, 729, 1327]])) Predicted: good Data: (0, 2, 3, 0, 2, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 480, 571, 1179, 1039, 1186, 866, 765, 1308, 1081]])) Predicted: good Data: (2, 2, 0, 0, 1, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[1467, 543, 186, 1196, 850, 1215, 229, 457, 246]])) Predicted: good Data: (1, 0, 1, 0, 0, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 933, 1040, 1511, 1227, 274, 1006, 227, 1120, 777]])) Predicted: good Data: (2, 0, 2, 2, 0, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 751, 1500, 586, 412, 1204, 607, 225, 945, 763]])) Predicted: good Data: (3, 2, 3, 1, 0, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[1245, 552, 519, 1217, 187, 164, 692, 842, 1170]])) Predicted: unacc Data: (1, 3, 1, 2, 0, 2) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[1162, 1462, 648, 441, 27, 526, 1124, 734, 368]])) Predicted: unacc Data: (2, 0, 3, 1, 1, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 516, 1316, 283, 1433, 338, 18, 1109, 1174, 63]])) Predicted: unacc Data: (3, 1, 0, 2, 0, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[ 125, 1189, 31, 821, 1383, 419, 1207, 372, 1437]])) Predicted: good Data: (3, 3, 1, 2, 2, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 170, 384, 195, 1078, 356, 234, 892, 510, 1367]])) Predicted: good Data: (3, 0, 1, 0, 1, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 230, 352, 827, 798, 1514, 1025, 15, 1318, 326]])) Predicted: good Data: (2, 3, 2, 1, 0, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[1252, 1302, 888, 879, 1387, 744, 590, 1498, 1276]])) Predicted: good Data: (0, 3, 2, 2, 0, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[1258, 775, 495, 212, 1000, 1332, 2, 1042, 749]])) Predicted: good Data: (2, 1, 2, 2, 1, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 353, 750, 584, 1500, 860, 1211, 1053, 217, 1204]])) Predicted: good Data: (2, 1, 3, 2, 2, 2) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[1352, 938, 449, 1076, 845, 1310, 1506, 807, 1088]])) Predicted: unacc Data: (2, 2, 2, 1, 2, 2) Actual: unacc N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 254, 70, 201, 720, 1424, 1044, 7, 261, 142]])) Predicted: good Data: (1, 2, 0, 0, 0, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 460, 1354, 186, 850, 1554, 840, 1107, 882, 507]])) Predicted: good Data: (0, 2, 3, 2, 0, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356, 1.41421356]]), array([[ 709, 318, 1042, 757, 359, 1000, 376, 916, 1023]])) Predicted: good Data: (1, 3, 3, 0, 1, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[1024, 762, 1002, 1097, 216, 1516, 407, 218, 113]])) Predicted: vgood Data: (1, 0, 1, 1, 0, 0) Actual: vgood N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[1165, 1036, 337, 358, 292, 885, 1438, 653, 568]])) Predicted: vgood Data: (1, 2, 0, 1, 0, 0) Actual: vgood N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 295, 491, 944, 1187, 1014, 575, 739, 69, 147]])) Predicted: good Data: (3, 1, 1, 0, 0, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356, 1.41421356]]), array([[1119, 592, 796, 918, 1173, 274, 50, 808, 1032]])) Predicted: acc Data: (1, 1, 1, 1, 2, 0) Actual: acc N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[1362, 438, 54, 596, 1168, 445, 97, 983, 1386]])) Predicted: good Data: (3, 1, 3, 1, 2, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356, 1.41421356, 1.41421356]]), array([[ 845, 1459, 1337, 643, 1528, 1266, 807, 1055, 1104]])) Predicted: good Data: (3, 3, 3, 2, 2, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356, 1.41421356]]), array([[1304, 542, 0, 1070, 356, 1236, 544, 78, 1418]])) Predicted: unacc Data: (0, 2, 3, 2, 0, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356, 1.41421356, 1.41421356]]), array([[1202, 302, 1000, 339, 1212, 151, 2, 359, 318]])) Predicted: good Data: (3, 2, 1, 0, 0, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[1474, 205, 1416, 952, 1392, 701, 1106, 867, 1271]])) Predicted: good Data: (2, 2, 1, 0, 2, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 972, 817, 246, 1093, 992, 1194, 1427, 543, 693]])) Predicted: good Data: (1, 1, 1, 0, 2, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[1238, 390, 1456, 1246, 1273, 1038, 454, 633, 251]])) Predicted: unacc Data: (0, 0, 1, 1, 1, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 617, 337, 1058, 657, 530, 1165, 1291, 1540, 251]])) Predicted: good Data: (0, 2, 0, 1, 1, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[1458, 1243, 618, 1382, 139, 1247, 1404, 910, 758]])) Predicted: unacc Data: (0, 2, 3, 1, 1, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 339, 866, 1116, 911, 916, 1385, 1179, 672, 318]])) Predicted: good Data: (3, 0, 1, 0, 1, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[1110, 230, 336, 1119, 913, 334, 996, 1032, 50]])) Predicted: good Data: (3, 2, 3, 0, 2, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 144, 582, 548, 272, 1459, 1337, 1300, 1104, 1055]])) Predicted: good Data: (0, 3, 3, 1, 0, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[1031, 681, 627, 570, 889, 726, 778, 1042, 749]])) Predicted: vgood Data: (1, 2, 3, 1, 0, 0) Actual: vgood N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 802, 830, 1325, 17, 1116, 1202, 339, 710, 886]])) Predicted: good Data: (0, 0, 3, 0, 2, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 782, 1256, 452, 80, 546, 280, 667, 134, 583]])) Predicted: good Data: (1, 2, 2, 2, 1, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 717, 920, 57, 1053, 1346, 26, 1330, 1285, 199]])) Predicted: good Data: (2, 3, 1, 0, 0, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 766, 1199, 936, 1184, 1441, 1454, 682, 1271, 1018]])) Predicted: unacc Data: (3, 2, 2, 1, 0, 2) Actual: unacc N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 651, 1106, 771, 187, 692, 899, 593, 1474, 1391]])) Predicted: acc Data: (1, 2, 0, 2, 0, 2) Actual: acc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 648, 1240, 247, 439, 1554, 609, 631, 944, 1219]])) Predicted: unacc Data: (2, 2, 3, 1, 1, 2) Actual: unacc N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 807, 129, 871, 1112, 1424, 1182, 812, 1550, 720]])) Predicted: good Data: (3, 2, 0, 2, 1, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[1151, 872, 39, 1435, 252, 847, 405, 688, 25]])) Predicted: good Data: (0, 3, 3, 2, 0, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356, 1.41421356, 1.41421356]]), array([[ 2, 810, 1042, 330, 1385, 539, 1332, 627, 1258]])) Predicted: good Data: (1, 0, 0, 1, 0, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 969, 1157, 292, 382, 1321, 1507, 885, 436, 1317]])) Predicted: good Data: (1, 0, 3, 0, 0, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 107, 63, 59, 645, 791, 1393, 532, 1373, 1048]])) Predicted: good Data: (3, 3, 2, 1, 0, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 696, 769, 415, 842, 1035, 692, 771, 873, 859]])) Predicted: unacc Data: (1, 3, 2, 1, 1, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[1323, 861, 740, 102, 1510, 64, 1192, 113, 1498]])) Predicted: unacc Data: (3, 1, 3, 1, 1, 2) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 807, 1104, 1531, 314, 129, 1266, 1170, 1068, 1307]])) Predicted: good Data: (3, 1, 0, 1, 1, 2) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[1430, 1465, 19, 1544, 303, 700, 478, 53, 1196]])) Predicted: acc Data: (1, 2, 3, 1, 0, 2) Actual: acc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[ 889, 1550, 570, 871, 893, 1325, 942, 1542, 266]])) Predicted: unacc Data: (2, 0, 1, 2, 2, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356]]), array([[1331, 691, 159, 1289, 603, 753, 1395, 180, 1135]])) Predicted: good Data: (2, 0, 0, 0, 2, 1) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356, 1.41421356]]), array([[ 554, 1155, 980, 208, 536, 803, 914, 354, 997]])) Predicted: good Data: (2, 0, 2, 0, 1, 1) Actual: good N: (array([[1., 1., 1., 1., 1., 1., 1., 1., 1.]]), array([[ 308, 652, 122, 279, 428, 754, 1306, 1335, 1428]])) Predicted: unacc Data: (0, 1, 0, 1, 0, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 739, 55, 1540, 1405, 575, 1180, 461, 1213, 885]])) Predicted: good Data: (1, 3, 2, 0, 1, 0) Actual: good N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 816, 113, 1114, 1351, 622, 973, 1105, 62, 642]])) Predicted: unacc Data: (1, 3, 3, 1, 1, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 886, 426, 1385, 1116, 1549, 689, 1200, 1024, 267]])) Predicted: unacc Data: (3, 2, 2, 2, 1, 0) Actual: unacc N: (array([[1. , 1. , 1. , 1. , 1. , 1. , 1. , 1.41421356, 1.41421356]]), array([[ 406, 502, 1423, 965, 630, 395, 1248, 919, 860]]))
That's it for today's session! Next week we'll dive deeper into neural networks and how to implement them.