Skip to content Skip to sidebar Skip to footer

Balanced Error Rate As Metric Function

I am trying to solve a binary classification problem with the sequential model from Keras and have to meet a given Balanced Error Rate (BER) So I thought it would be a good idea to

Solution 1:

A way to get the array dimensions / an explanation why shape acts like it does / the reason why y_true seems to have 0 dimensions

The deal with print and abstraction libraries like Theano is that you usually do not get the values but a represenation of the value. So if you do

print(foo.shape)

You won't get the actual shape but a representation of the operation that is done at runtime. Since this is all computed on an external device the computation is not run immediately but only after creating a function with appropriate inputs (or calling foo.shape.eval()).

Another way to print the value is to use theano.printing.Print when using the value, e.g.:

shape = theano.printing.Print('shape of foo')(foo.shape)
# use shape (not foo.shape!)

A method to create a tensor matrix with a given with/height by repeating a given row/column vector.

See theano.tensor.repeat for that. Example in numpy (usage is quite similar):

>>> x
array([[1, 2, 3]])
>>> x.repeat(3, axis=0)
array([[1, 2, 3],
       [1, 2, 3],
       [1, 2, 3]])

Post a Comment for "Balanced Error Rate As Metric Function"