Skip to content

WenYanger/Keras_Metrics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Keras_Metrics

Some Metric Implementation in Keras (Such as Pearsons Correlation Coefficient, MRE)

Now Including:

  • Pearsons Correlation Coefficient
  • Mean Relative Error
  • Jaccard Loss (Derivable, can be used as LOSS for training in Keras)
  • Jaccard Index
  • Dice Similarity Coefficient (aka. DSC)

How to use

Just an example ~

inp = Input(shape=(timesteps, 1))
gru = Bidirectional(GRU(500, return_sequences=True))(inp)

max1 = GlobalMaxPool1D()(gru_1)
att1 = Attention()(gru_1)
cont1 = keras.layers.concatenate([max1, att1])

out = Dense(1, activation='relu')(cont1)

opt = keras.optimizers.Adam(lr=0.002, beta_1=0.9, beta_2=0.9, epsilon=1e-08, amsgrad=True)

model = Model(inputs=inp, outputs=out)
model.compile(loss='mse',
              optimizer=opt,
              metrics=['mse', pearson_r, mre])

Related Formula

  • Pearsons Correlation Coefficient

这里写图片描述

  • Jaccard Loss

这里写图片描述

  • Dice Similarity Coefficient

这里写图片描述

  • Mean Relative Error

See here

Sayin C, Ertunc H M, Hosoz M, et al. Performance and exhaust emissions of a gasoline engine using artificial neural network[J]. Applied Thermal Engineering, 2007, 27(1):46-54.

About

Some Metric Implementation in Keras (Such as Pearsons Correlation Coefficient, Mean Relative Error)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages