Learning a quadratic function using TensorFlow/KerasWhat should I do when my neural network doesn't learn?How to set mini-batch size in SGD in kerasKeras: acc and val_acc are constant over 300 epochs, is this normal?Keras ImageDataGeneratorNNs: Multiple Sigmoid + Binary Cross Entropy giving better results than Softmax + Categorical Cross Entropymaking a surrogate model of a function using feed forward networksWhich elements of a Neural Network can lead to overfitting?Accuracy unchanged while error decreaseshow can my loss suddenly increase while training a CNN for image segmentation?Training with a max-margin ranking loss converges to useless solutionRNN(LSTM) model fails to classify new speaker voice

How to assert on pagereference where the endpoint of pagereference is predefined

Junior developer struggles: how to communicate with management?

Has any spacecraft ever had the ability to directly communicate with civilian air traffic control?

What happens if I start too many background jobs?

How to reply this mail from potential PhD professor?

How to scale a verbatim environment on a minipage?

Can commander tax be proliferated?

Historically, were women trained for obligatory wars? Or did they serve some other military function?

Feels like I am getting dragged into office politics

Accidentally deleted the "/usr/share" folder

Copy line and insert it in a new position with sed or awk

How to get SEEK accessing converted ID via view

Pressure to defend the relevance of one's area of mathematics

How to efficiently calculate prefix sum of frequencies of characters in a string?

Meaning of "individuandum"

Visa for volunteering in England

Is it cheaper to drop cargo than to land it?

You look catfish vs You look like a catfish?

What happened to Ghost?

Was the ancestor of SCSI, the SASI protocol, nothing more than a draft?

Why debootstrap can only run as root?

Packet sniffer for MacOS Mojave and above

What are the spoon bit of a spoon and fork bit of a fork called?

How can I fairly adjudicate the effects of height differences on ranged attacks?



Learning a quadratic function using TensorFlow/Keras


What should I do when my neural network doesn't learn?How to set mini-batch size in SGD in kerasKeras: acc and val_acc are constant over 300 epochs, is this normal?Keras ImageDataGeneratorNNs: Multiple Sigmoid + Binary Cross Entropy giving better results than Softmax + Categorical Cross Entropymaking a surrogate model of a function using feed forward networksWhich elements of a Neural Network can lead to overfitting?Accuracy unchanged while error decreaseshow can my loss suddenly increase while training a CNN for image segmentation?Training with a max-margin ranking loss converges to useless solutionRNN(LSTM) model fails to classify new speaker voice






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2












$begingroup$


Heads up: I'm not sure if this is the best place to post this question, so let me know if there is somewhere better suited.



I am trying to train a simple neural network to learn a simple quadratic function of the form:
$f(x) = 5 - 3x + 2x^2$



I set up a single-layered network with a single neuron.
The input is a 2d array of the form
$(x, x^2)$
and I don't use an activation function. I expect that the weights and biases I extract from the network will correspond to the coefficients in the function $f(x)$.



I randomly generate some training points and labels, as well as a validation data set, and train my model using the Keras sequential model called from TensorFlow.



import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt

def fTest(x_arg):
return 5 - 3*x_arg + 2*(x_arg)**2

# training data
t = np.random.choice(np.arange(-10,10, .01),5000 )
t1 = []
for i in range(len(t)):
t1.append([t[i], t[i]**2])
s = []
for i in range(len(t)):
s.append(fTest(t[i]))
t1 = np.array(t1)
s = np.array(s)

# validation set
v = np.random.choice(np.arange(-10,10, .01),5000 )
v1 = []
for i in range(len(v)):
v1.append([v[i], v[i]**2])
u = []
for i in range(len(v)):
u.append(fTest(v[i]))
v1 = np.array(v1)
u = np.array(u)

model = keras.Sequential([
keras.layers.Dense(1, input_shape=(2,) , use_bias=True),
])

model.compile(optimizer='adam',
loss='mean_squared_logarithmic_error',
metrics=['mae','accuracy'])

model.fit(t1, s, batch_size=50, epochs=2000, validation_data=(v1,u))


The model seems to train, but very poorly. The 'accuracy' metric is also zero, which I am very confused about.



