Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

DAI An open source project from Data to AI Lab at MIT.

GreenGuard

AutoML for Renewable Energy Industries.

PyPI Shield Travis CI Shield Downloads Binder

GreenGuard

Overview

The GreenGuard project is a collection of end-to-end solutions for machine learning problems commonly found in monitoring wind energy production systems. Most tasks utilize sensor data emanating from monitoring systems. We utilize the foundational innovations developed for automation of machine Learning at Data to AI Lab at MIT.

The salient aspects of this customized project are:

  • A set of ready to use, well tested pipelines for different machine learning tasks. These are vetted through testing across multiple publicly available datasets for the same task.
  • An easy interface to specify the task, pipeline, and generate results and summarize them.
  • A production ready, deployable pipeline.
  • An easy interface to tune pipelines using Bayesian Tuning and Bandits library.
  • A community oriented infrastructure to incorporate new pipelines.
  • A robust continuous integration and testing infrastructure.
  • A learning database recording all past outcomes --> tasks, pipelines, outcomes.

Resources

Install

Requirements

GreenGuard has been developed and runs on Python 3.6, 3.7 and 3.8.

Also, although it is not strictly required, the usage of a virtualenv is highly recommended in order to avoid interfering with other software installed in the system where you are trying to run GreenGuard.

Download and Install

GreenGuard can be installed locally using pip with the following command:

pip install greenguard

This will pull and install the latest stable release from PyPi.

If you want to install from source or contribute to the project please read the Contributing Guide.

Docker usage

GreenGuard is prepared to be run inside a docker environment. Please check the docker documentation for details about how to run GreenGuard using docker.

Data Format

The minimum input expected by the GreenGuard system consists of the following two elements, which need to be passed as pandas.DataFrame objects:

Target Times

A table containing the specification of the problem that we are solving, which has three columns:

  • turbine_id: Unique identifier of the turbine which this label corresponds to.
  • cutoff_time: Time associated with this target
  • target: The value that we want to predict. This can either be a numerical value or a categorical label. This column can also be skipped when preparing data that will be used only to make predictions and not to fit any pipeline.
turbine_id cutoff_time target
0 T1 2001-01-02 00:00:00 0
1 T1 2001-01-03 00:00:00 1
2 T2 2001-01-04 00:00:00 0

Readings

A table containing the signal data from the different sensors, with the following columns:

  • turbine_id: Unique identifier of the turbine which this reading comes from.
  • signal_id: Unique identifier of the signal which this reading comes from.
  • timestamp (datetime): Time where the reading took place, as a datetime.
  • value (float): Numeric value of this reading.
turbine_id signal_id timestamp value
0 T1 S1 2001-01-01 00:00:00 1
1 T1 S1 2001-01-01 12:00:00 2
2 T1 S1 2001-01-02 00:00:00 3
3 T1 S1 2001-01-02 12:00:00 4
4 T1 S1 2001-01-03 00:00:00 5
5 T1 S1 2001-01-03 12:00:00 6
6 T1 S2 2001-01-01 00:00:00 7
7 T1 S2 2001-01-01 12:00:00 8
8 T1 S2 2001-01-02 00:00:00 9
9 T1 S2 2001-01-02 12:00:00 10
10 T1 S2 2001-01-03 00:00:00 11
11 T1 S2 2001-01-03 12:00:00 12

Turbines

Optionally, a third table can be added containing metadata about the turbines. The only requirement for this table is to have a turbine_id field, and it can have an arbitraty number of additional fields.

turbine_id manufacturer ... ... ...
0 T1 Siemens ... ... ...
1 T2 Siemens ... ... ...

CSV Format

A part from the in-memory data format explained above, which is limited by the memory allocation capabilities of the system where it is run, GreenGuard is also prepared to load and work with data stored as a collection of CSV files, drastically increasing the amount of data which it can work with. Further details about this format can be found in the project documentation site.

Quickstart

In this example we will load some demo data and classify it using a GreenGuard Pipeline.

1. Load and split the demo data

The first step is to load the demo data.

For this, we will import and call the greenguard.demo.load_demo function without any arguments:

from greenguard.demo import load_demo

target_times, readings = load_demo()

The returned objects are:

  • target_times: A pandas.DataFrame with the target_times table data:

      turbine_id cutoff_time  target
    0       T001  2013-01-12       0
    1       T001  2013-01-13       0
    2       T001  2013-01-14       0
    3       T001  2013-01-15       1
    4       T001  2013-01-16       0
    
  • readings: A pandas.DataFrame containing the time series data in the format explained above.

      turbine_id signal_id  timestamp  value
    0       T001       S01 2013-01-10  323.0
    1       T001       S02 2013-01-10  320.0
    2       T001       S03 2013-01-10  284.0
    3       T001       S04 2013-01-10  348.0
    4       T001       S05 2013-01-10  273.0
    

Once we have loaded the target_times and before proceeding to training any Machine Learning Pipeline, we will have split them in 2 partitions for training and testing.

In this case, we will split them using the train_test_split function from scikit-learn, but it can be done with any other suitable tool.

from sklearn.model_selection import train_test_split

train, test = train_test_split(target_times, test_size=0.25, random_state=0)

Notice how we are only splitting the target_times data and not the readings. This is because the pipelines will later on take care of selecting the parts of the readings table needed for the training based on the information found inside the train and test inputs.

