다음을 통해 공유


기능 저장소 계보 보기

모델을 사용하여 FeatureEngineeringClient.log_model로그하는 경우 모델에 사용되는 기능이 자동으로 추적되며 카탈로그 탐색기의 계보 탭에서 볼 수 있습니다. 기능 테이블 외에도 주문형 기능을 컴퓨팅하는 데 사용되는 Python UDF도 추적됩니다.

기능 테이블, 함수 또는 모델의 계보를 캡처하는 방법

모델에 사용되는 계보 정보 추적 기능 테이블 및 함수는 호출 log_model할 때 자동으로 캡처됩니다. 다음 예제 코드를 참조하세요.

from databricks.feature_engineering import FeatureEngineeringClient, FeatureLookup, FeatureFunction
fe = FeatureEngineeringClient()

features = [
    FeatureLookup(
        table_name = "main.on_demand_demo.restaurant_features",
        feature_names = ["latitude", "longitude"],
        rename_outputs={"latitude": "restaurant_latitude", "longitude": "restaurant_longitude"},
        lookup_key = "restaurant_id",
        timestamp_lookup_key = "ts"
    ),
    FeatureFunction(
        udf_name="main.on_demand_demo.extract_user_latitude",
        output_name="user_latitude",
        input_bindings={"blob": "json_blob"},
    ),
    FeatureFunction(
        udf_name="main.on_demand_demo.extract_user_longitude",
        output_name="user_longitude",
        input_bindings={"blob": "json_blob"},
    ),
    FeatureFunction(
        udf_name="main.on_demand_demo.haversine_distance",
        output_name="distance",
        input_bindings={"x1": "restaurant_longitude", "y1": "restaurant_latitude", "x2": "user_longitude", "y2": "user_latitude"},
    )
]

training_set = fe.create_training_set(
    label_df, feature_lookups=features, label="label", exclude_columns=["restaurant_id", "json_blob", "restaurant_latitude", "restaurant_longitude", "user_latitude", "user_longitude", "ts"]
)

class IsClose(mlflow.pyfunc.PythonModel):
    def predict(self, ctx, inp):
        return (inp['distance'] < 2.5).values

model_name = "fe_packaged_model"
mlflow.set_registry_uri("databricks-uc")

fe.log_model(
    IsClose(),
    model_name,
    flavor=mlflow.pyfunc,
    training_set=training_set,
    registered_model_name=registered_model_name
)

기능 테이블, 모델 또는 함수의 계보 보기

기능 테이블, 모델 또는 함수의 계보를 보려면 다음 단계를 수행합니다.

  1. 카탈로그 탐색기에서 테이블, 모델 버전 또는 함수 페이지로 이동합니다.

  2. 계보 탭을 선택합니다. 왼쪽 사이드바에는 이 테이블, 모델 버전 또는 함수로 기록된 Unity 카탈로그 구성 요소가 표시됩니다.

    Lineage tab on model page in Catalog Explorer

  3. 계보 그래프 보기를 클릭합니다. 계보 그래프가 나타납니다. 계보 그래프 탐색에 대한 자세한 내용은 계보 캡처 및 탐색을 참조 하세요.

    lineage screen

  4. 계보 그래프를 닫려면 오른쪽 위 모서리를 클릭합니다 close button for lineage graph .