Time series anomaly detection and forecasting
Project description
SAM
SAM (Smart Asset Management) is a Python package for timeseries analysis, anomaly detection and forecasting.
The documentation is available on ReadTheDocs.
Author: Royal HaskoningDHV
Email: ruben.peters@rhdhv.com
Getting started
Installation
The easiest way to install is package is using pip:
pip install sam
There are different optional dependencies for SAM, if you are unsure use pip install 'sam[all]'
other options include plotting
(just use the plotting functionality), data_science
(all dependencies needed for a data scientist) and data_engineering
(dependencies for data engineer).
Keep in mind that the sam package is updated frequently, and after a while, your local version may be out of date with the online documentation. To be sure, run the pip install -U sam
command to install the latest version.
Simple example
Below you can find a simple example on how to use one of our timeseries models. For more examples, check our example notebooks
from sam.datasets import load_rainbow_beach
from sam.models import MLPTimeseriesRegressor
from sam.feature_engineering import SimpleFeatureEngineer
data = load_rainbow_beach()
X, y = data, data["water_temperature"]
# Easily create rolling and time features to be used by the model
simple_features = SimpleFeatureEngineer(
rolling_features=[
("wave_height", "mean", 24),
("wave_height", "mean", 12),
],
time_features=[
("hour_of_day", "cyclical"),
],
keep_original=False,
)
# Define your model, see the docs for all parameters
model = MLPTimeseriesRegressor(
predict_ahead=(1, 2, 3), # Multiple predict aheads are possible
quantiles=(0.025, 0.975), # Predict quantile bounds for anomaly detection
feature_engineer=simple_features,
epochs=20,
)
model.fit(X, y)
Configuration
A configuration file can be created as .config
and should be located in your working directory. This configuration file only stores api credentials for now, but more options may be added in the future. The configuration file is parsed using the Python3 configparser, and an example configuration is shown below:
[regenradar]
url=https://rhdhv.lizard.net/api/v3/raster-aggregates/?
user=user.name
password=secret
[openweathermap]
apikey=secret
Issue tracking and Feature Requests
Anyone can create feature requests or bug reports! You can browse and create new issues on GitHub: https://github.com/RoyalHaskoningDHV/sam/issues
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sam-3.1.2.tar.gz
.
File metadata
- Download URL: sam-3.1.2.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 452a3e30e887a096dbab7f34eb097bd1df55a59eb1aa427ccf4859b65386023b |
|
MD5 | bfba433c5b29a9e6365a8a2c364fde89 |
|
BLAKE2b-256 | 4da2a283af8b68ce02059821aa2f854c3b3d89c690863408ec207f258fc62b13 |
File details
Details for the file sam-3.1.2-py3-none-any.whl
.
File metadata
- Download URL: sam-3.1.2-py3-none-any.whl
- Upload date:
- Size: 141.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fd6be988c8aa1508ed99eeea5a6b3aabae13de790c16e4f980b5ee18314eb6b |
|
MD5 | cecd8059645e1dbab82a095fa48a24ad |
|
BLAKE2b-256 | 7c5a60e364c9f568cb77d93e549d08b74b721afd7f0f8c9e180dd365dc54e997 |