Additionally, if we want to calculate a goodness-of-fit score later on, we can separate the testing target values from the test table by popping them from it:

test_targets = test.pop('target')

2. Exploring the available Pipelines

Once we have the data ready, we need to find a suitable pipeline.

The list of available GreenGuard Pipelines can be obtained using the greenguard.get_pipelines function.

from greenguard import get_pipelines

pipelines = get_pipelines()

The returned pipeline variable will be list containing the names of all the pipelines available in the GreenGuard system:

['unstack_double_lstm_timeseries_classifier',
 'unstack_lstm_timeseries_classifier',
 'unstack_normalize_dfs_xgb_classifier',
 'unstack_dfs_xgb_classifier',
 'normalize_dfs_xgb_classifier']

For the rest of this tutorial, we will select and use the pipeline normalize_dfs_xgb_classifier as our template.

pipeline_name = 'normalize_dfs_xgb_classifier'

3. Fitting the Pipeline

Once we have loaded the data and selected the pipeline that we will use, we have to fit it.

For this, we will create an instance of a GreenGuardPipeline object passing the name of the pipeline that we want to use:

from greenguard.pipeline import GreenGuardPipeline

pipeline = GreenGuardPipeline(pipeline_name)

And then we can directly fit it to our data by calling its fit method and passing in the training target_times and the complete readings table:

pipeline.fit(train, readings)

4. Make predictions

After fitting the pipeline, we are ready to make predictions on new data by calling the pipeline.predict method passing the testing target_times and, again, the complete readings table.

predictions = pipeline.predict(test, readings)

5. Evaluate the goodness-of-fit

Finally, after making predictions we can evaluate how good the prediction was using any suitable metric.

from sklearn.metrics import f1_score

f1_score(test_targets, predictions)

What's next?

For more details about GreenGuard and all its possibilities and features, please check the project documentation site Also do not forget to have a look at the tutorials!

History

0.2.6 - 2020-10-23

  • Fix mkdir when exporting to csv file the benchmark results.
  • Intermediate steps for the pipelines with demo notebooks for each pipeline.

Resolved Issues

  • Issue #50: Expose partial outputs and executions in the GreenGuardPipeline.

0.2.5 - 2020-10-09

With this release we include:

  • run_benchmark: A function within the module benchmark that allows the user to evaluate templates against problems with different window size and resample rules.
  • summarize_results: A function that given a csv file generates a xlsx file with a summary tab and a deatailed tab with the results from run_benchmark.

0.2.4 - 2020-09-25

  • Fix dependency errors

0.2.3 - 2020-08-10

  • Added benchmarking module.

0.2.2 - 2020-07-10

Internal Imrpovements

  • Added github actions.

Resolved Issues

  • Issue #27: Cache Splits pre-processed data on disk

0.2.1 - 2020-06-16

With this release we give the possibility to the user to specify more than one template when creating a GreenGuardPipeline. When the tune method of this is called, an instance of BTBSession is returned and it is in charge of selecting the templates and tuning their hyperparameters until achieving the best pipeline.

Internal Improvements

  • Resample by filename inside the CSVLoader to avoid oversampling of data that will not be used.
  • Select targets now allows them to be equal.
  • Fixed the csv filename format.
  • Upgraded to BTB.

Bug Fixes

  • Issue #33: Wrong default datetime format

Resolved Issues

  • Issue #35: Select targets is too strict
  • Issue #36: resample by filename inside csvloader
  • Issue #39: Upgrade BTB
  • Issue #41: Fix CSV filename format

0.2.0 - 2020-02-14

First stable release:

  • efficient data loading and preprocessing
  • initial collection of dfs and lstm based pipelines
  • optimized pipeline tuning
  • documentation and tutorials

0.1.0

  • First release on PyPI

Metadata

Release files for greenguard 0.2.7.dev1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for greenguard 0.2.7.dev1
File Size Uploaded Provenance Actions
greenguard-0.2.7.dev1.tar.gz 914.2 kB Without provenance Details for greenguard-0.2.7.dev1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for greenguard 0.2.7.dev1
File Interpreter ABI Platform Actions
greenguard-0.2.7.dev1-py2.py3-none-any.whl Python 2, Python 3 none any Details for greenguard-0.2.7.dev1-py2.py3-none-any.whl

Total release size: 957.5 kB

Release files / greenguard-0.2.7.dev1.tar.gz

Download URL greenguard-0.2.7.dev1.tar.gz
Size 914.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b5397ef84446eeddb0608da613e22c89e881454737179c8e488ff7a2e2195a3f
BLAKE2b-256 checksum
How to use checksums
f102ef2871dca3354450c57cf4bb2f323a16d4c3479b1f26a61e0f4eee4291b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

Release files / greenguard-0.2.7.dev1-py2.py3-none-any.whl

Download URL greenguard-0.2.7.dev1-py2.py3-none-any.whl
Size 43.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
3414d8cfe79a4b6e764250ca639030d24a6f8c033c9fcd39738697fdfa8025a0
BLAKE2b-256 checksum
How to use checksums
c6362be4a28de3dea6fa49702060670e94b0a7d7cd9b43bac2a25b165cf908c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

Security for greenguard 0.2.7.dev1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page