Epoch 2000/2000
200/200 [==============================] - 0s 23us/step - loss: 0.0018 - mean_absolute_error: 1.0144 - acc: 0.0000e+00 - val_loss: 0.0014 - val_mean_absolute_error: 1.0276 - val_acc: 0.0000e+00


Visually, the predictions of the model seem to be reasonably accurate



enter image description here



I've tried other loss-functions but none of them seem to work any better. I'm fairly new to to using TF/Keras so is there something obvious that I'm missing?



Edit: corrected training output










share|cite|improve this question











$endgroup$







  • 1




    $begingroup$
    accuracy doesn't make sense as a metric for regression tasks.
    $endgroup$
    – shimao
    Apr 22 at 15:31










  • $begingroup$
    The term 'accuracy' is applicable to situations where you need to make class/category predictions where you have a success or failure on the label allocation, because you may be off by 0.1, and the RMSE (root mean square error) is therefore a more suitable measure to track
    $endgroup$
    – Vass
    Apr 22 at 15:40











  • $begingroup$
    I see, my mistake! Is there a way I can fix this by rounding/ using a few significant figures? Thanks.
    $endgroup$
    – nonreligious
    Apr 22 at 15:44










  • $begingroup$
    @nonreligious Accuracy isn't appropriate for this task, so I don't see how rounding would help you. What problem are you trying to solve? I don't think you'll find a square wheel terribly practical.
    $endgroup$
    – Sycorax
    Apr 22 at 15:46







  • 1




    $begingroup$
    i would suggest to also plot "residuals" for your result, that is difference between prediction and true data. That is much better way to visualize error than just data
    $endgroup$
    – aaaaaa
    Apr 22 at 16:35

















2












$begingroup$


Heads up: I'm not sure if this is the best place to post this question, so let me know if there is somewhere better suited.



I am trying to train a simple neural network to learn a simple quadratic function of the form:
$f(x) = 5 - 3x + 2x^2$



I set up a single-layered network with a single neuron.
The input is a 2d array of the form
$(x, x^2)$
and I don't use an activation function. I expect that the weights and biases I extract from the network will correspond to the coefficients in the function $f(x)$.



I randomly generate some training points and labels, as well as a validation data set, and train my model using the Keras sequential model called from TensorFlow.



import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt

def fTest(x_arg):
return 5 - 3*x_arg + 2*(x_arg)**2

# training data
t = np.random.choice(np.arange(-10,10, .01),5000 )
t1 = []
for i in range(len(t)):
t1.append([t[i], t[i]**2])
s = []
for i in range(len(t)):
s.append(fTest(t[i]))
t1 = np.array(t1)
s = np.array(s)

# validation set
v = np.random.choice(np.arange(-10,10, .01),5000 )
v1 = []
for i in range(len(v)):
v1.append([v[i], v[i]**2])
u = []
for i in range(len(v)):
u.append(fTest(v[i]))
v1 = np.array(v1)
u = np.array(u)

model = keras.Sequential([
keras.layers.Dense(1, input_shape=(2,) , use_bias=True),
])

model.compile(optimizer='adam',
loss='mean_squared_logarithmic_error',
metrics=['mae','accuracy'])

model.fit(t1, s, batch_size=50, epochs=2000, validation_data=(v1,u))


The model seems to train, but very poorly. The 'accuracy' metric is also zero, which I am very confused about.



Epoch 2000/2000
200/200 [==============================] - 0s 23us/step - loss: 0.0018 - mean_absolute_error: 1.0144 - acc: 0.0000e+00 - val_loss: 0.0014 - val_mean_absolute_error: 1.0276 - val_acc: 0.0000e+00


Visually, the predictions of the model seem to be reasonably accurate



enter image description here



I've tried other loss-functions but none of them seem to work any better. I'm fairly new to to using TF/Keras so is there something obvious that I'm missing?



Edit: corrected training output










share|cite|improve this question











