File size: 856 Bytes
de41f58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import joblib

from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score

# Load the model from disk
loaded_model = joblib.load('gaussian_nb.joblib')

# Set the random seed
random_seed = 0

# Load the dataset
dataset = load_iris()
X, y = dataset.data, dataset.target

# Split the dataset into training and testing sets
_, X_test, _, y_test = train_test_split(X, y, test_size=0.25, random_state=random_seed)
print(f'X_test:\n{X_test[0]}')
print(f'y_test:\n{y_test[0]}')

# Use the model to make predictions on the test data
y_pred = loaded_model.predict(X_test)
print(f'y_pred:\n{y_pred[0]}')

# Score the model using accuracy classification score
acc = accuracy_score(y_test, y_pred)
print(f'Accuracy classification score: {acc}')