mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
add pre-commit hook, no customisation on black
This commit is contained in:
parent
4a73ebfb74
commit
6956a80707
5 changed files with 20 additions and 5 deletions
11
model_data/simulation_system/.pre-commit-config.yaml
Normal file
11
model_data/simulation_system/.pre-commit-config.yaml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v2.3.0
|
||||
hooks:
|
||||
- id: check-yaml
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.10.0
|
||||
hooks:
|
||||
- id: black
|
||||
|
|
@ -54,6 +54,7 @@ class MLModel(Protocol):
|
|||
Perfomance post processing on Model to ensure ready for deployment
|
||||
"""
|
||||
|
||||
def generate_meta_data(self):
|
||||
def model_metadata(self) -> dict:
|
||||
"""
|
||||
Extract out model metadata as dictionary
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -135,6 +135,12 @@ class AutogluonModel:
|
|||
|
||||
# This will return a string path of the location
|
||||
return self.model.clone_for_deployment(deployment_path)
|
||||
|
||||
def model_metadata(self) -> dict:
|
||||
"""
|
||||
For Autogluon model, use the inbuilt model info method
|
||||
"""
|
||||
return self.model.info()
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -112,13 +112,12 @@ def prediction(target_column: str = "RDSAP_CHANGE", model_path: str = None, data
|
|||
output_base = PREDICTION_LOCATION / target_column / uprn / TIMESTAMP
|
||||
output_base.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# TODO: change model.model.info to a class method for MLModel
|
||||
json_prediction = prediction.to_json(output_base / PREDICTION_FILE)
|
||||
prediction_metadata = {
|
||||
"model_type": model_type,
|
||||
"model_name": model_name,
|
||||
"model_location": model_location,
|
||||
"model_settings": model.model.info()
|
||||
"model_settings": model.model_metadata()
|
||||
}
|
||||
|
||||
pd.DataFrame([prediction_metadata]).to_json(output_base / METADATA_FILE)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
import argparse
|
||||
# import boto3
|
||||
import os
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
from typing import List
|
||||
from core.Logger import logger
|
||||
from core.DataLoader import DataLoader
|
||||
from core.FeatureProcessor import FeatureProcessor
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue