0
$\begingroup$

I want to reproduce the results in "Online Neural Networks for Change-Point Detection" Hushchyn et al., but I'm having trouble implementing their loss function with Keras. The algorithm works on sequential data and computes the cross entropy between two segments of a time series separated by $l$ time steps, $X(t)$ and $X(t-l)$, according to eq. 10 in their paper:

$L(X(t-l), X(t)) = -\log(1-f(X(t-l),\theta)) - \log(f(X(t), \theta))$

where $f(X, \theta)$ is the neural network we want to train and $\theta$ are its parameters. I don't know how to implement this loss function in Keras, as the loss functions I'm used to working with compute the loss separately on each instance in the same way (i.e. MSE). Any suggestions?

$\endgroup$
2
  • $\begingroup$ Please read the Probabilistic Losses of the Keras documentation. They have already implemented the loss function you've mentioned. $\endgroup$ May 30, 2023 at 13:14
  • $\begingroup$ @AmirhosseinRezaei Thank you! I knew about the keras implementation of the cross entropy loss function but it wasn't clear to me how to use it in my specific problem, so I thought i needed a custom version of it. I think I've figured it out now. $\endgroup$ May 30, 2023 at 14:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.