$endgroup$







  • 1




    $begingroup$
    accuracy doesn't make sense as a metric for regression tasks.
    $endgroup$
    – shimao
    Apr 22 at 15:31










  • $begingroup$
    The term 'accuracy' is applicable to situations where you need to make class/category predictions where you have a success or failure on the label allocation, because you may be off by 0.1, and the RMSE (root mean square error) is therefore a more suitable measure to track
    $endgroup$
    – Vass
    Apr 22 at 15:40











  • $begingroup$
    I see, my mistake! Is there a way I can fix this by rounding/ using a few significant figures? Thanks.
    $endgroup$
    – nonreligious
    Apr 22 at 15:44










  • $begingroup$
    @nonreligious Accuracy isn't appropriate for this task, so I don't see how rounding would help you. What problem are you trying to solve? I don't think you'll find a square wheel terribly practical.
    $endgroup$
    – Sycorax
    Apr 22 at 15:46







  • 1




    $begingroup$
    i would suggest to also plot "residuals" for your result, that is difference between prediction and true data. That is much better way to visualize error than just data
    $endgroup$
    – aaaaaa
    Apr 22 at 16:35













2












2








2





$begingroup$


Heads up: I'm not sure if this is the best place to post this question, so let me know if there is somewhere better suited.



I am trying to train a simple neural network to learn a simple quadratic function of the form:
$f(x) = 5 - 3x + 2x^2$



I set up a single-layered network with a single neuron.
The input is a 2d array of the form
$(x, x^2)$
and I don't use an activation function. I expect that the weights and biases I extract from the network will correspond to the coefficients in the function $f(x)$.



I randomly generate some training points and labels, as well as a validation data set, and train my model using the Keras sequential model called from TensorFlow.



import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt

def fTest(x_arg):
return 5 - 3*x_arg + 2*(x_arg)**2

# training data
t = np.random.choice(np.arange(-10,10, .01),5000 )
t1 = []
for i in range(len(t)):
t1.append([t[i], t[i]**2])
s = []
for i in range(len(t)):
s.append(fTest(t[i]))
t1 = np.array(t1)
s = np.array(s)

# validation set
v = np.random.choice(np.arange(-10,10, .01),5000 )
v1 = []
for i in range(len(v)):
v1.append([v[i], v[i]**2])
u = []
for i in range(len(v)):
u.append(fTest(v[i]))
v1 = np.array(v1)
u = np.array(u)

model = keras.Sequential([
keras.layers.Dense(1, input_shape=(2,) , use_bias=True),
])

model.compile(optimizer='adam',
loss='mean_squared_logarithmic_error',
metrics=['mae','accuracy'])

model.fit(t1, s, batch_size=50, epochs=2000, validation_data=(v1,u))


The model seems to train, but very poorly. The 'accuracy' metric is also zero, which I am very confused about.



Epoch 2000/2000
200/200 [==============================] - 0s 23us/step - loss: 0.0018 - mean_absolute_error: 1.0144 - acc: 0.0000e+00 - val_loss: 0.0014 - val_mean_absolute_error: 1.0276 - val_acc: 0.0000e+00


Visually, the predictions of the model seem to be reasonably accurate



enter image description here



I've tried other loss-functions but none of them seem to work any better. I'm fairly new to to using TF/Keras so is there something obvious that I'm missing?



Edit: corrected training output










share|cite|improve this question











$endgroup$




Heads up: I'm not sure if this is the best place to post this question, so let me know if there is somewhere better suited.



I am trying to train a simple neural network to learn a simple quadratic function of the form:
$f(x) = 5 - 3x + 2x^2$



I set up a single-layered network with a single neuron.
The input is a 2d array of the form
$(x, x^2)$
and I don't use an activation function. I expect that the weights and biases I extract from the network will correspond to the coefficients in the function $f(x)$.



I randomly generate some training points and labels, as well as a validation data set, and train my model using the Keras sequential model called from TensorFlow.



import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt

def fTest(x_arg):
return 5 - 3*x_arg + 2*(x_arg)**2

# training data
t = np.random.choice(np.arange(-10,10, .01),5000 )
t1 = []
for i in range(len(t)):
t1.append([t[i], t[i]**2])
s = []
for i in range(len(t)):
s.append(fTest(t[i]))
t1 = np.array(t1)
s = np.array(s)

# validation set
v = np.random.choice(np.arange(-10,10, .01),5000 )
v1 = []
for i in range(len(v)):
v1.append([v[i], v[i]**2])
u = []
for i in range(len(v)):
u.append(fTest(v[i]))
v1 = np.array(v1)
u = np.array(u)

model = keras.Sequential([
keras.layers.Dense(1, input_shape=(2,) , use_bias=True),
])

