0
$\begingroup$

I am trying to create a simple NN using keras, i have data in this form:

Simple matrix of numbers ranging from 0 to 100

which contains rows of 4 numbers ranging from 0 to 100, based on these values i am trying to predict the outcome as 0 or 1 This is the code which i have used:

import numpy as np
import pandas as pd
import keras

from keras.models import Sequential
from keras.layers import Dense

from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix

dataset = pd.read_csv('user_test.csv')

X = dataset.iloc[:, 4:8].values
y = dataset.iloc[:, 8].values
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2)
classifier = Sequential()
classifier.add(Dense(activation = 'relu', input_dim = 4, units = 4, 
                     kernel_initializer = 'uniform'))
classifier.add(Dense(activation = 'relu', units = 4, kernel_initializer = 'uniform'))
classifier.add(Dense(activation = 'sigmoid', units = 1, 
                     kernel_initializer = 'uniform'))

classifier.compile(optimizer = 'adam', loss='mean_squared_error', metrics = ['accuracy'])
classifier.fit(X_train, y_train, batch_size = 10, epochs = 100)

Now after 100 epochs the loss and accuracy remains same, why is it not changing at all ? i have tried SGD with 0.1 as learning rate but it remained almost same, also i have tried 'binary_crossentropy' as loss function, is the model overfitting here ?

Learning

I have 10,000 rows which i have split into 80% training, 20% testing, is the data too low ? Also the confusion matrix looks wrong at

y_pred = classifier.predict(X_test)
y_pred = (y_pred > 0.5)
confusion_matrix(y_test, y_pred)

Confusion matrix

How do i predict 1 column value, 0 or 1 , based on 4 simple features using keras ?

$\endgroup$

Your Answer

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

Browse other questions tagged or ask your own question.