0
$\begingroup$

I am using machine learnig to measure probability for the outcome of tennis matches. If the winer is 1 that means that p1 won otherwise p2 won. in Columns LG, SVC, RF and NN there are probaiblities from the models. I am wondering why the NN probability is almost always really different. Should I substract the NN value from 100 and if yes, why?

#LOGISTIC REGRESSION
clf_A = LogisticRegression(penalty='none', random_state=420, solver='sag')
m1 = RFECV(clf_A,scoring='accuracy')
m1.fit(X_train,y_train)
df_test['accuracy'][0] = round(m1.score(X_test,y_test)*100,2)
df_output['LG'] = m1.predict_proba(X_test)
df_output['LG'] = round(df_output['LG']*100,2)

#SVC
clf_B.fit(X_train,y_train)
df_test['accuracy'][1] = round(clf_B.score(X_test,y_test)*100,2)
df_output['SVC'] = clf_B.predict_proba(X_test)
df_output['SVC'] = round(df_output['SVC']*100,2)

#RANDOM FOREST
clf_C = RandomForestClassifier(criterion='gini',min_samples_leaf=3,min_samples_split=20)
m3 = RFECV(clf_C,scoring='accuracy')
m3.fit(X_train,y_train)
df_test['accuracy'][2] = round(m3.score(X_test,y_test)*100,2)
df_output['RF'] = m3.predict_proba(X_test)
df_output['RF'] = round(df_output['RF']*100,2)

#NEURAL NETWORK
network = models.Sequential()
network.add(layers.Dense(units=64, activation='relu', input_shape=(len(X_train.columns),)))
network.add(layers.Dense(units=32, activation='relu'))
network.add(layers.Dense(units=1, activation='sigmoid'))

network.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) 

es = EarlyStopping(monitor='val_loss', mode='min', verbose=0, patience=500)
mc = ModelCheckpoint('/content/best_model.h5', monitor='val_loss', mode='min', verbose=0, save_best_only=True)

history = network.fit(X_train, y_train, 
                epochs=1000, verbose=0, batch_size=512, 
                validation_data=(X_test, y_test), callbacks=[es, mc]) 

saved_model = load_model('/content/best_model.h5')
df_output['NN'] = saved_model.predict(X_test)
df_output['NN'] = round(df_output['NN']*100,2)

enter image description here

$\endgroup$
2
  • $\begingroup$ How exactly have you encoded your 2 classes? It seems that the NN output may be the probability of the other class... $\endgroup$ – desertnaut Nov 16 '20 at 23:52
  • $\begingroup$ well I dicided thta i p1 won it is 1 if lost it is 0 $\endgroup$ – Pleban Nov 17 '20 at 18:09

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.