본문 바로가기

AI/MLflow

[MLflow] Autologging

728x90
반응형

 

자동으로 ML Model tracking을 할 수 있다.

mlflow.모델 종류.autolog()를 사용하는데 start_run() 전에 넣어야한다.

# mlflow
import mlflow
import mlflow.keras
# data
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
import numpy as np
# training
from train import tf_model

if __name__ == "__main__":
    dataset = pd.read_csv("./dataset.csv")
    X = dataset.iloc[:, 0:-3]
    y = dataset.iloc[:, -3:]

    train_x, val_x, train_y, val_y = train_test_split(
        X, y, test_size=0.2, random_state=42)
    scaler = StandardScaler()
    sxtrain = scaler.fit_transform(train_x)
    sxval = scaler.transform(val_x)

    # autologging
    mlflow.keras.autolog()

    # mlflow
    with mlflow.start_run() as run:
        model, history, metrics, signature = tf_model(
            sxtrain, train_y, sxval, val_y, run=run, epoch=30)

728x90
반응형

'AI > MLflow' 카테고리의 다른 글

[MLflow] Artifact Store  (0) 2024.02.29
[MLflow] MLflow Model Registry  (0) 2024.02.28
[MLflow] MLflow Models  (0) 2024.02.28
[MLflow] MLflow Project  (0) 2024.02.27
[MLflow] MLflow Tracking  (0) 2024.02.27