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.


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:
        print("Not enough data to compute Z-score. Need ",required_data_count," more data points")
# ---------------   Below line  ----------------------
print(".") // same line as if condition(above) and try condition (below)
print("This is bound 0 = " + str(bound[0]))
print("This is bound 1 = " + str(bound[1]))
# ---------------------------------------------------- 
     if sensor_value > bound[0] :


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