model.compile(optimizer='adam',
loss='mean_squared_logarithmic_error',
metrics=['mae','accuracy'])

model.fit(t1, s, batch_size=50, epochs=2000, validation_data=(v1,u))


The model seems to train, but very poorly. The 'accuracy' metric is also zero, which I am very confused about.



Epoch 2000/2000
200/200 [==============================] - 0s 23us/step - loss: 0.0018 - mean_absolute_error: 1.0144 - acc: 0.0000e+00 - val_loss: 0.0014 - val_mean_absolute_error: 1.0276 - val_acc: 0.0000e+00


Visually, the predictions of the model seem to be reasonably accurate



enter image description here



I've tried other loss-functions but none of them seem to work any better. I'm fairly new to to using TF/Keras so is there something obvious that I'm missing?



Edit: corrected training output







neural-networks loss-functions accuracy






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Apr 22 at 16:05







nonreligious

















asked Apr 22 at 15:26









nonreligiousnonreligious

113




113







  • 1




    $begingroup$
    accuracy doesn't make sense as a metric for regression tasks.
    $endgroup$
    – shimao
    Apr 22 at 15:31










  • $begingroup$
    The term 'accuracy' is applicable to situations where you need to make class/category predictions where you have a success or failure on the label allocation, because you may be off by 0.1, and the RMSE (root mean square error) is therefore a more suitable measure to track
    $endgroup$
    – Vass
    Apr 22 at 15:40











  • $begingroup$
    I see, my mistake! Is there a way I can fix this by rounding/ using a few significant figures? Thanks.
    $endgroup$
    – nonreligious
    Apr 22 at 15:44










  • $begingroup$
    @nonreligious Accuracy isn't appropriate for this task, so I don't see how rounding would help you. What problem are you trying to solve? I don't think you'll find a square wheel terribly practical.
    $endgroup$
    – Sycorax
    Apr 22 at 15:46







  • 1




    $begingroup$
    i would suggest to also plot "residuals" for your result, that is difference between prediction and true data. That is much better way to visualize error than just data
    $endgroup$
    – aaaaaa
    Apr 22 at 16:35












  • 1




    $begingroup$
    accuracy doesn't make sense as a metric for regression tasks.
    $endgroup$
    – shimao
    Apr 22 at 15:31










  • $begingroup$
    The term 'accuracy' is applicable to situations where you need to make class/category predictions where you have a success or failure on the label allocation, because you may be off by 0.1, and the RMSE (root mean square error) is therefore a more suitable measure to track
    $endgroup$
    – Vass
    Apr 22 at 15:40











  • $begingroup$
    I see, my mistake! Is there a way I can fix this by rounding/ using a few significant figures? Thanks.
    $endgroup$
    – nonreligious
    Apr 22 at 15:44










  • $begingroup$
    @nonreligious Accuracy isn't appropriate for this task, so I don't see how rounding would help you. What problem are you trying to solve? I don't think you'll find a square wheel terribly practical.
    $endgroup$
    – Sycorax
    Apr 22 at 15:46







  • 1




    $begingroup$
    i would suggest to also plot "residuals" for your result, that is difference between prediction and true data. That is much better way to visualize error than just data
    $endgroup$
    – aaaaaa
    Apr 22 at 16:35







1




1




$begingroup$
accuracy doesn't make sense as a metric for regression tasks.
$endgroup$
– shimao
Apr 22 at 15:31




$begingroup$
accuracy doesn't make sense as a metric for regression tasks.
$endgroup$
– shimao
Apr 22 at 15:31












$begingroup$
The term 'accuracy' is applicable to situations where you need to make class/category predictions where you have a success or failure on the label allocation, because you may be off by 0.1, and the RMSE (root mean square error) is therefore a more suitable measure to track
$endgroup$
– Vass
Apr 22 at 15:40





$begingroup$
The term 'accuracy' is applicable to situations where you need to make class/category predictions where you have a success or failure on the label allocation, because you may be off by 0.1, and the RMSE (root mean square error) is therefore a more suitable measure to track
$endgroup$
– Vass
Apr 22 at 15:40













$begingroup$
I see, my mistake! Is there a way I can fix this by rounding/ using a few significant figures? Thanks.
$endgroup$
– nonreligious
Apr 22 at 15:44




$begingroup$
I see, my mistake! Is there a way I can fix this by rounding/ using a few significant figures? Thanks.
$endgroup$
– nonreligious
Apr 22 at 15:44












$begingroup$
@nonreligious Accuracy isn't appropriate for this task, so I don't see how rounding would help you. What problem are you trying to solve? I don't think you'll find a square wheel terribly practical.
$endgroup$
– Sycorax
Apr 22 at 15:46





$begingroup$
@nonreligious Accuracy isn't appropriate for this task, so I don't see how rounding would help you. What problem are you trying to solve? I don't think you'll find a square wheel terribly practical.
$endgroup$
– Sycorax
Apr 22 at 15:46





1




1




$begingroup$
i would suggest to also plot "residuals" for your result, that is difference between prediction and true data. That is much better way to visualize error than just data
$endgroup$
– aaaaaa
Apr 22 at 16:35




$begingroup$
i would suggest to also plot "residuals" for your result, that is difference between prediction and true data. That is much better way to visualize error than just data
$endgroup$
– aaaaaa
Apr 22 at 16:35










1 Answer
1






active

oldest

votes


















3












$begingroup$

You're misunderstanding what accuracy, in the sense Keras implements, measures. Accuracy measures the proportion of samples correctly predicted, such as allocating images into classes (e.g. "dog," "cat," or "fish").



In your problem, you're not trying to infer class membership, you just want the predictions to be close to the true values. It's not surprising that accuracy is poor, because accuracy doesn't measure anything relevant about this problem.






share|cite|improve this answer











$endgroup$












  • $begingroup$
    I see, my mistake! Is there a way I can improve the training to reduce the loss further? It seems pretty poor at the moment.
    $endgroup$
    – nonreligious
    Apr 22 at 15:47











  • $begingroup$
    What is poor? loss: 4.5276e-13 is at the edge of machine epsilon.
    $endgroup$
    – Sycorax
    Apr 22 at 15:51










  • $begingroup$
    Sorry - I have been going round in circles and think I pasted the wrong thing. I tried this again and found Epoch 2000/2000 200/200 [==============================] - 0s 23us/step - loss: 0.0018 - mean_absolute_error: 1.0144 - acc: 0.0000e+00 - val_loss: 0.0014 - val_mean_absolute_error: 1.0276 - val_acc: 0.0000e+00 but I think this can be improved with more rounds of training. Thanks for your help, I will re-evaluate what I am asking.
    $endgroup$
    – nonreligious
    Apr 22 at 15:59











  • $begingroup$
    Glad to help. We also have a thread about how to go about debugging and improving a network to fit the training data well. Perhaps you would find it helpful : stats.stackexchange.com/questions/352036/…
    $endgroup$
    – Sycorax
    Apr 22 at 16:02










  • $begingroup$
    Cheers, this looks very useful!
    $endgroup$
    – nonreligious
    Apr 22 at 16:06











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "65"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f404410%2flearning-a-quadratic-function-using-tensorflow-keras%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3












$begingroup$

You're misunderstanding what accuracy, in the sense Keras implements, measures. Accuracy measures the proportion of samples correctly predicted, such as allocating images into classes (e.g. "dog," "cat," or "fish").



In your problem, you're not trying to infer class membership, you just want the predictions to be close to the true values. It's not surprising that accuracy is poor, because accuracy doesn't measure anything relevant about this problem.






share|cite|improve this answer











$endgroup$












  • $begingroup$
    I see, my mistake! Is there a way I can improve the training to reduce the loss further? It seems pretty poor at the moment.
    $endgroup$
    – nonreligious
    Apr 22 at 15:47











  • $begingroup$
    What is poor? loss: 4.5276e-13 is at the edge of machine epsilon.
    $endgroup$
    – Sycorax
    Apr 22 at 15:51










  • $begingroup$
    Sorry - I have been going round in circles and think I pasted the wrong thing. I tried this again and found Epoch 2000/2000 200/200 [==============================] - 0s 23us/step - loss: 0.0018 - mean_absolute_error: 1.0144 - acc: 0.0000e+00 - val_loss: 0.0014 - val_mean_absolute_error: 1.0276 - val_acc: 0.0000e+00 but I think this can be improved with more rounds of training. Thanks for your help, I will re-evaluate what I am asking.
    $endgroup$
    – nonreligious
    Apr 22 at 15:59











  • $begingroup$
    Glad to help. We also have a thread about how to go about debugging and improving a network to fit the training data well. Perhaps you would find it helpful : stats.stackexchange.com/questions/352036/…
    $endgroup$
    – Sycorax
    Apr 22 at 16:02










  • $begingroup$
    Cheers, this looks very useful!
    $endgroup$
    – nonreligious
    Apr 22 at 16:06















