WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@swastik-21
Copy link

Hi,
I’ve added a simple anomaly detection script under ai_modules/anomaly_detection.py. Right now it uses a z-score approach to flag unusual values in water usage data. The threshold can be adjusted so it works with different datasets.
I also created a requirements.txt so dependencies can be installed more easily.
Tested locally with sample data, and it correctly flagged extreme outliers. This is an initial version, so open to feedback or suggestions on improvements.
Thanks

@swastik-21
Copy link
Author

@microsoft-github-policy-service agree

Copy link

@QuantumAlchemist03 QuantumAlchemist03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few suggestions for improvements. Overall looks good!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The anomaly detection function is clear and well-documented. A few suggestions:

  1. Consider adding a check for std == 0 to avoid division by zero errors.
  2. In the example usage, it might help to explain why z_thresh=2.0 is chosen (e.g., more sensitive to outliers).
  3. Optionally, you could mention that this method assumes a roughly normal distribution for data.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requirements.txt is clear and version-pinned, which is great for reproducibility. A few suggestions:

  1. Double-check if numpy==2.3.2 and pandas==2.3.2 are compatible; sometimes older versions of one library may conflict with the other.
  2. Consider whether all dependencies (like six or tzdata) are actually used in the project — removing unused packages can simplify the environment.
  3. Optionally, you could mention Python version compatibility, e.g., if this works for Python 3.11 or higher.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants