I am trying to do a multi-output regression using TensorFlow. I have got a dataset in Excel which includes a column of input points and 2 columns of output.
I converted all numbers to NumPy objects. And I am trying to do a basic regression but accuracy is always 1.0, I also want to draw a graph but dunno where to start. Could Anyone please help? My code is here:
import os
import numpy as np
import tensorflow as tf
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from keras.models import Sequential
from keras.layers import Dense
from keras.activations import relu
training_data = pd.read_excel(r'C:\Users\lenovo\Desktop\Yeni klasör\training_data.xlsx',sheet_name="i1-o2")
training_data_X = training_data['i1']
traindataX = np.array(training_data_X)
training_data_Y = training_data[['o1','o2']]
traindataY = np.array(training_data_Y)
testing_data = data = pd.read_excel(r'C:\Users\lenovo\Desktop\Yeni klasör\testing_data.xlsx',sheet_name="i1-o2")
testing_data_X = testing_data['i1']
testing_data_Y = testing_data[['o1','o2']]
testdataX = np.array(testing_data_X)
testdataY = np.array(testing_data_Y)
model = tf.keras.models.Sequential()
model.add(tf.keras.layers.Flatten())
model.add(tf.keras.layers.Dense(128,activation=tf.nn.tanh))
model.add(tf.keras.layers.Dense(128,activation=tf.nn.tanh))
model.add(tf.keras.layers.Dense(2))
model.compile(optimizer='adam',
loss='mean_squared_error',
metrics=['accuracy'])
model.fit(traindataX,traindataY,epochs=500)
val_loss,val_acc = model.evaluate(testdataX,testdataY)
print(val_loss,val_acc)