Answers.Body: <p>You don't have to use machine learning to solve the problem.</p>
  
  <ol>
  <li><p>Unify the scale of each data input (or each curve), such as normalize to <span class="math-container">$[0,1]$</span> (not necessary).</p></li>
  <li><p>Calculate the slope of each pair of points <span class="math-container">$\frac{(y2 - y1)}{(x2 - x1)}$</span>.</p></li>
  <li><p>Set the threshold. Compare the difference between two adjacent slopes, the difference exceeds the threshold are marked as POI.</p></li>
  </ol>
  
  <p>Isn't that simpler?</p>
  
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-07T15:43:48.063Z
Answers.Text: 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.
Answers.UserDisplayName: KNejad
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-03T02:26:25.543Z
Answers.LastActivityDate: 2019-08-03T10:51:31.333Z
Answers.LastEditDate: 2019-08-03T10:51:31.333Z
Answers.UserDisplayName: Louis Lv
Body: <p>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.</p>
  
  <p>Here is an example of the data I am working with:</p>
  
  <pre><code>[(1,10),(2,11),(3,14),(5,24),(6.5,25), (7,26), (8,45)]
  </code></pre>
  
  <p>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.</p>
  
  <p>I have started by creating a Convolution 1D layer with a static input length of 500 elements. </p>
  
  <p>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.</p>
  
  <p>There are a couple of issues with this approach which I am trying to solve.</p>
  
  <p>In a categorical loss function an output of <code>[1,0,0,1,0,0]</code> for example would be seen as completely inaccurate if the expected output is <code>[0,1,0,0,1,0]</code> whereas in reality that is fairly accurate since the predicted POIs are very close to the real POIs.</p>
  
  <p>So what I am trying to do is find a loss function to optimize the neural network.</p>
  
  <p>So far I have tried:</p>
  
  <ul>
  <li>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.</li>
  <li>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.</li>
  </ul>
  
  <p>I have tried a few others without much luck.</p>
  
  <p>What loss function would be more appropriate for this?</p>
  
  <p>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?</p>
  
Tags: <neural-networks><convolutional-neural-networks><objective-functions>
Title: What loss function is appropriate for finding "points of interest" in a array of x,y inputs
UserDisplayName: KNejad
ThreadText: # What loss function is appropriate for finding "points of interest" in a array of x,y inputs
  
  (Asked by: username_0 on 2019-08-02)
  
  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?
  
  **Tags:** neural-networks, convolutional-neural-networks, objective-functions
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-08-03. Score: 1
  
  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.
  
  > **Comments:**
  > **username_0**: 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.  
  
  ---
  
  