3












$begingroup$

You're misunderstanding what accuracy, in the sense Keras implements, measures. Accuracy measures the proportion of samples correctly predicted, such as allocating images into classes (e.g. "dog," "cat," or "fish").



In your problem, you're not trying to infer class membership, you just want the predictions to be close to the true values. It's not surprising that accuracy is poor, because accuracy doesn't measure anything relevant about this problem.






share|cite|improve this answer











$endgroup$












  • $begingroup$
    I see, my mistake! Is there a way I can improve the training to reduce the loss further? It seems pretty poor at the moment.
    $endgroup$
    – nonreligious
    Apr 22 at 15:47











  • $begingroup$
    What is poor? loss: 4.5276e-13 is at the edge of machine epsilon.
    $endgroup$
    – Sycorax
    Apr 22 at 15:51










  • $begingroup$
    Sorry - I have been going round in circles and think I pasted the wrong thing. I tried this again and found Epoch 2000/2000 200/200 [==============================] - 0s 23us/step - loss: 0.0018 - mean_absolute_error: 1.0144 - acc: 0.0000e+00 - val_loss: 0.0014 - val_mean_absolute_error: 1.0276 - val_acc: 0.0000e+00 but I think this can be improved with more rounds of training. Thanks for your help, I will re-evaluate what I am asking.
    $endgroup$
    – nonreligious
    Apr 22 at 15:59











  • $begingroup$
    Glad to help. We also have a thread about how to go about debugging and improving a network to fit the training data well. Perhaps you would find it helpful : stats.stackexchange.com/questions/352036/…
    $endgroup$
    – Sycorax
    Apr 22 at 16:02










  • $begingroup$
    Cheers, this looks very useful!
    $endgroup$
    – nonreligious
    Apr 22 at 16:06













3












3








3





$begingroup$

You're misunderstanding what accuracy, in the sense Keras implements, measures. Accuracy measures the proportion of samples correctly predicted, such as allocating images into classes (e.g. "dog," "cat," or "fish").



In your problem, you're not trying to infer class membership, you just want the predictions to be close to the true values. It's not surprising that accuracy is poor, because accuracy doesn't measure anything relevant about this problem.






share|cite|improve this answer











$endgroup$



You're misunderstanding what accuracy, in the sense Keras implements, measures. Accuracy measures the proportion of samples correctly predicted, such as allocating images into classes (e.g. "dog," "cat," or "fish").



In your problem, you're not trying to infer class membership, you just want the predictions to be close to the true values. It's not surprising that accuracy is poor, because accuracy doesn't measure anything relevant about this problem.







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Apr 22 at 15:44

























answered Apr 22 at 15:30









SycoraxSycorax

43.3k12112208




