Ank
Ank

Reputation: 1904

CNTK absolute error

To find the loss during training a model we can use cntk.squared_error() function, like this:

loss = cntk.squared_error(z, l)

But I am interested in finding the loss in terms of absolute error. The below code doesn't work:

loss = cntk.absolute_error(z, l)

It gives error as:

AttributeError: module 'cntk' has no attribute 'absolute_error'

Is there any inbuilt function in CNTK toolkit to find the absolute error? I am new to deep learning so I don't know much. Thanks for help!

Upvotes: 5

Views: 819

Answers (1)

Maxim
Maxim

Reputation: 53758

There's no out-of-the-box L1 loss function in CNTK, but you can provide a custom one:

def absolute_error(z, l):
  return cntk.reduce_mean(cntk.abs(z - l))

Upvotes: 4

Related Questions