Is this a data issue, or a model issue? A Keras binary classification model Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Moderator Election Q&A - Questionnaire 2019 Community Moderator Election ResultsConvolution Neural Network Loss and performanceTensorflow regression predicting 1 for all inputsNeural network accuracy for simple classificationSimple prediction with KerasValueError: Error when checking target: expected dense_2 to have shape (1,) but got array with shape (0,)How to set input for proper fit with lstm?Xor gate accuracy improvementIs my model over-fitting (LSTM,GRU)Value error in Merging two different models in kerasIN CIFAR 10 DATASET
How to find out what spells would be useless to a blind NPC spellcaster?
Coloring maths inside a tcolorbox
How come Sam didn't become Lord of Horn Hill?
String `!23` is replaced with `docker` in command line
Why do people hide their license plates in the EU?
What's the purpose of writing one's academic biography in the third person?
What LEGO pieces have "real-world" functionality?
What is the role of the transistor and diode in a soft start circuit?
How to answer "Have you ever been terminated?"
Echoing a tail command produces unexpected output?
How does debian/ubuntu knows a package has a updated version
What is the meaning of the new sigil in Game of Thrones Season 8 intro?
What is Arya's weapon design?
Generate an RGB colour grid
Why didn't this character "real die" when they blew their stack out in Altered Carbon?
English words in a non-english sci-fi novel
Book where humans were engineered with genes from animal species to survive hostile planets
How discoverable are IPv6 addresses and AAAA names by potential attackers?
At the end of Thor: Ragnarok why don't the Asgardians turn and head for the Bifrost as per their original plan?
Why am I getting the error "non-boolean type specified in a context where a condition is expected" for this request?
Why did the rest of the Eastern Bloc not invade Yugoslavia?
Why are Kinder Surprise Eggs illegal in the USA?
Can a USB port passively 'listen only'?
When were vectors invented?
Is this a data issue, or a model issue? A Keras binary classification model
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Moderator Election Q&A - Questionnaire
2019 Community Moderator Election ResultsConvolution Neural Network Loss and performanceTensorflow regression predicting 1 for all inputsNeural network accuracy for simple classificationSimple prediction with KerasValueError: Error when checking target: expected dense_2 to have shape (1,) but got array with shape (0,)How to set input for proper fit with lstm?Xor gate accuracy improvementIs my model over-fitting (LSTM,GRU)Value error in Merging two different models in kerasIN CIFAR 10 DATASET
$begingroup$
I've been trying to create a binary classification model that predicts wether there will be a train delay based on the train and time. Here is a link to the data
The issue I'm having is that my accuracy goes to 94.07 in the first 5 epochs. Meanwhile, my class prediction will always be 0 and never 1.
From what I understand, this is "Accuracy Paradox". A symptom of Class Imbalance. To combat this, I implemented Kfold.
kfold = StratifiedKFold(n_splits=10,shuffle=True)
cvs_scores = []
for train,test in kfold.split(X,Y):
history = model.fit(X[train],Y[train],epochs=50,batch_size=15, shuffle = False, verbose = 1)
scores = model.evaluate(X[test],Y[test],verbose=0)
print("%s: %.2f%%" % (model.metrics_names[1],scores[1]*100))
cvs_scores.append(scores[1] * 100)
print("%.2f%% (+/- %.2f%%)" % (numpy.mean(cvs_scores),numpy.std(cvs_scores)))
No luck. Still had the same issue as before.
Here is how I import my data:
raw_data = pd.read_csv('MTA_DELAY_DATA_DUMP - Sheet1.csv')
X = raw_data.iloc[1:-2,0:2].dropna().values
Y = raw_data.iloc[1:-2,2:3].dropna().astype(int).values
My Model:
model = Sequential()
model.add(Dense(32, kernel_initializer='uniform', activation='relu',input_dim =2))
model.add(Dense(16, kernel_initializer='uniform', activation='relu'))
model.add(Dense(8, kernel_initializer='uniform', activation='relu'))
model.add(Dense(1, kernel_initializer='uniform', activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer=Adam(lr=0.001),metrics=['accuracy'])
history = model.fit(X,Y,epochs=150,batch_size=15, shuffle = False, verbose = 1)
I tried assigning class weights to balance the data out. Even manually deleting 0's in the data, but nothing seems to result in accurate predictions. Am I doing something wrong in the model, or is this simply data that cannot be utilized by machine learning?
machine-learning deep-learning keras dataset data-cleaning
New contributor
$endgroup$
add a comment |
$begingroup$
I've been trying to create a binary classification model that predicts wether there will be a train delay based on the train and time. Here is a link to the data
The issue I'm having is that my accuracy goes to 94.07 in the first 5 epochs. Meanwhile, my class prediction will always be 0 and never 1.
From what I understand, this is "Accuracy Paradox". A symptom of Class Imbalance. To combat this, I implemented Kfold.
kfold = StratifiedKFold(n_splits=10,shuffle=True)
cvs_scores = []
for train,test in kfold.split(X,Y):
history = model.fit(X[train],Y[train],epochs=50,batch_size=15, shuffle = False, verbose = 1)
scores = model.evaluate(X[test],Y[test],verbose=0)
print("%s: %.2f%%" % (model.metrics_names[1],scores[1]*100))
cvs_scores.append(scores[1] * 100)
print("%.2f%% (+/- %.2f%%)" % (numpy.mean(cvs_scores),numpy.std(cvs_scores)))
No luck. Still had the same issue as before.
Here is how I import my data:
raw_data = pd.read_csv('MTA_DELAY_DATA_DUMP - Sheet1.csv')
X = raw_data.iloc[1:-2,0:2].dropna().values
Y = raw_data.iloc[1:-2,2:3].dropna().astype(int).values
My Model:
model = Sequential()
model.add(Dense(32, kernel_initializer='uniform', activation='relu',input_dim =2))
model.add(Dense(16, kernel_initializer='uniform', activation='relu'))
model.add(Dense(8, kernel_initializer='uniform', activation='relu'))
model.add(Dense(1, kernel_initializer='uniform', activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer=Adam(lr=0.001),metrics=['accuracy'])
history = model.fit(X,Y,epochs=150,batch_size=15, shuffle = False, verbose = 1)
I tried assigning class weights to balance the data out. Even manually deleting 0's in the data, but nothing seems to result in accurate predictions. Am I doing something wrong in the model, or is this simply data that cannot be utilized by machine learning?
machine-learning deep-learning keras dataset data-cleaning
New contributor
$endgroup$
add a comment |
$begingroup$
I've been trying to create a binary classification model that predicts wether there will be a train delay based on the train and time. Here is a link to the data
The issue I'm having is that my accuracy goes to 94.07 in the first 5 epochs. Meanwhile, my class prediction will always be 0 and never 1.
From what I understand, this is "Accuracy Paradox". A symptom of Class Imbalance. To combat this, I implemented Kfold.
kfold = StratifiedKFold(n_splits=10,shuffle=True)
cvs_scores = []
for train,test in kfold.split(X,Y):
history = model.fit(X[train],Y[train],epochs=50,batch_size=15, shuffle = False, verbose = 1)
scores = model.evaluate(X[test],Y[test],verbose=0)
print("%s: %.2f%%" % (model.metrics_names[1],scores[1]*100))
cvs_scores.append(scores[1] * 100)
print("%.2f%% (+/- %.2f%%)" % (numpy.mean(cvs_scores),numpy.std(cvs_scores)))
No luck. Still had the same issue as before.
Here is how I import my data:
raw_data = pd.read_csv('MTA_DELAY_DATA_DUMP - Sheet1.csv')
X = raw_data.iloc[1:-2,0:2].dropna().values
Y = raw_data.iloc[1:-2,2:3].dropna().astype(int).values
My Model:
model = Sequential()
model.add(Dense(32, kernel_initializer='uniform', activation='relu',input_dim =2))
model.add(Dense(16, kernel_initializer='uniform', activation='relu'))
model.add(Dense(8, kernel_initializer='uniform', activation='relu'))
model.add(Dense(1, kernel_initializer='uniform', activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer=Adam(lr=0.001),metrics=['accuracy'])
history = model.fit(X,Y,epochs=150,batch_size=15, shuffle = False, verbose = 1)
I tried assigning class weights to balance the data out. Even manually deleting 0's in the data, but nothing seems to result in accurate predictions. Am I doing something wrong in the model, or is this simply data that cannot be utilized by machine learning?
machine-learning deep-learning keras dataset data-cleaning
New contributor
$endgroup$
I've been trying to create a binary classification model that predicts wether there will be a train delay based on the train and time. Here is a link to the data
The issue I'm having is that my accuracy goes to 94.07 in the first 5 epochs. Meanwhile, my class prediction will always be 0 and never 1.
From what I understand, this is "Accuracy Paradox". A symptom of Class Imbalance. To combat this, I implemented Kfold.
kfold = StratifiedKFold(n_splits=10,shuffle=True)
cvs_scores = []
for train,test in kfold.split(X,Y):
history = model.fit(X[train],Y[train],epochs=50,batch_size=15, shuffle = False, verbose = 1)
scores = model.evaluate(X[test],Y[test],verbose=0)
print("%s: %.2f%%" % (model.metrics_names[1],scores[1]*100))
cvs_scores.append(scores[1] * 100)
print("%.2f%% (+/- %.2f%%)" % (numpy.mean(cvs_scores),numpy.std(cvs_scores)))
No luck. Still had the same issue as before.
Here is how I import my data:
raw_data = pd.read_csv('MTA_DELAY_DATA_DUMP - Sheet1.csv')
X = raw_data.iloc[1:-2,0:2].dropna().values
Y = raw_data.iloc[1:-2,2:3].dropna().astype(int).values
My Model:
model = Sequential()
model.add(Dense(32, kernel_initializer='uniform', activation='relu',input_dim =2))
model.add(Dense(16, kernel_initializer='uniform', activation='relu'))
model.add(Dense(8, kernel_initializer='uniform', activation='relu'))
model.add(Dense(1, kernel_initializer='uniform', activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer=Adam(lr=0.001),metrics=['accuracy'])
history = model.fit(X,Y,epochs=150,batch_size=15, shuffle = False, verbose = 1)
I tried assigning class weights to balance the data out. Even manually deleting 0's in the data, but nothing seems to result in accurate predictions. Am I doing something wrong in the model, or is this simply data that cannot be utilized by machine learning?
machine-learning deep-learning keras dataset data-cleaning
machine-learning deep-learning keras dataset data-cleaning
New contributor
New contributor
New contributor
asked 7 mins ago
PavlovsCatPavlovsCat
1
1
New contributor
New contributor
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "557"
;
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
);
);
PavlovsCat is a new contributor. Be nice, and check out our Code of Conduct.
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%2fdatascience.stackexchange.com%2fquestions%2f49448%2fis-this-a-data-issue-or-a-model-issue-a-keras-binary-classification-model%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
PavlovsCat is a new contributor. Be nice, and check out our Code of Conduct.
PavlovsCat is a new contributor. Be nice, and check out our Code of Conduct.
PavlovsCat is a new contributor. Be nice, and check out our Code of Conduct.
PavlovsCat is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Data Science Stack Exchange!
- 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.
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%2fdatascience.stackexchange.com%2fquestions%2f49448%2fis-this-a-data-issue-or-a-model-issue-a-keras-binary-classification-model%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