43.3k12112208











  • $begingroup$
    I see, my mistake! Is there a way I can improve the training to reduce the loss further? It seems pretty poor at the moment.
    $endgroup$
    – nonreligious
    Apr 22 at 15:47











  • $begingroup$
    What is poor? loss: 4.5276e-13 is at the edge of machine epsilon.
    $endgroup$
    – Sycorax
    Apr 22 at 15:51










  • $begingroup$
    Sorry - I have been going round in circles and think I pasted the wrong thing. I tried this again and found Epoch 2000/2000 200/200 [==============================] - 0s 23us/step - loss: 0.0018 - mean_absolute_error: 1.0144 - acc: 0.0000e+00 - val_loss: 0.0014 - val_mean_absolute_error: 1.0276 - val_acc: 0.0000e+00 but I think this can be improved with more rounds of training. Thanks for your help, I will re-evaluate what I am asking.
    $endgroup$
    – nonreligious
    Apr 22 at 15:59











  • $begingroup$
    Glad to help. We also have a thread about how to go about debugging and improving a network to fit the training data well. Perhaps you would find it helpful : stats.stackexchange.com/questions/352036/…
    $endgroup$
    – Sycorax
    Apr 22 at 16:02










  • $begingroup$
    Cheers, this looks very useful!
    $endgroup$
    – nonreligious
    Apr 22 at 16:06
















  • $begingroup$
    I see, my mistake! Is there a way I can improve the training to reduce the loss further? It seems pretty poor at the moment.
    $endgroup$
    – nonreligious
    Apr 22 at 15:47











  • $begingroup$
    What is poor? loss: 4.5276e-13 is at the edge of machine epsilon.
    $endgroup$
    – Sycorax
    Apr 22 at 15:51










  • $begingroup$
    Sorry - I have been going round in circles and think I pasted the wrong thing. I tried this again and found Epoch 2000/2000 200/200 [==============================] - 0s 23us/step - loss: 0.0018 - mean_absolute_error: 1.0144 - acc: 0.0000e+00 - val_loss: 0.0014 - val_mean_absolute_error: 1.0276 - val_acc: 0.0000e+00 but I think this can be improved with more rounds of training. Thanks for your help, I will re-evaluate what I am asking.
    $endgroup$
    – nonreligious
    Apr 22 at 15:59











  • $begingroup$
    Glad to help. We also have a thread about how to go about debugging and improving a network to fit the training data well. Perhaps you would find it helpful : stats.stackexchange.com/questions/352036/…
    $endgroup$
    – Sycorax
    Apr 22 at 16:02










  • $begingroup$
    Cheers, this looks very useful!
    $endgroup$
    – nonreligious
    Apr 22 at 16:06















$begingroup$
I see, my mistake! Is there a way I can improve the training to reduce the loss further? It seems pretty poor at the moment.
$endgroup$
– nonreligious
Apr 22 at 15:47





$begingroup$
I see, my mistake! Is there a way I can improve the training to reduce the loss further? It seems pretty poor at the moment.
$endgroup$
– nonreligious
Apr 22 at 15:47













$begingroup$
What is poor? loss: 4.5276e-13 is at the edge of machine epsilon.
$endgroup$
– Sycorax
Apr 22 at 15:51




$begingroup$
What is poor? loss: 4.5276e-13 is at the edge of machine epsilon.
$endgroup$
– Sycorax
Apr 22 at 15:51












$begingroup$
Sorry - I have been going round in circles and think I pasted the wrong thing. I tried this again and found Epoch 2000/2000 200/200 [==============================] - 0s 23us/step - loss: 0.0018 - mean_absolute_error: 1.0144 - acc: 0.0000e+00 - val_loss: 0.0014 - val_mean_absolute_error: 1.0276 - val_acc: 0.0000e+00 but I think this can be improved with more rounds of training. Thanks for your help, I will re-evaluate what I am asking.
$endgroup$
– nonreligious
Apr 22 at 15:59





$begingroup$
Sorry - I have been going round in circles and think I pasted the wrong thing. I tried this again and found Epoch 2000/2000 200/200 [==============================] - 0s 23us/step - loss: 0.0018 - mean_absolute_error: 1.0144 - acc: 0.0000e+00 - val_loss: 0.0014 - val_mean_absolute_error: 1.0276 - val_acc: 0.0000e+00 but I think this can be improved with more rounds of training. Thanks for your help, I will re-evaluate what I am asking.
$endgroup$
– nonreligious
Apr 22 at 15:59













$begingroup$
Glad to help. We also have a thread about how to go about debugging and improving a network to fit the training data well. Perhaps you would find it helpful : stats.stackexchange.com/questions/352036/…
$endgroup$
– Sycorax
Apr 22 at 16:02




$begingroup$
Glad to help. We also have a thread about how to go about debugging and improving a network to fit the training data well. Perhaps you would find it helpful : stats.stackexchange.com/questions/352036/…
$endgroup$
– Sycorax
Apr 22 at 16:02












$begingroup$
Cheers, this looks very useful!
$endgroup$
– nonreligious
Apr 22 at 16:06




$begingroup$
Cheers, this looks very useful!
$endgroup$
– nonreligious
Apr 22 at 16:06

















draft saved

draft discarded
















































Thanks for contributing an answer to Cross Validated!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f404410%2flearning-a-quadratic-function-using-tensorflow-keras%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company