mirror of
https://github.com/Hestia-Homes/ML.git
synced 2026-06-08 11:17:25 +00:00
Compare commits
No commits in common. "master" and "#dev#1" have entirely different histories.
7 changed files with 320 additions and 48 deletions
4
.github/workflows/Deploy.yml
vendored
4
.github/workflows/Deploy.yml
vendored
|
|
@ -19,8 +19,8 @@ jobs:
|
|||
|
||||
- name: Install Serverless and plugins
|
||||
run: |
|
||||
npm install -g serverless@^3.38.0
|
||||
npm install -g serverless-domain-manager@^7.3.8
|
||||
npm install -g serverless
|
||||
npm install -g serverless-domain-manager
|
||||
|
||||
- name: Install DVC
|
||||
run: |
|
||||
|
|
|
|||
238
.github/workflows/MLPipelineTESTING.yml
vendored
Normal file
238
.github/workflows/MLPipelineTESTING.yml
vendored
Normal file
|
|
@ -0,0 +1,238 @@
|
|||
name: Register the model for the given pipeline branch (TESTING)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "sap-dev-gto"
|
||||
|
||||
# on:
|
||||
# pull_request:
|
||||
# types:
|
||||
# - closed
|
||||
# branches:
|
||||
# - "sap-dev"
|
||||
# - "heat-dev"
|
||||
# - "carbon-dev"
|
||||
|
||||
permissions: write-all
|
||||
|
||||
jobs:
|
||||
Register-Major-Model-Dev:
|
||||
# if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'major')) }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install packages to register model
|
||||
run: |
|
||||
pip install --upgrade pip
|
||||
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
||||
|
||||
- name: Register Model
|
||||
run: |
|
||||
# REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}')
|
||||
REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}')
|
||||
|
||||
git config user.name "Github-Bot"
|
||||
git config user.email "Github-Bot@no-reply.com"
|
||||
|
||||
latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@v" '{print $2}') || false
|
||||
if [ -z "${latest_version}" ]; then
|
||||
increment_version="1.0.0"
|
||||
else
|
||||
increment_version=$(echo ${latest_version} | awk 'BEGIN {
|
||||
FS="\\." # Set the field separator to a period
|
||||
OFS="." # Set the output field separator to a period
|
||||
}
|
||||
{
|
||||
major = $1 + 1 # Increment the major version
|
||||
print major, "0", "0" # Print the new version
|
||||
}')
|
||||
fi
|
||||
|
||||
new_tag=${REGISTER_MODEL_NAME}@v${increment_version}
|
||||
|
||||
# git tag -a ${new_tag} -m "Registering new Major Version"
|
||||
# git push origin ${new_tag}
|
||||
|
||||
# gto show --json > MODEL_REGISTRY.md
|
||||
# git add .
|
||||
# git commit -m "Update Registry"
|
||||
# git push
|
||||
|
||||
Register-Minor-Model-Dev:
|
||||
# if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'minor')) }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install packages to register model
|
||||
run: |
|
||||
pip install --upgrade pip
|
||||
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
||||
|
||||
- name: Register Model
|
||||
run: |
|
||||
# REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}')
|
||||
REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}')
|
||||
|
||||
git config user.name "Github-Bot"
|
||||
git config user.email "Github-Bot@no-reply.com"
|
||||
|
||||
latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@v" '{print $2}')
|
||||
if [ -z "${latest_version}" ]; then
|
||||
increment_version="0.1.0"
|
||||
else
|
||||
increment_version=$(echo ${latest_version} | awk 'BEGIN {
|
||||
FS="\\." # Set the field separator to a period
|
||||
OFS="." # Set the output field separator to a period
|
||||
}
|
||||
{
|
||||
minor = $2 + 1 # Increment the minor version
|
||||
print $1, minor, "0" # Print the new version
|
||||
}')
|
||||
fi
|
||||
|
||||
new_tag=${REGISTER_MODEL_NAME}@v${increment_version}
|
||||
|
||||
# git tag -a ${new_tag} -m "Registering new Minor Version"
|
||||
# git push origin ${new_tag}
|
||||
|
||||
# gto show --json > MODEL_REGISTRY.md
|
||||
# git add .
|
||||
# git commit -m "Update Registry"
|
||||
# git push
|
||||
|
||||
Register-Patch-Model-Dev:
|
||||
# if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'patch')) }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install packages to register model
|
||||
run: |
|
||||
pip install --upgrade pip
|
||||
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
||||
|
||||
- name: Register Model
|
||||
run: |
|
||||
# REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}')
|
||||
REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}')
|
||||
|
||||
git config user.name "Github-Bot"
|
||||
git config user.email "Github-Bot@no-reply.com"
|
||||
|
||||
latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@v" '{print $2}')
|
||||
if [ -z "${latest_version}" ]; then
|
||||
increment_version="0.0.1"
|
||||
else
|
||||
increment_version=$(echo ${latest_version} | awk 'BEGIN {
|
||||
FS="\\." # Set the field separator to a period
|
||||
OFS="." # Set the output field separator to a period
|
||||
}
|
||||
{
|
||||
patch = $3 + 1 # Increment the patch version
|
||||
print $1, $2, patch # Print the new version
|
||||
}')
|
||||
fi
|
||||
|
||||
new_tag=${REGISTER_MODEL_NAME}@v${increment_version}
|
||||
|
||||
# git tag -a ${new_tag} -m "Registering new Patch Version"
|
||||
# git push origin ${new_tag}
|
||||
|
||||
# gto show --json > MODEL_REGISTRY.md
|
||||
# git add .
|
||||
# git commit -m "Update Registry"
|
||||
# git push
|
||||
|
||||
Promote-Artefacts-To-Dev:
|
||||
if: github.event.pull_request.merged == true
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install packages to retrieve artifacts
|
||||
run: |
|
||||
pip install --upgrade pip
|
||||
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
||||
|
||||
- name: Retrieve artifacts (dvc.lock)
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
||||
run: |
|
||||
cd modules/ml-pipeline/src/pipeline
|
||||
dvc pull -r experiments
|
||||
|
||||
- name: Push artifacts to Dev
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
||||
run: |
|
||||
cd modules/ml-pipeline/src/pipeline
|
||||
dvc push -r dev
|
||||
|
||||
Register-New-Model-Dev:
|
||||
needs: [Register-Major-Model-Dev, Register-Minor-Model-Dev, Register-Patch-Model-Dev]
|
||||
if: |
|
||||
always() &&
|
||||
(needs.Register-Major-Model-Dev.result == 'success' || needs.Register-Major-Model-Dev.result == 'skipped') &&
|
||||
(needs.Register-Minor-Model-Dev.result == 'success' || needs.Register-Minor-Model-Dev.result == 'skipped') &&
|
||||
(needs.Register-Patch-Model-Dev.result == 'success' || needs.Register-Patch-Model-Dev.result == 'skipped')
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install packages to register model
|
||||
run: |
|
||||
pip install --upgrade pip
|
||||
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
||||
|
||||
- name: Register Model
|
||||
env:
|
||||
TARGET_BRANCH: ${{ github.base_ref }}
|
||||
run: |
|
||||
|
||||
REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}')
|
||||
# REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}')
|
||||
|
||||
git config user.name "Github-Bot"
|
||||
git config user.email "Github-Bot@no-reply.com"
|
||||
|
||||
latest_dev_version=$(gto history ${REGISTER_MODEL_NAME} --asc --plain | awk '{print $NF}' | awk '/dev/' | awk 'END {print}')
|
||||
if [ -z "${latest_dev_version}" ]; then
|
||||
increment_version="1"
|
||||
else
|
||||
increment_version=$(echo ${latest_dev_version} | awk '{print $NF}' | awk -F"#" '{print $3}' | awk '{$1++; print}')
|
||||
fi
|
||||
|
||||
new_tag=${REGISTER_MODEL_NAME}#dev#${increment_version}
|
||||
latest_version=$(gto show ${REGISTER_MODEL_NAME}@latest --ref | awk -F"@" '{print $2}')
|
||||
|
||||
echo ${new_tag}
|
||||
|
||||
commit_hash=$(gto history ${REGISTER_MODEL_NAME} --asc --plain | awk "/${latest_version}/" | awk '{print $(NF-1)}')
|
||||
git checkout ${commit_hash}
|
||||
|
||||
# git pull #Get new model registry md file changes
|
||||
git tag -a ${new_tag} -m "Assigning stage dev to artifact ${REGISTER_MODEL_NAME} version ${latest_version}"
|
||||
git push origin ${new_tag}
|
||||
|
||||
git checkout ${TARGET_BRANCH}
|
||||
git fetch --all
|
||||
git pull
|
||||
|
||||
gto show --json > MODEL_REGISTRY.md
|
||||
git add .
|
||||
git commit -m "Update Registry"
|
||||
git push origin ${TARGET_BRANCH}
|
||||
|
|
@ -8,25 +8,25 @@
|
|||
"active": true
|
||||
},
|
||||
"sap": {
|
||||
"version": "v0.14.0",
|
||||
"version": "v0.11.0",
|
||||
"stage": {
|
||||
"dev": "v0.14.0"
|
||||
"dev": "v0.11.0"
|
||||
},
|
||||
"registered": true,
|
||||
"active": true
|
||||
},
|
||||
"heat": {
|
||||
"version": "v0.5.0",
|
||||
"version": "v0.4.0",
|
||||
"stage": {
|
||||
"dev": "v0.5.0"
|
||||
"dev": "v0.4.0"
|
||||
},
|
||||
"registered": true,
|
||||
"active": true
|
||||
},
|
||||
"carbon": {
|
||||
"version": "v0.5.0",
|
||||
"version": "v0.4.0",
|
||||
"stage": {
|
||||
"dev": "v0.5.0"
|
||||
"dev": "v0.4.0"
|
||||
},
|
||||
"registered": true,
|
||||
"active": true
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ default:
|
|||
scenario_data_filepaths:
|
||||
# - s3://retrofit-data-dev/scenario_data/22-03-2024-19-20-09/recommendations_scoring_data.parquet
|
||||
# - s3://retrofit-data-dev/scenario_data/24-03-2024-20-23-25/recommendations_scoring_data.parquet
|
||||
# - s3://retrofit-data-dev/scenario_data/27-03-2024-11-38-15/recommendations_scoring_data.parquet
|
||||
# - s3://retrofit-data-dev/scenario_data/26-05-2024-08-47-45/recommendations_scoring_data.parquet
|
||||
# - s3://retrofit-data-dev/scenario_data/26-05-2024-10-44-53/recommendations_scoring_data.parquet
|
||||
- s3://retrofit-data-dev/scenario_data/28-05-2024-19-22-41/recommendations_scoring_data.parquet
|
||||
- s3://retrofit-data-dev/scenario_data/27-03-2024-11-38-15/recommendations_scoring_data.parquet
|
||||
comparison_output_filepath: ./metrics/scenario_table.md
|
||||
metrics_output_filepath: ./metrics/scenario_metrics.md
|
||||
|
|
|
|||
|
|
@ -18,10 +18,7 @@ default:
|
|||
prepare_data:
|
||||
input_dataclient_type: aws-s3
|
||||
output_dataclient_type: local
|
||||
# data_filepath: s3://retrofit-data-dev/sap_change_model/2024-03-22-18-56-53/dataset_rooms.parquet
|
||||
# data_filepath: s3://retrofit-data-dev/sap_change_model/2024-05-25-08-36-36/dataset_rooms.parquet
|
||||
# data_filepath: s3://retrofit-data-dev/sap_change_model/2024-05-26-10-31-39/dataset_rooms.parquet
|
||||
data_filepath: s3://retrofit-data-dev/sap_change_model/2024-05-28-19-08-25/dataset_rooms.parquet
|
||||
data_filepath: s3://retrofit-data-dev/sap_change_model/2024-03-22-18-56-53/dataset_rooms.parquet
|
||||
train_proportion: 0.9
|
||||
output_train_filepath: ./data/prepared_data/train.parquet
|
||||
output_test_filepath: ./data/prepared_data/test.parquet
|
||||
|
|
|
|||
|
|
@ -35,12 +35,52 @@ stages:
|
|||
- number_habitable_rooms
|
||||
- number_heated_rooms
|
||||
default.feature_processor.feature_processor_config.retain_features:
|
||||
- uprn
|
||||
- sap_starting
|
||||
- hot_water_energy_eff_ending
|
||||
- mainheat_energy_eff_ending
|
||||
- constituency
|
||||
- roof_energy_eff_ending
|
||||
- walls_energy_eff_ending
|
||||
- secondheat_description_ending
|
||||
- property_type
|
||||
- mainheatc_energy_eff_ending
|
||||
- built_form
|
||||
- walls_insulation_thickness_ending
|
||||
- potential_energy_efficiency
|
||||
- transaction_type_ending
|
||||
- floor_thermal_transmittance_ending
|
||||
- low_energy_lighting_ending
|
||||
- heat_demand_starting
|
||||
- photo_supply_ending
|
||||
- carbon_starting
|
||||
- walls_thermal_transmittance_ending
|
||||
- roof_insulation_thickness_ending
|
||||
- total_floor_area_ending
|
||||
- number_open_fireplaces_ending
|
||||
- windows_energy_eff_ending
|
||||
- floor_height_ending
|
||||
- extension_count_ending
|
||||
- has_air_source_heat_pump_ending
|
||||
- charging_system_ending
|
||||
- construction_age_band
|
||||
- glazed_type_ending
|
||||
- roof_thermal_transmittance_ending
|
||||
- floor_insulation_thickness_ending
|
||||
- has_mains_gas_ending
|
||||
- estimated_perimeter_starting
|
||||
- energy_consumption_potential
|
||||
- environment_impact_potential
|
||||
- heater_type_ending
|
||||
- multi_glaze_proportion_ending
|
||||
- lighting_energy_eff_ending
|
||||
- fixed_lighting_outlets_count
|
||||
default.feature_processor.feature_processor_config.subsample_amount:
|
||||
default.feature_processor.feature_processor_config.subsample_seed: 0
|
||||
default.feature_processor.feature_processor_config.target: sap_ending
|
||||
default.feature_processor.feature_processor_type: dataframe
|
||||
default.prepare_data.data_filepath:
|
||||
s3://retrofit-data-dev/sap_change_model/2024-05-28-19-08-25/dataset_rooms.parquet
|
||||
s3://retrofit-data-dev/sap_change_model/2024-03-22-18-56-53/dataset_rooms.parquet
|
||||
default.prepare_data.input_dataclient_type: aws-s3
|
||||
default.prepare_data.output_dataclient_type: local
|
||||
default.prepare_data.output_test_filepath: ./data/prepared_data/test.parquet
|
||||
|
|
@ -49,8 +89,8 @@ stages:
|
|||
outs:
|
||||
- path: data/prepared_data/
|
||||
hash: md5
|
||||
md5: 80c9e138146a1d96b9d16091c207e2e8.dir
|
||||
size: 45056059
|
||||
md5: efa416abea618ae6220a0c3d597603cf.dir
|
||||
size: 44750997
|
||||
nfiles: 2
|
||||
build_model:
|
||||
cmd: python 2_build_model.py
|
||||
|
|
@ -61,8 +101,8 @@ stages:
|
|||
size: 4820
|
||||
- path: data/prepared_data
|
||||
hash: md5
|
||||
md5: 80c9e138146a1d96b9d16091c207e2e8.dir
|
||||
size: 45056059
|
||||
md5: efa416abea618ae6220a0c3d597603cf.dir
|
||||
size: 44750997
|
||||
nfiles: 2
|
||||
params:
|
||||
configs/build_model.yaml:
|
||||
|
|
@ -94,17 +134,17 @@ stages:
|
|||
outs:
|
||||
- path: data/fit_predictions/
|
||||
hash: md5
|
||||
md5: d9c9afc05e8780db47c0548b19bf7d19.dir
|
||||
size: 3349989
|
||||
md5: de46250d454c4d713ab580b10ff3fd31.dir
|
||||
size: 3349318
|
||||
nfiles: 1
|
||||
- path: data/model/
|
||||
hash: md5
|
||||
md5: 13c3100e1486c27a83a8a47491077842.dir
|
||||
size: 773523079
|
||||
nfiles: 36
|
||||
md5: 18bd7a93ece75a65d3a950b7dfdab4fb.dir
|
||||
size: 735951861
|
||||
nfiles: 35
|
||||
- path: metrics/fit_metrics.json
|
||||
hash: md5
|
||||
md5: 2ff70a2a45813e1bcdf2ea3aa8e07d4a
|
||||
md5: 8a952a5e884c268e6059357a627b9251
|
||||
size: 224
|
||||
generate_predictions:
|
||||
cmd: python 3_generate_predictions.py
|
||||
|
|
@ -115,13 +155,13 @@ stages:
|
|||
size: 2464
|
||||
- path: data/model
|
||||
hash: md5
|
||||
md5: 13c3100e1486c27a83a8a47491077842.dir
|
||||
size: 773523079
|
||||
nfiles: 36
|
||||
md5: 18bd7a93ece75a65d3a950b7dfdab4fb.dir
|
||||
size: 735951861
|
||||
nfiles: 35
|
||||
- path: data/prepared_data
|
||||
hash: md5
|
||||
md5: 80c9e138146a1d96b9d16091c207e2e8.dir
|
||||
size: 45056059
|
||||
md5: efa416abea618ae6220a0c3d597603cf.dir
|
||||
size: 44750997
|
||||
nfiles: 2
|
||||
params:
|
||||
configs/settings.yaml:
|
||||
|
|
@ -133,8 +173,8 @@ stages:
|
|||
outs:
|
||||
- path: data/predictions/
|
||||
hash: md5
|
||||
md5: 5d07bcebf3160a72bb18dfd79106e85c.dir
|
||||
size: 463197
|
||||
md5: 07ef721a0dc94a52e3ba7a70ac45b8ff.dir
|
||||
size: 463563
|
||||
nfiles: 1
|
||||
generate_metrics:
|
||||
cmd: python 4_generate_metrics.py
|
||||
|
|
@ -145,13 +185,13 @@ stages:
|
|||
size: 3484
|
||||
- path: data/predictions
|
||||
hash: md5
|
||||
md5: 5d07bcebf3160a72bb18dfd79106e85c.dir
|
||||
size: 463197
|
||||
md5: 07ef721a0dc94a52e3ba7a70ac45b8ff.dir
|
||||
size: 463563
|
||||
nfiles: 1
|
||||
- path: data/prepared_data
|
||||
hash: md5
|
||||
md5: 80c9e138146a1d96b9d16091c207e2e8.dir
|
||||
size: 45056059
|
||||
md5: efa416abea618ae6220a0c3d597603cf.dir
|
||||
size: 44750997
|
||||
nfiles: 2
|
||||
params:
|
||||
configs/settings.yaml:
|
||||
|
|
@ -161,30 +201,30 @@ stages:
|
|||
outs:
|
||||
- path: metrics/metrics.json
|
||||
hash: md5
|
||||
md5: 3e08df02fd5c5d094bcf936e1338d596
|
||||
size: 223
|
||||
md5: 9f863f47799d42c101eba3b03a179455
|
||||
size: 224
|
||||
generate_scenerio_metrics:
|
||||
cmd: python 5_generate_scenarios.py
|
||||
deps:
|
||||
- path: 5_generate_scenarios.py
|
||||
hash: md5
|
||||
md5: 40506749fefd926d47c60ff5b16db307
|
||||
size: 5337
|
||||
md5: a18f6c6ae2082f038df47386cf3e418e
|
||||
size: 4896
|
||||
params:
|
||||
configs/scenarios.yaml:
|
||||
default.scenarios:
|
||||
input_dataclient_type: aws-s3
|
||||
output_dataclient_type: local
|
||||
scenario_data_filepaths:
|
||||
- s3://retrofit-data-dev/scenario_data/28-05-2024-19-22-41/recommendations_scoring_data.parquet
|
||||
- s3://retrofit-data-dev/scenario_data/27-03-2024-11-38-15/recommendations_scoring_data.parquet
|
||||
comparison_output_filepath: ./metrics/scenario_table.md
|
||||
metrics_output_filepath: ./metrics/scenario_metrics.md
|
||||
outs:
|
||||
- path: metrics/scenario_metrics.md
|
||||
hash: md5
|
||||
md5: fa4d6d7bbd7818613800da5f8f37ea96
|
||||
md5: 64e7db945ff655ae03c20c9845f19106
|
||||
size: 363
|
||||
- path: metrics/scenario_table.md
|
||||
hash: md5
|
||||
md5: d6baf100a1623cc2467c2f8221d314c9
|
||||
md5: d4f8afe07b774374aeaa48f1b7b8a5fc
|
||||
size: 2133
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
dvc==3.51.0
|
||||
dvc-s3==3.2.0
|
||||
gto==1.7.1
|
||||
dvc==3.36.0
|
||||
dvc-s3==3.0.1
|
||||
gto==1.6.1
|
||||
pyOpenSSL==23.3.0
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue