Ive coded this machine learning algoritm but it retured to me a wierd array. I want to input 2 numbers and then those numbers be clasified into similar results found in Y, How do I make a prediction using this model?
import numpy as np # mutivariate clasification
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
X =np.array(
[[3, 7],
[3, 6],
[3, 7.2],
[6, 8],
[7, 7.5],
[7.9, 7.5]])
Y =np.array([1, 1, 1, 2, 3, 3])
model = Sequential([
Dense(units = 25, activation = "relu"),
Dense(units = 15, activation = "relu"),
Dense(units = 10, activation = "softmax"),])
from keras.losses import SparseCategoricalCrossentropy
model.compile(loss = SparseCategoricalCrossentropy())
model.fit(X, Y, epochs = 100)
I tried this code:
Xpred = [[3,7.8]]
prediction = model.predict(Xpred, verbose = 1)
print(prediction)
and it returned:
[[3.4789115e-02 8.4235787e-01 7.6775238e-02 1.9370530e-02 1.0821970e-02
4.8491983e-03 4.7121649e-03 7.4993627e-04 2.9366722e-04 5.2804169e-03]]
Im new to stack and ML so please let me know how I could improve or if you have any reading materal or resources for ML you could share!