Commit 4c5662f8 authored by aakash.bedi's avatar aakash.bedi

inv & mppt id added to mlflow util

parent ff9304ef
Pipeline #58240 failed with stage
if __name__ == "__main__":
from dotenv import load_dotenv
load_dotenv(dotenv_path='config.env')
import pandas as pd
import numpy as np
import warnings
from loguru import logger
from scripts.utils.pycaret_util import PycaretUtil
from scripts.core.engine.mppt_data import GetData
from scripts.utils.reading_tags import GetTags
from scripts.core.engine.tags_data import get_tags_data
......@@ -49,6 +46,7 @@ def get_tag_details():
inv_id=inv_id,
mppt_id=mppt_id)
df_result = mppt_data.get_final_data(x_test=x_test, y_test=y_test, predictions=predictions)
# function to push the data to kairos
logger.info(f'{df_result.shape}')
except Exception as e:
logger.exception(f'Exception - {e}')
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
......@@ -9,8 +9,6 @@ KAFKA_PORT=9092
KAFKA_TOPIC=ilens_dev
START_RELATIVE=90
END_RELATIVE=0
SENDER_EMAIL=no-reply@unifytwin.com
MONGO_URI=mongodb://ilens:ilens4321@192.168.0.220:2717/
REQUIRED_TZ="Asia/Kolkata"
MLFLOW_TRACKING_URI=https://qa.unifytwin.com/mlflow/
......@@ -19,13 +17,11 @@ MLFLOW_TRACKING_PASSWORD=MlFlOwQA#4321
AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=https;AccountName=azrmlilensqa006382180551;AccountKey=tDGOKfiZ2svfoMvVmS0Fbpf0FTHfTq4wKYuDX7cAxlhve/3991QuzdvJHm9vWc+lo6mtC+x9yPSghWNR4+gacg==;EndpointSuffix=core.windows.net
AZURE_STORAGE_ACCESS_KEY=tDGOKfiZ2svfoMvVmS0Fbpf0FTHfTq4wKYuDX7cAxlhve/3991QuzdvJHm9vWc+lo6mtC+x9yPSghWNR4+gacg==
USER=Dalmia_degradation
EXPERIMENT_NAME=Dalmia Solar Degradation1
EXPERIMENT_NAME=Dalmia Solar Degradation2
RUN_NAME=Degradation
MODEL_NAME=versioning
CHECK_PARAM=hours
MODEL_CHECK_PARAM=144
MODEL_CHECK_PARAM=480
MODELS_LIST=lr,knn,gbr,rf,catboost,lightgbm,ada,et,xgboost,dt,en,par,huber
SELECTED_METRIC=R2
HYPERPARAMETER_TUNING_METHOD=scikit-learn
\ No newline at end of file
......@@ -27,8 +27,9 @@ class TrainingInference:
df_std = pd.concat([x_train_std, y_train_std], axis=1)
df_std.dropna(axis=0, inplace=True)
df_std.reset_index(drop=True, inplace=True)
model, pre_trained = ModelLoad().model_manager(df=df_std, target='current_mppt')
inv_mppt_id = f'{inv_id}_{mppt_id}'
model, pre_trained = ModelLoad().model_manager(df=df_std, target='current_mppt',
inv_mppt_id=inv_mppt_id)
return model, scaler_x, scaler_y
except Exception as e:
......
......@@ -41,9 +41,9 @@ class GetData:
df_result['actual_current_mppt']
df_result.loc[df_result['potential_current_mppt_loss'] < 0, 'potential_current_mppt_loss'] = 0
df_result['hour'] = df_result['datetime'].dt.hour
df_result.loc[df_result['hour'].between(left=19, right=23, inclusive='both'),
df_result.loc[df_result['hour'].between(left=18, right=23, inclusive='both'),
'potential_current_mppt_loss'] = 0
df_result.loc[df_result['hour'].between(left=0, right=5, inclusive='both'),
df_result.loc[df_result['hour'].between(left=0, right=6, inclusive='both'),
'potential_current_mppt_loss'] = 0
df_result.drop(['hour'], axis=1, inplace=True)
df_result['total_potential_current_mppt_loss'] = df_result['potential_current_mppt_loss']. \
......
......@@ -21,11 +21,11 @@ client = mlflow.tracking.MlflowClient()
class ModelLoad(object):
def model_manager(self, df, target):
def model_manager(self, df, target, inv_mppt_id):
try:
experiment_id = self.create_experiment(experiment_name=MlFlow.experiment_name)
days, latest_run_id = self.fetch_latest_model(experiment_id=experiment_id,
run_name=MlFlow.run_name)
run_name=MlFlow.run_name + '_' + inv_mppt_id)
if days < int(MlFlow.model_check_param):
logger.debug(f'Using the pretrained model !')
energy_model = self.load_model_pyfunc(
......@@ -33,7 +33,8 @@ class ModelLoad(object):
pre_trained = True
else:
pre_trained = False
run_id = self.creating_run(experiment_id=experiment_id, run_name=MlFlow.run_name)
run_id = self.creating_run(experiment_id=experiment_id,
run_name=MlFlow.run_name + '_' + inv_mppt_id)
with mlflow.start_run(run_id=run_id):
nested_run_id = self.creating_new_nested_run(experiment_id=experiment_id,
run_id=run_id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment