digits_classification_ml
digits_classification_ml
model.evaluate(x_test_flattened,y_test)
plt.matshow(x_test[0])
y_predicted=model.predict(x_test_flattened)
y_predicted[0]
#prints the possibilty of value from 0 to 10
np.argmax(y_predicted[0])#real prediction
#build confusion matrix
import tensorflow as tf
from tensorflow import keras
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
model = keras.Sequential([
keras.layers.Dense(10, input_shape=(784,), activation='sigmoid')
])
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
model.evaluate(x_test_flattened, y_test)
# Input for petal length, sepal length, sepal width, and petal width
petal_length = float(input("Enter petal length: "))
sepal_length = float(input("Enter sepal length: "))
sepal_width = float(input("Enter sepal width: "))
petal_width = float(input("Enter petal width: "))
# Make a prediction
input_data = scaler.transform([[petal_length, sepal_length, sepal_width,
petal_width]])
predicted_class = svm.predict(input_data)[0]
predicted_flower = iris.target_names[predicted_class]