Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add uvad,test and update setup.py #7

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .script/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM mcr.microsoft.com/mirror/docker/library/ubuntu:18.04

LABEL maintainer="MingTao Wang<[email protected]>"
v-shuawei marked this conversation as resolved.
Show resolved Hide resolved

ARG DEBIAN_FRONTEND=noninteractive

ADD requirements.txt .

RUN apt-get update -qq && \
apt-get upgrade -y && \
apt-get install -y python3 python3-pip r-base r-base-dev
RUN pip3 install setuptools --upgrade
RUN pip3 install -r requirements.txt
RUN apt-get clean

RUN python3 setup.py build_ext --inplace
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
recursive-include anomaly-detector/anomaly_detector/univariate *.pyx
recursive-include anomaly-detector/anomaly_detector/univariate *.c
recursive-include anomaly-detector/anomaly_detector/univariate *.h
recursive-include anomaly-detector/anomaly_detector/univariate *.py
include setup.py
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
# Environment
python = 3.11

R >= 4.0

# Getting Started

<!-- ## Clone the Repository -->

```bash
git clone https://github.com/microsoft/anomaly-detector.git
cd anomaly-detector
```

<!-- ## Install -->


```bash
pip install -r requirements.txt
python setup.py build_ext --inplace
```
## Using Docker (Optional)

```bash
docker build -t your_image_name -f .script/Dockerfile .
```


# Test

```bash
cd anomaly-detector
python tests/uvad_test.py
```

# Project

> This repo has been populated by an initial template to help get you started. Please
Expand Down
1 change: 1 addition & 0 deletions anomaly-detector/anomaly_detector/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from .multivariate.model import MultivariateAnomalyDetector
from .univariate.univariate_anomaly_detection import UnivariateAnomalyDetector
11 changes: 11 additions & 0 deletions anomaly-detector/anomaly_detector/common/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ def __repr__(self):
def to_dict(self):
return {"code": self.code, "message": self.message}

class AnomalyDetectionRequestError(Exception):
"""Raised when an error occurs in the request."""
def __init__(self, error_msg, error_code=None):
if isinstance(error_msg, type(b'')):
error_msg = error_msg.decode('UTF-8', 'replace')

super(AnomalyDetectionRequestError, self).__init__(
error_msg
)
self.message = error_msg
self.code = error_code

class DataFormatError(AnomalyDetectorException):
pass
Expand Down
5 changes: 5 additions & 0 deletions anomaly-detector/anomaly_detector/univariate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .util import fit_trend
from .util import get_period_pattern
from .model.detect_model import AnomalyDetectionModel
from .resource.error_message import InvalidJsonFormat, CustomSupportRequired
from .period import period_detection
Loading