Home > other >  Model. The predict () the result is 0
Model. The predict () the result is 0

Time:09-20

The new deep learning, in the use of Python for binary classification problems, my model accuracy of about 90%, but the use of predict results are all zero, the code is as follows:
 x=data. Iloc [: :] 36. As_matrix () # 36 attribute 
Y=data. The iloc [: 36] as_matrix () the last column is the tag #, 0 or 1
X_train x_test, y_train, y_test=model_selection train_test_split (x, y, test_size=0.2)

X_train=preprocessing. The normalize (x_train)
X_test=preprocessing. The normalize (x_test)

The model=Sequential ()
Model. The add (Dense (36, input_dim=36, activation='relu'))
Model. The add (Dropout (0.25))
Model. The add (Dense (128, activation='relu'))
Model. The add (Dropout (0.25))
Model. The add (Dense (1, the activation='sigmoid'))

Model.com from running (loss='binary_crossentropy',
The optimizer='rmsprop',
The metrics=[' accuracy '])

The model fit (x_train y_train, shuffle=True,
Epochs=5,
Batch_size=20)
Score=model. The evaluate (x_test y_test, batch_size=20)

Y_predict=model. Predict_classes (x_test batch_size=5)
Print (y_predict)

The results are as follows:
[[0]
[0]
[0]
[0]
[0]
[0]
[0]
.
Tried model. Predict_proba, as a result, or the whole of 0
Have a great god know where the problem is, how to modify

CodePudding user response:

Data set is unbalanced, 0 and 1 more rarely

CodePudding user response:

Today, I met a "problem" with you, predicted results may be a lot of middle of 0, there is a 1, the output of direct one_hot format is a certain number, rather than the probability of each possibility

CodePudding user response:

I output is 0 in addition to 0 or 0 if there is any data inside I didn't know who know reply thanks

CodePudding user response:

Because you have only one data list, it returns the tag, the first data labels are 0, you look at your list isn't only you a data

CodePudding user response:

Could you tell me the landlord to solve this problem? I also encountered similar problems, my class is' yes' and 'no', the output are all 'no',

CodePudding user response:

How to solve?

CodePudding user response:

The
refer to 12 floor bi_bu_bi_bu reply:
, please the landlord to solve this problem? I also encountered similar problems, my category is' yes' and 'no', the output are all 'no',

May I have your address?
  • Related