LDR project with Twilio and ML

Although my output was as mentioned in the training section, I am not receiving messages from twilio. I got only one message when I flashed my mobile flashlight on it, but after that I have tried multiple ways of suddenly increasing the intensity of light and still am not receiving an alert. the readings have been accordance but only alert message received after multiple tries.

@arkaian.aig

I believe your query is regarding anomaly detection.

The bound range changes everytime your program is looped, so once your value is outside that bound range, it triggers the alert function. After this anomaly value, the bound range changes drastically as well.

To monitor the bound range and configure accordingly, add the below line (this is bound 0 and this is bound 1) -

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
# ---------------   Below line  ----------------------
print(".") // same line as if condition(above) and try condition (below)
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] :

@arkaian.aig

You can see in this thread, a screenshot of having multiple alerts (everytime detecting anomaly) on running the program once.