How to find the wrong predictions in Keras? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How to build Convolutional Bi-directional LSTM with KerasKeras: reshape to connect lstm and convHow to change batch size of an intermediate layer in Keras?loss, val_loss, acc and val_acc do not update at all over epochsHow to process a large image in Keras?TypeError when trying to create a BLSTM network in KerasKeras AttributeError: 'list' object has no attribute 'ndim'Dimensionality Error when using Bidirectional LSTM with an embedding layer, on multi-label classificationEpoch's steps taking too long on GPUIs it possible to train a CNN starting at an intermediate layer (in general and in Keras)?
PIC mathematical operations weird problem
Expansion//Explosion and Siren Stormtamer
What *exactly* is electrical current, voltage, and resistance?
finding a tangent line to a parabola
A faster way to compute the largest prime factor
Additive group of local rings
Co-worker works way more than he should
How to open locks without disable device?
Are all CP/M-80 implementations binary compatible?
How to avoid introduction cliches
What ability score does a Hexblade's Pact Weapon use for attack and damage when wielded by another character?
Is Electric Central Heating worth it if using Solar Panels?
Would reducing the reference voltage of an ADC have any effect on accuracy?
Why did Israel vote against lifting the American embargo on Cuba?
Is accepting an invalid credit card number a security issue?
Seek and ye shall find
What is the least dense liquid under normal conditions?
Why did C use the -> operator instead of reusing the . operator?
Does Feeblemind produce an ongoing magical effect that can be dispelled?
Arriving in Atlanta after US Preclearance in Dublin. Will I go through TSA security in Atlanta to transfer to a connecting flight?
Contradiction proof for inequality of P and NP?
My admission is revoked after accepting the admission offer
Is there any hidden 'W' sound after 'comment' in : Comment est-elle?
Married in secret, can marital status in passport be changed at a later date?
How to find the wrong predictions in Keras?
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How to build Convolutional Bi-directional LSTM with KerasKeras: reshape to connect lstm and convHow to change batch size of an intermediate layer in Keras?loss, val_loss, acc and val_acc do not update at all over epochsHow to process a large image in Keras?TypeError when trying to create a BLSTM network in KerasKeras AttributeError: 'list' object has no attribute 'ndim'Dimensionality Error when using Bidirectional LSTM with an embedding layer, on multi-label classificationEpoch's steps taking too long on GPUIs it possible to train a CNN starting at an intermediate layer (in general and in Keras)?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have built a Keras model for extracting information from a raw input of text input. I am getting an accuracy of 0.9869. How can I know which of the training data is making the accuracy go low? I have pasted the code I am using below.
import numpy as np
from keras.models import Model, load_model
from keras.layers import Input, Dense, LSTM, Activation, Bidirectional, Dot, Flatten
from keras.callbacks import ModelCheckpoint
x_nyha = np.load("data/x_nyha.npy")
y_nyha = np.load("data/y/y_nyha.npy")
print(x_nyha.shape)
print(y_nyha.shape)
input_shape = x_nyha.shape[1:3]
X = Input(shape=input_shape)
A = Bidirectional(LSTM(512, return_sequences=True), merge_mode='concat')(X)
D = Dense(900, activation='relu')(A)
E = Dense(1, activation='sigmoid')(D)
Y = Flatten()(E)
model = Model(X, Y)
model.summary()
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
batch_size = 128
num_epochs = 50
model.fit(x_nyha, y_nyha, batch_size=batch_size, epochs=num_epochs, verbose=1)
python-3.x machine-learning keras classification
add a comment |
I have built a Keras model for extracting information from a raw input of text input. I am getting an accuracy of 0.9869. How can I know which of the training data is making the accuracy go low? I have pasted the code I am using below.
import numpy as np
from keras.models import Model, load_model
from keras.layers import Input, Dense, LSTM, Activation, Bidirectional, Dot, Flatten
from keras.callbacks import ModelCheckpoint
x_nyha = np.load("data/x_nyha.npy")
y_nyha = np.load("data/y/y_nyha.npy")
print(x_nyha.shape)
print(y_nyha.shape)
input_shape = x_nyha.shape[1:3]
X = Input(shape=input_shape)
A = Bidirectional(LSTM(512, return_sequences=True), merge_mode='concat')(X)
D = Dense(900, activation='relu')(A)
E = Dense(1, activation='sigmoid')(D)
Y = Flatten()(E)
model = Model(X, Y)
model.summary()
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
batch_size = 128
num_epochs = 50
model.fit(x_nyha, y_nyha, batch_size=batch_size, epochs=num_epochs, verbose=1)
python-3.x machine-learning keras classification
add a comment |
I have built a Keras model for extracting information from a raw input of text input. I am getting an accuracy of 0.9869. How can I know which of the training data is making the accuracy go low? I have pasted the code I am using below.
import numpy as np
from keras.models import Model, load_model
from keras.layers import Input, Dense, LSTM, Activation, Bidirectional, Dot, Flatten
from keras.callbacks import ModelCheckpoint
x_nyha = np.load("data/x_nyha.npy")
y_nyha = np.load("data/y/y_nyha.npy")
print(x_nyha.shape)
print(y_nyha.shape)
input_shape = x_nyha.shape[1:3]
X = Input(shape=input_shape)
A = Bidirectional(LSTM(512, return_sequences=True), merge_mode='concat')(X)
D = Dense(900, activation='relu')(A)
E = Dense(1, activation='sigmoid')(D)
Y = Flatten()(E)
model = Model(X, Y)
model.summary()
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
batch_size = 128
num_epochs = 50
model.fit(x_nyha, y_nyha, batch_size=batch_size, epochs=num_epochs, verbose=1)
python-3.x machine-learning keras classification
I have built a Keras model for extracting information from a raw input of text input. I am getting an accuracy of 0.9869. How can I know which of the training data is making the accuracy go low? I have pasted the code I am using below.
import numpy as np
from keras.models import Model, load_model
from keras.layers import Input, Dense, LSTM, Activation, Bidirectional, Dot, Flatten
from keras.callbacks import ModelCheckpoint
x_nyha = np.load("data/x_nyha.npy")
y_nyha = np.load("data/y/y_nyha.npy")
print(x_nyha.shape)
print(y_nyha.shape)
input_shape = x_nyha.shape[1:3]
X = Input(shape=input_shape)
A = Bidirectional(LSTM(512, return_sequences=True), merge_mode='concat')(X)
D = Dense(900, activation='relu')(A)
E = Dense(1, activation='sigmoid')(D)
Y = Flatten()(E)
model = Model(X, Y)
model.summary()
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
batch_size = 128
num_epochs = 50
model.fit(x_nyha, y_nyha, batch_size=batch_size, epochs=num_epochs, verbose=1)
python-3.x machine-learning keras classification
python-3.x machine-learning keras classification
edited Mar 9 at 14:02
desertnaut
21.2k84680
21.2k84680
asked Mar 9 at 6:30
Geeth Govind SGeeth Govind S
156
156
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I think that the easiest way will be the following: train model on training data, make predictions on training data and have a look at training samples where predictions are wrong.
An example of code:
model.fit(x_nyha, y_nyha, batch_size=batch_size, epochs=num_epochs, verbose=1)
prediction = np.round(model.predict(x_nyha))
wrong_predictions = x_nyha[prediction != y_nyha]
This way wrong_predictions
contains rows, where your prediction as wrong.
1
Thank you. I checked it out and it worked.
– Geeth Govind S
Mar 10 at 4:44
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55074681%2fhow-to-find-the-wrong-predictions-in-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
I think that the easiest way will be the following: train model on training data, make predictions on training data and have a look at training samples where predictions are wrong.
An example of code:
model.fit(x_nyha, y_nyha, batch_size=batch_size, epochs=num_epochs, verbose=1)
prediction = np.round(model.predict(x_nyha))
wrong_predictions = x_nyha[prediction != y_nyha]
This way wrong_predictions
contains rows, where your prediction as wrong.
1
Thank you. I checked it out and it worked.
– Geeth Govind S
Mar 10 at 4:44
add a comment |
I think that the easiest way will be the following: train model on training data, make predictions on training data and have a look at training samples where predictions are wrong.
An example of code:
model.fit(x_nyha, y_nyha, batch_size=batch_size, epochs=num_epochs, verbose=1)
prediction = np.round(model.predict(x_nyha))
wrong_predictions = x_nyha[prediction != y_nyha]
This way wrong_predictions
contains rows, where your prediction as wrong.
1
Thank you. I checked it out and it worked.
– Geeth Govind S
Mar 10 at 4:44
add a comment |
I think that the easiest way will be the following: train model on training data, make predictions on training data and have a look at training samples where predictions are wrong.
An example of code:
model.fit(x_nyha, y_nyha, batch_size=batch_size, epochs=num_epochs, verbose=1)
prediction = np.round(model.predict(x_nyha))
wrong_predictions = x_nyha[prediction != y_nyha]
This way wrong_predictions
contains rows, where your prediction as wrong.
I think that the easiest way will be the following: train model on training data, make predictions on training data and have a look at training samples where predictions are wrong.
An example of code:
model.fit(x_nyha, y_nyha, batch_size=batch_size, epochs=num_epochs, verbose=1)
prediction = np.round(model.predict(x_nyha))
wrong_predictions = x_nyha[prediction != y_nyha]
This way wrong_predictions
contains rows, where your prediction as wrong.
answered Mar 9 at 6:39
Andrey LukyanenkoAndrey Lukyanenko
1,5692612
1,5692612
1
Thank you. I checked it out and it worked.
– Geeth Govind S
Mar 10 at 4:44
add a comment |
1
Thank you. I checked it out and it worked.
– Geeth Govind S
Mar 10 at 4:44
1
1
Thank you. I checked it out and it worked.
– Geeth Govind S
Mar 10 at 4:44
Thank you. I checked it out and it worked.
– Geeth Govind S
Mar 10 at 4:44
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55074681%2fhow-to-find-the-wrong-predictions-in-keras%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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