How to choose the values of frame size and multiplication factors. Is there any relation between the two values. When I chose frame size = 20 and mul_factor = 4 . Anomaly was detected even when there was no change in value. Please help me in understanding the roles of frame_size and mul_factor so that i can set these two values to get proper z-score and thus an efficient anomaly detection model.

You clearly skipped the session and directly moved, to do the project.

The video clearly said what was the framesize and multiplication factor. Please follow the course instead of skipping it.

Link - https://trainings.boltiot.com/courses/429176/lectures/6846892

If in case you have any doubt after that, you can be particular on what you cannot understand.

I have watched the video twice but the problem is that my code shows anomaly even when the change is 1 or 2 unit and sometimes it does not show any anomaly for a bigger change

Therefore I tried different values but no improvement

What were the values that you provided initially? The range of it?

the values were between 900 and 1000

frame size - 20

mul factor - 4

Send a snap of your code.

If you decrease your mul factor, you are decreasing the threshold and making them closer to the mean of your value. That’s why you received the trigger.

But it’s not reading 22 as a trigger.

Will have to look at your code.

Keep the frame size as 10 and mul between 5 and 10. Its not the average of your previous data that it is depended on. It takes the distance and increases accordingly.

So, if your previous values were going like 5,7,9,11,13… Then your next value determined by the computation has to be 15, 17, 19, 21,… Somewhere near these values using the mulfactor.

But if you bring it down to 11 or 13, there is a chance it will trigger.

Look at this sample -

Pay attention to the values given and later, the values which it worked upon for anomaly.

That means increasing the frame_size will not improve the model.

right?

And should the data be linearly increasing or decreasing always?

That is upto your previous data.

If the graph previous was linearly increasing, your future data has to be on the same line of input.

If the graph was same for every time, then it has to be on the same line.

Same goes for linearly decreasing. At a point, you values has to be 0.

This is a trial project for showing how anamoly works. In real life inputs, data points are taken repeatedly over time to updata the data set. And the values are always random. So, there is never a question about the data going linearly upward or downward.

If someday, data really goes linearly upward or downward, then think practically. We could be in a bad position if the temperature was increasing for 50 data points every hour. Then the temperature after 50 hours would start burning us practically.

So, in practical essence, the delay to read the data points over time has to be a lot. Probably, read the temperature for datapoint every hour, but display it every 10 secs.

Make the frame size and mul factor 10 and 6 by default to check if your program is working fine.

If it doesn’t, I will tag somebody to help you with it.

It is not doing any good

It worked perfectly fine for me. The original code from the training.

Previously, I thought the programming didn’t make the 2nd round on checking if the values were meeting conditions to trigger. But mine did it twice!

Try this method of printing the bounds to check if your conditions have error in it.

Add the below line -

```
if not bound:
required_data_count=FRAME_SIZE-len(history_data)
print("Not enough data to compute Z-score. Need ",required_data_count," more data points")
history_data.append(int(data['value']))
time.sleep(2)
continue
** print(".")
** print(".")
** print("This is bound 0 = " + str(bound[0]))
** print(".")
** print("This is bound 1 = " + str(bound[1]))
** print(".")
** print(".")
try:
if sensor_value > bound[0] :
```

Make sure it is in the same line as the try block

hey! I am getting this error again and again in project 14. so if you can help me out it would mean so much.

Please create a new topic and share your error screenshot in there.