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.You can see it here.

I coverted 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 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()


val_loss,val_acc = model.evaluate(testdataX,testdataY)

You are in a regression setting, where accuracy is meaningless (it is meaningful only in classification settings).

Simply remove the metrics=['accuracy'] argument from your model compilation, so that model.evaluate returns the loss only (discard also val_acc).

See the SO thread What function defines accuracy in Keras when the loss is mean squared error (MSE)? for more details.

  • $\begingroup$ I am so grateful! I am also try to draw the graph with curve for that points. Is there any way to do it? I would try to go for something like "plt.plot(X*W(1)+B1)" or stuff. But it seems like it's not possible. Any tips do draw it? $\endgroup$ – Fexion Sep 28 '19 at 21:25
  • $\begingroup$ @Fexion nope, sorry - have never tried something like that, I kindly suggest you open a new question since this is a different issue. And if the answer resolved your issue, kindly accept it - see What should I do when someone answers my question? - thanks $\endgroup$ – desertnaut Sep 28 '19 at 21:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.