Git Product home page Git Product logo

btap_ml's Introduction

BTAP Surrogate Model

Advances in clean technologies and building practices can make new buildings “net-zero energy”, meaning they require so little energy they could potentially rely on their own renewable energy supplies for all of their energy needs.

Through research and development, technology costs continue to fall, and government and industry efforts and investments will accelerate that trend. These advances, supported by a model “net-zero energy ready” building code, will enable all builders to adopt these practices and lower lifecycle costs for homeowners.’

The goal is to develop surrogate models that generate data to inform in the design of near-net-zero energy buildings in Canada.

About this Repo

This repo contains the python Notebooks and codes for the entire surrogate modelling for a full service restaurant.

Requirements

  • Python 3
  • Access to Minio
  • Docker installed and running on your computer
  • A git client
  • Install the requirement packages
    pip3 install -r requirements.txt
    

How to run this app

We suggest you create a virtual environment for running the surrogate model with Python and Clone this repository.

cd c:\users\bukola
git clone https://github.com/canmet-energy/btap_ml.git
cd btap_ml

Structure

  • Block Storage Guide.ipynb: sample notebook of how to access minio using s3f3.
  • tensorboard.ipynb: use this notebook to start the tensorboard dashboard for metrics visualization and scrutinization of the surrogate model.
  • src: Contain all source code used in building the surrogate model.
    • preprocessing.py: downloads all the dataset from minio, preprocess the data, split the data into train, test and validation set.
    • feature_selection.py: use the output from preprocoessing to extract the features that would be used in building the surrogate model
    • predict.py: builds the surrogate model using the preprocessed data and the selected features described above
    • plot.py: contains functions used to create plots.

how to use

Option 1: Run the surrogate model without using the kubeflow pipeline.

cd src
  • step 1) Preprocessing

    • You need to type the command below into a terminal
    • Notes: check to ensure the file paths specified for the arguements below exist in minio
      • in_build_params: the simulation I/O output file used in buiding and testing the model.
      • in_hour: the hourly energy file associated with the in_build_params file.
      • in_build_params_val: the simulation I/O output file used in validating the model.
      • in_hour_val: the hourly energy file associated with the in_build_params_val file.
      • in_weather: the epw file converted to csv.
    python3 preprocessing.py --tenant standard --bucket nrcan-btap --in_build_params input_data/output_2021-10-04.xlsx --in_hour input_data/total_hourly_res_2021-10-04.csv --in_weather input_data/montreal_epw.csv --output_path output_data/preprocessing_out --in_build_params_val input_data/output.xlsx --in_hour_val input_data/total_hourly_res.csv
    
  • step 2) Feature Selection

    • Run the command below from a terminal
    python3 feature_selection.py --tenant standard --bucket nrcan-btap --in_obj_name output_data/preprocessing_out --output_path output_data/feature_out --estimator_type elasticnet
    
  • step 3) Building the Surrogate Model: Option A: No hyperparameter search.

    • The surrogate model can be built usind default parameters by setting the value of --param_search as no
    python3 feature_selection.py --tenant standard --bucket nrcan-btap --in_obj_name output_data/preprocessing_out --output_path output_data/feature_out --estimator_type elasticnet```python3 predict.py --tenant standard --bucket nrcan-btap --param_search no --in_obj_name output_data/preprocessing_out --features output_data/feature_out --output_path output_data/predict_out 
    

    Option B: With hyperparameter search.

    • The surrogate model can be built usind default parameters by setting the value of --param_search as yes
    python3 feature_selection.py --tenant standard --bucket nrcan-btap --in_obj_name output_data/preprocessing_out --output_path output_data/feature_out --estimator_type elasticnet```python3 predict.py --tenant standard --bucket nrcan-btap --param_search yes --in_obj_name output_data/preprocessing_out --features output_data/feature_out --output_path output_data/predict_out 
    
  • step 4) tensorboard (optional):

Option 2: Running the surrogate model as a kubeflow pipeline.

  • step 1) Build Image [THE COMMAND BELOW NEEDS TO BE RECHECKED AND UPDATED]

    cd pipeline
    docker build -t btap_ml  --build-arg GIT_API_TOKEN=$env:GIT_API_TOKEN .
    
  • step 2) Run the pipeline

    • Check the arguements in the run.py file are correct
      • in_build_params: the simulation I/O output file used in buiding and testing the model.
      • in_hour: the hourly energy file associated with the in_build_params file.
      • in_build_params_val: the simulation I/O output file used in validating the model.
      • in_hour_val: the hourly energy file associated with the in_build_params_val file.
      • in_weather: the epw file converted to csv.
    python3 run.py
    

Copyright 2021, Data Science Division - Statistics Canada | Developer: Bukola Ishola

btap_ml's People

Contributors

ckirney avatar goatsweater avatar maybuksho avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.