# What loss function is appropriate for finding “points of interest” in a array of x,y inputs

I am looking into whether a neural network is appropriate to detect "points of interest" (POI) in a set of tuples (say length, and some sensor value). A POI is essentially a quick change in the value which doesn't follow the pattern. So if we have a linear increase in the sensor value and then it suddenly jumps by 200% that would be a POI.

Here is an example of the data I am working with:

[(1,10),(2,11),(3,14),(5,24),(6.5,25), (7,26), (8,45)]


In this example lets say "(3,14)", "(5,24)", and "(8,45)" are points of interest. So I am trying to design a neural network which will detect these.

I have started by creating a Convolution 1D layer with a static input length of 500 elements.

After a couple hidden layers I apply a sigmoid function which provides a list of 0s and 1s as output where 1s signify a POI in the set.

There are a couple of issues with this approach which I am trying to solve.

In a categorical loss function an output of [1,0,0,1,0,0] for example would be seen as completely inaccurate if the expected output is [0,1,0,0,1,0] whereas in reality that is fairly accurate since the predicted POIs are very close to the real POIs.

So what I am trying to do is find a loss function to optimize the neural network.

So far I have tried:

• Binary Cross Entropy: I read this is good for classifying where inputs can belong to multiple classes. I tried this out thinking each POI is essentially a "category". But this seems to not work and I assume it's because of what I noted above.
• Mean Absolute Error: This seems to have gotten slightly better results but after closer inspection it didn't seem very accurate and would mostly uniformly predict POIs on a set.

I have tried a few others without much luck.

What loss function would be more appropriate for this?

One other output I tried was instead of outputting 0s and 1s it should just return the indexes of the points of interest so say 3, 5 8. Would this be a better output?

You don't have to use machine learning to solve the problem.

1. Unify the scale of each data input (or each curve), such as normalize to $$[0,1]$$ (not necessary).

2. Calculate the slope of each pair of points $$\frac{(y2 - y1)}{(x2 - x1)}$$.

3. Set the threshold. Compare the difference between two adjacent slopes, the difference exceeds the threshold are marked as POI.

Isn't that simpler?

If you must solve the problem with CNN, what I can think of is that you first collect (or draw) a bunch of curves, mark the POI in advance, and then feed it to the CNN model.

• Well, the neural network is being fed data which is being generated by a similar method to the above in order to train it. The issue we have with this is that the user may eventually mark a POI as "After 10 continuous points with the same value" or some other arbitrary POI so we don't want to have to re-code everything but instead just be able to feed new labelled data in. – KNejad Aug 7 '19 at 15:43