Module sktmls.models.ml_model
Classes
class AutoMLModel (**kwargs)
-
AutoML모델 클래스 입니다.
Args
- kwargs
- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- model_type: (str) ML모델 타입 (
automl
|manual
) - version: (str) ML모델 버전
- description: (str) ML모델 설명
- creator: (str) ML모델 생성 계정명
- status: (
MLModelStatus
) ML모델 상태 - model_meta: (dict) ML모델 메타정보
- dataset_id: (int) ML 데이터셋 고유 ID
- dataset_name: (str) ML 데이터셋 이름
- automl_model_info: (dict) AutoML모델 정보
Returns
Ancestors
Methods
def get_error(self)
-
모델 학습 시 에러 발생 원인을 조회한다. (모델 학습 실패 시에만 값 존재)
Returns
str
- kwargs
class MLModel (**kwargs)
-
ML모델 클래스 입니다.
Args
- kwargs
- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- version: (str) ML모델 버전
- creator: (str) ML모델 생성 계정명
- description: (str) ML모델 설명
- model_type: (str) ML모델 타입 (
automl
|manual
) - table: (str) ML모델 테이블
- model_data: (str) ML모델 데이터
- status: (
MLModelStatus
) ML모델 상태 - created_at: (datetime) 생성일시
- updated_at: (datetime) 수정일시
Returns
Subclasses
Methods
def get(self) ‑> dict
def reset(self, **kwargs)
- kwargs
class MLModelClient (env: MLSENV = None, runtime_env: MLSRuntimeENV = None, username: str = None, password: str = None)
-
Args
- env: (
MLSENV
) 접근할 MLS 환경 (MLSENV.DEV
|MLSENV.STG
|MLSENV.PRD
) (기본값:MLSENV.STG
) - runtime_env: (
MLSRuntimeENV
) 클라이언트가 실행되는 환경 (MLSRuntimeENV.YE
|MLSRuntimeENV.EDD
|MLSRuntimeENV.LOCAL
) (기본값:MLSRuntimeENV.LOCAL
) - username: (str) MLS 계정명 (기본값: $MLS_USERNAME)
- password: (str) MLS 계정 비밀번호 (기본값: $MLS_PASSWORD)
아래의 환경 변수가 정의된 경우 해당 파라미터를 생략 가능합니다.
- $MLS_ENV: env
- $MLS_RUNTIME_ENV: runtime_env
- $MLS_USERNAME: username
- $MLS_PASSWORD: password
Returns
Example
ml_model_client = MLModelClient(env=MLSENV.STG, runtime_env=MLSRuntimeENV.YE, username="mls_account", password="mls_password")
Ancestors
Methods
def create_automl_model(self, dataset: Dataset, name: str, version: str, description: str) ‑> AutoMLModel
-
AutoML 모델을 생성합니다.
Args
- dataset: (sktmls.datasets.Dataset) ML 데이터셋
- name: (str) 생성할 AutoML 모델 이름
- version: (str) 생성할 AutoML 모델 버전
- description: (str) 생성할 AutoML 설명
Returns
- name: (str) ML모델 이름
- model_type: (str) ML모델 타입 (
automl
|manual
) - version: (str) ML모델 버전
- creator: (str) ML모델 생성 계정명
- description: (str) ML모델 설명
- status: (
MLModelStatus
) ML모델 상태 - model_meta: (dict) ML모델 메타정보
- dataset_id: (int) ML 데이터셋 고유 ID
- dataset_name: (str) ML 데이터셋 이름
- automl_model_info: (dict) AutoML모델 정보
Example
automl_model = ml_model_client.create_automl_model( dataset=dataset, name="automl_test_model", version="v1", description="test_model" )
def create_manual_model(self, name: str, version: str, description: str = None, creator: str = None, model_lib: str = None, model_data: str = None, model_meta: dict = None, features: str = None, table: str = None, components: List[Component] = None) ‑> ManualModel
-
일반 모델을 생성합니다. 모델을 버킷에 연결 가능하도록 deploy하는 작업입니다.
일반 모델은 deploy 후 버킷에 연결되어 정상 동작하기 까지 약 한 시간이 소요됩니다.
Args
- name: (str) 생성할 일반 모델 이름
- version: (str) 생성할 일반 모델 버전
- description: (optional) (str) 생성할 일반 모델 설명
- creator: (optional) (str) 일반 모델 생성 계정명
- model_lib: (optional) (str) 일반 모델 라이브러리
- model_data: (optional) (str) 일반 모델 데이터
- model_meta: (optional) (dict) 모델 레지스트리에 등록된 메타정보(model.json)
- features: (optional) (str) 일반 모델에 사용된 피쳐
- table: (optional) (str) 일반 모델 테이블
- components: (optional) list(
Component
) 일반 모델 컴포넌트 리스트
Returns
- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- model_type: (str) ML모델 타입 (
automl
|manual
) - version: (str) ML모델 버전
- description: (str) ML모델 설명
- creator: (str) ML모델 생성 계정명
- status: (
MLModelStatus
) ML모델 상태 - model_meta: (dict) ML모델 메타정보
- components: list(
Component
) ML모델 컴포넌트 - table: (str) ML모델 테이블
- model_lib: (str) ML모델 라이브러리
- model_data: (str) ML모델 데이터
- features: (str) ML모델에 사용된 피쳐
- is_enabled: (bool) 활성상태 여부
Example
component_1 = component_client.get_component(name="test_component_1") component_2 = component_client.get_component(name="test_component_2") manual_model = ml_model_client.create_manual_model( name="manual_test_model", version="v1", description="test_model", creator="mls_user", model_lib="lightgbm", model_data="/models/manual_test_model/v1/model.joblib", model_meta={ "name": "manual_test_model", "version": "v1", "model_lib": "lightgbm", "model_lib_version": "2.3.1", "model_data": "/models/manual_test_model/v1/model.joblib", "features": ["age", "app_use_traffic_youtube", "svc_scrb_period"], }, features="age,app_use_traffic_youtube,svc_scrb_period", table="test_model_table", components=[component_1, component_2] )
def create_model_deployment(self, name: str, version: str, description: str = None, creator: str = None, model_lib: str = None, model_data: str = None, model_meta: dict = None, features: str = None, table: str = None, components: List[Component] = None) ‑> ManualModel
-
일반 모델을 배포(배포 객체를 생성)합니다.
위 메소드는 create_manual_model과 같은 기능을 수행합니다.
모델을 버킷에 연결 가능하도록 deploy하는 작업입니다. 일반 모델은 deploy 후 버킷에 연결되어 정상 동작하기 까지 약 한 시간이 소요됩니다.
Args
- name: (str) 생성할 일반 모델 이름
- version: (str) 생성할 일반 모델 버전
- description: (optional) (str) 생성할 일반 모델 설명
- creator: (optional) (str) 일반 모델 생성 계정명
- model_lib: (optional) (str) 일반 모델 라이브러리
- model_data: (optional) (str) 일반 모델 데이터
- model_meta: (optional) (dict) 모델 레지스트리에 등록된 메타정보(model.json)
- features: (optional) (str) 일반 모델에 사용된 피쳐
- table: (optional) (str) 일반 모델 테이블
- components: (optional) list(
Component
) 일반 모델 컴포넌트 리스트
Returns
- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- model_type: (str) ML모델 타입 (
automl
|manual
) - version: (str) ML모델 버전
- description: (str) ML모델 설명
- creator: (str) ML모델 생성 계정명
- status: (
MLModelStatus
) ML모델 상태 - model_meta: (dict) ML모델 메타정보
- components: list(
Component
) ML모델 컴포넌트 - table: (str) ML모델 테이블
- model_lib: (str) ML모델 라이브러리
- model_data: (str) ML모델 데이터
- features: (str) ML모델에 사용된 피쳐
- is_enabled: (bool) 활성상태 여부
Example
component_1 = component_client.get_component(name="test_component_1") component_2 = component_client.get_component(name="test_component_2") model_deployment = ml_model_client.create_model_deployment( name="manual_test_model", version="v1", description="test_model", creator="mls_user", model_lib="lightgbm", model_data="/models/manual_test_model/v1/model.joblib", model_meta={ "name": "manual_test_model", "version": "v1", "model_lib": "lightgbm", "model_lib_version": "2.3.1", "model_data": "/models/manual_test_model/v1/model.joblib", "features": ["age", "app_use_traffic_youtube", "svc_scrb_period"], }, features="age,app_use_traffic_youtube,svc_scrb_period", table="test_model_table", components=[component_1, component_2] )
def delete_model(self, model: Union[AutoMLModel, ManualModel], delete_table: bool = False) ‑> MLSResponse
-
모델 삭제합니다.
Args
- model: (
AutoMLModel
orManualModel
) AutoML 혹은 일반 모델 객체 - delete_table: (optional) (bool) manual_model의 경우 모델의 연결된 dynamodb table을 함께 지우는 옵션. (기본값:
False
)
Returns
Example
ml_model_client.delete_model(model=model, delete_table=True)
- model: (
def delete_model_deployment(self, model_deployment: ManualModel, delete_table: bool = False) ‑> MLSResponse
-
모델 배포를 삭제합니다. 위 메소드는 delete_model과 같은 기능을 수행합니다.
Args
- model_deployment: (
ManualModel
) 일반 모델 객체 - delete_table: (optional) (bool) manual_model의 경우 모델의 연결된 dynamodb table을 함께 지우는 옵션. (기본값:
False
)
Returns
Example
ml_model_client.delete_model_deployment(model_deployment=model_deployment, delete_table=True)
- model_deployment: (
def get_automl_model(self, id: int = None, name: str = None, version: str = None) ‑> AutoMLModel
-
AutoML모델 정보를 가져옵니다.
Args:
id
또는 (name
andversion
) 중 한 개 이상의 값이 반드시 전달되어야 합니다.- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- version: (str) ML모델 이름
Returns
- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- model_type: (str) ML모델 타입 (
automl
|manual
) - version: (str) ML모델 버전
- description: (str) ML모델 설명
- creator: (str) ML모델 생성 계정명
- status: (
MLModelStatus
) ML모델 상태 - model_meta: (dict) ML모델 메타정보
- dataset_id: (int) ML 데이터셋 고유 ID
- dataset_name: (str) ML 데이터셋 이름
- automl_model_info: (dict) AutoML모델 정보
Example
automl_model_by_id = ml_model_client.get_automl_model(id=3) automl_model_by_name_and_version = ml_model_client.get_automl_model(name="my_automl_model", version="my_automl_version")
def get_automl_model_server_handler(self, model: AutoMLModel) ‑> str
-
AutoML모델 서버의 예측 결과 로직을 조회합니다.
Args
- model: (
AutoMLModel
) AutoML 객체
Returns
str
Example
```python ml_model_client.get_automl_model_server_handler(model=model)
- model: (
def get_automl_model_server_status(self, model: AutoMLModel) ‑> str
-
AutoML모델 서버 상태를 확인합니다.
Args
- model: (
AutoMLModel
) AutoML 객체
Returns
str (
RUNNING
|STOPPED
|FAILED
|UNKNOWN
)Example
ml_model_client.get_automl_model_server_status(model=model)
- model: (
def get_manual_model(self, id: int = None, name: str = None, version: str = None) ‑> ManualModel
-
일반 모델 정보를 가져옵니다.
Args:
id
또는 (name
andversion
) 중 한 개 이상의 값이 반드시 전달되어야 합니다.- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- version: (str) ML모델 이름
Returns
- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- model_type: (str) ML모델 타입 (
automl
|manual
) - version: (str) ML모델 버전
- description: (str) ML모델 설명
- creator: (str) ML모델 생성 계정명
- status: (
MLModelStatus
) ML모델 상태 - model_meta: (dict) ML모델 메타정보
- components: list(
Component
) ML모델 컴포넌트 - table: (str) ML모델 테이블
- model_lib: (str) ML모델 라이브러리
- model_data: (str) ML모델 데이터
- features: (str) ML모델에 사용된 피쳐
- is_enabled: (bool) 활성상태 여부
Example
manual_model_by_id = ml_model_client.get_manual_model(id=3) manual_model_by_name_and_version = ml_model_client.get_manual_model(name="my_manual_model", version="my_manual_version")
def get_model_deployment(self, id: int = None, name: str = None, version: str = None) ‑> ManualModel
-
일반 모델 배포를 가져옵니다. 위 메소드는 get_manual_model과 같은 기능을 수행합니다.
Args:
id
또는 (name
andversion
) 중 한 개 이상의 값이 반드시 전달되어야 합니다.- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- version: (str) ML모델 이름
Returns
- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- model_type: (str) ML모델 타입 (
automl
|manual
) - version: (str) ML모델 버전
- description: (str) ML모델 설명
- creator: (str) ML모델 생성 계정명
- status: (
MLModelStatus
) ML모델 상태 - model_meta: (dict) ML모델 메타정보
- components: list(
Component
) ML모델 컴포넌트 - table: (str) ML모델 테이블
- model_lib: (str) ML모델 라이브러리
- model_data: (str) ML모델 데이터
- features: (str) ML모델에 사용된 피쳐
- is_enabled: (bool) 활성상태 여부
Example
model_deployment_by_id = ml_model_client.get_model_deployment(id=3) model_deployment_by_name_and_version = ml_model_client.get_model_deployment(name="my_manual_model", version="my_manual_version")
def is_batch_prediction_ready(self, manual_model: ManualModel) ‑> bool
-
일반 모델에 등록된 배치추론 테이블이 존재하는지와 업로드가 끝났는지 체크합니다.
Args
- model: (
ManualModel
) 일반 모델 객체
Returns
bool
Example
my_model = ml_model_client.get_manual_model(name="manual_test_model", version="v1") ml_model_client.is_batch_prediction_ready(manual_model=my_model)
- model: (
def is_online_prediction_ready(self, manual_model: ManualModel) ‑> bool
-
일반 모델에 등록된 아티팩트(model.jobilb)이 존재하는지 확인합니다.
Args
- model: (
ManualModel
) 일반 모델 객체
Returns
bool
Example
my_model = ml_model_client.get_manual_model(name="manual_test_model", version="v1") ml_model_client.is_online_prediction_ready(manual_model=my_model)
- model: (
def list_automl_models(self, **kwargs) ‑> List[AutoMLModel]
-
AutoML모델 리스트를 가져옵니다.
Args
- kwargs: (optional) (dict) 쿼리 조건
- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- version: (str) ML모델 이름
- query: (str) 검색 문자
- page: (int) 페이지 번호
Returns
list(
AutoMLModel
)- name: (str) ML모델 이름
- model_type: (str) ML모델 타입 (
automl
|manual
) - version: (str) ML모델 버전
- creator: (str) ML모델 생성 계정명
- description: (str) ML모델 설명
- status: (
MLModelStatus
) ML모델 상태 - model_meta: (dict) ML모델 메타정보
- dataset_id: (int) ML 데이터셋 고유 ID
- dataset_name: (str) ML 데이터셋 이름
- automl_model_info: (dict) AutoML모델 정보
Example
automl_models = ml_model_client.list_automl_models()
- kwargs: (optional) (dict) 쿼리 조건
def list_manual_models(self, **kwargs) ‑> List[ManualModel]
-
일반 모델 리스트를 가져옵니다.
Args
- kwargs: (optional) (dict) 쿼리 조건
- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- version: (str) ML모델 이름
- query: (str) 검색 문자
- page: (int) 페이지 번호
Returns
list(
ManualModel
)- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- model_type: (str) ML모델 타입 (
automl
|manual
) - version: (str) ML모델 버전
- description: (str) ML모델 설명
- creator: (str) ML모델 생성 계정명
- status: (
MLModelStatus
) ML모델 상태 - model_meta: (dict) ML모델 메타정보
- components: list(
Component
) ML모델 컴포넌트 - table: (str) ML모델 테이블
- model_lib: (str) ML모델 라이브러리
- model_data: (str) ML모델 데이터
- features: (str) ML모델에 사용된 피쳐
- is_enabled: (bool) 활성상태 여부
Example
manual_models = ml_model_client.list_manual_models()
- kwargs: (optional) (dict) 쿼리 조건
def list_model_deployments(self, **kwargs) ‑> List[ManualModel]
-
일반 모델 배포들을 가져옵니다. 위 메소드는 list_manual_models와 같은 기능을 수행합니다.
Args
- kwargs: (optional) (dict) 쿼리 조건
- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- version: (str) ML모델 이름
- query: (str) 검색 문자
- page: (int) 페이지 번호
Returns
list(
ManualModel
)- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- model_type: (str) ML모델 타입 (
automl
|manual
) - version: (str) ML모델 버전
- description: (str) ML모델 설명
- creator: (str) ML모델 생성 계정명
- status: (
MLModelStatus
) ML모델 상태 - model_meta: (dict) ML모델 메타정보
- components: list(
Component
) ML모델 컴포넌트 - table: (str) ML모델 테이블
- model_lib: (str) ML모델 라이브러리
- model_data: (str) ML모델 데이터
- features: (str) ML모델에 사용된 피쳐
- is_enabled: (bool) 활성상태 여부
Example
manual_models = ml_model_client.list_model_deployments()
- kwargs: (optional) (dict) 쿼리 조건
def start_automl_model_server(self, model: AutoMLModel) ‑> MLSResponse
-
AutoML모델 서버를 시작합니다.
Args
- model: (
AutoMLModel
) AutoML 객체
Returns
Example
ml_model_client.start_automl_model_server(model=model)
- model: (
def stop_automl_model_server(self, model: AutoMLModel) ‑> MLSResponse
-
AutoML모델 서버를 중단합니다.
Args
- model: (
AutoMLModel
) AutoML 객체
Returns
Example
ml_model_client.stop_automl_model_server(model=model)
- model: (
def update_automl_model_server_handler(self, model: AutoMLModel, handler: str) ‑> MLSResponse
-
AutoML모델 서버의 예측 결과 로직(Handler)을 수정합니다.
Args
- model: (
AutoMLModel
) AutoML 객체 - handler: (str) 예측 결과 로직 코드
Returns
Example
handler_path = "handler.py" with open(handler_path) as f: handler = f.read() ml_model_client.update_automl_model_server_handler(model=model, handler=handler)
- model: (
def update_manual_model(self, manual_model: ManualModel, name: str = None, version: str = None, description: str = None, creator: str = None, model_lib: str = None, model_data: str = None, model_meta: dict = None, features: str = None, table: str = None, components: List[Component] = None) ‑> ManualModel
-
일반 모델 정보를 수정합니다.
Args
- model: (
ManualModel
) 일반 모델 객체 - name: (str) (optional) 수정할 일반 모델 이름
- version: (str) (optional) 수정할 일반 모델 버전
- description: (optional) (str) 수정할 일반 모델 설명
- creator: (optional) (str) 수정할 일반 모델 계정명
- model_lib: (optional) (str) 수정할 일반 모델 라이브러리
- model_data: (optional) (str) 수정할 일반 모델 데이터
- model_meta: (optional) (dict) 수정할 모델 레지스트리에 등록된 메타정보(model.json)
- features: (optional) (str) 수정할 일반 모델에 사용된 피쳐
- table: (optional) (str) 수정할 일반 모델 테이블
- components: (optional) list(
Component
) 수정할 일반 모델 컴포넌트 리스트
Returns
- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- model_type: (str) ML모델 타입 (
automl
|manual
) - version: (str) ML모델 버전
- description: (str) ML모델 설명
- creator: (str) ML모델 생성 계정명
- status: (
MLModelStatus
) ML모델 상태 - model_meta: (dict) ML모델 메타정보
- components: list(
Component
) ML모델 컴포넌트 - table: (str) ML모델 테이블
- model_lib: (str) ML모델 라이브러리
- model_data: (str) ML모델 데이터
- features: (str) ML모델에 사용된 피쳐
- is_enabled: (bool) 활성상태 여부
Example
manual_model = ml_model_client.get_manual_model(name="my_manual_model", version="v1") manual_model = ml_model_client.update_manual_model( manual_model=manual_model, name="my_new_manual_model", description="updated manual model", model_data="/models/my_new_manual_model/v1/model.joblib", )
- model: (
def update_manual_model_components(self, manual_model: ManualModel, components: List[Component]) ‑> ManualModel
-
일반 모델의 컴포넌트 정보를 수정합니다.
Args
- model: (
ManualModel
) 일반 모델 객체 - components: list(
Component
) 수정할 컴포넌트 리스트
Returns
- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- model_type: (str) ML모델 타입 (
automl
|manual
) - version: (str) ML모델 버전
- description: (str) ML모델 설명
- creator: (str) ML모델 생성 계정명
- status: (
MLModelStatus
) ML모델 상태 - model_meta: (dict) ML모델 메타정보
- components: list(
Component
) ML모델 컴포넌트 - table: (str) ML모델 테이블
- model_lib: (str) ML모델 라이브러리
- model_data: (str) ML모델 데이터
- features: (str) ML모델에 사용된 피쳐
- is_enabled: (bool) 활성상태 여부
Example
component = component_client.get_component(name="test_component") manual_model = ml_model_client.get_manual_model(name="manual_test_model", version="v1") updated_manual_model = ml_model_client.update_manual_model_components( manual_model=manual_model, components=[component], ) no_component_manual_model = ml_model_client.update_manual_model_components( manual_model=manual_model, components=[], )
- model: (
def update_manual_model_meta(self, manual_model: ManualModel, model_meta: dict, partial_update: bool = False) ‑> ManualModel
-
일반 모델의 모델 메타 정보를 수정합니다.
Args
- model: (
ManualModel
) 일반 모델 객체 - model_meta: (dict) 수정할 모델 메타 정보
- partial_update: (optional) (dict) 기존 모델 메타에 덮어씌울지(True) 기존 모델 메타를 교체할지(False) 여부 (기본값:
False
)
Returns
- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- model_type: (str) ML모델 타입 (
automl
|manual
) - version: (str) ML모델 버전
- description: (str) ML모델 설명
- creator: (str) ML모델 생성 계정명
- status: (
MLModelStatus
) ML모델 상태 - model_meta: (dict) ML모델 메타정보
- components: list(
Component
) ML모델 컴포넌트 - table: (str) ML모델 테이블
- model_lib: (str) ML모델 라이브러리
- model_data: (str) ML모델 데이터
- features: (str) ML모델에 사용된 피쳐
- is_enabled: (bool) 활성상태 여부
Example
manual_model = ml_model_client.get_manual_model(name="my_manual_model", version="v1") manual_model = ml_model_client.update_manual_model_meta( manual_model=manual_model, model_meta={ "model_lib": "xgboost", "model_lib_version": "1.2.0", }, partial_update = True ) manual_model_without_meta = ml_model_client.update_manual_model_meta( manual_model=manual_model, model_meta={} )
- model: (
def update_model_deployment(self, model_deployment: ManualModel, name: str = None, version: str = None, description: str = None, creator: str = None, model_lib: str = None, model_data: str = None, model_meta: dict = None, features: str = None, table: str = None, components: List[Component] = None) ‑> ManualModel
-
일반 모델 배포를 수정합니다. 위 메소드는 update_manual_model과 같은 기능을 수행합니다.
Args
- model_deployment: (
ManualModel
) 일반 모델 객체 - name: (str) (optional) 수정할 일반 모델 이름
- version: (str) (optional) 수정할 일반 모델 버전
- description: (optional) (str) 수정할 일반 모델 설명
- creator: (optional) (str) 수정할 일반 모델 계정명
- model_lib: (optional) (str) 수정할 일반 모델 라이브러리
- model_data: (optional) (str) 수정할 일반 모델 데이터
- model_meta: (optional) (dict) 수정할 모델 레지스트리에 등록된 메타정보(model.json)
- features: (optional) (str) 수정할 일반 모델에 사용된 피쳐
- table: (optional) (str) 수정할 일반 모델 테이블
- components: (optional) list(
Component
) 수정할 일반 모델 컴포넌트 리스트
Returns
- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- model_type: (str) ML모델 타입 (
automl
|manual
) - version: (str) ML모델 버전
- description: (str) ML모델 설명
- creator: (str) ML모델 생성 계정명
- status: (
MLModelStatus
) ML모델 상태 - model_meta: (dict) ML모델 메타정보
- components: list(
Component
) ML모델 컴포넌트 - table: (str) ML모델 테이블
- model_lib: (str) ML모델 라이브러리
- model_data: (str) ML모델 데이터
- features: (str) ML모델에 사용된 피쳐
- is_enabled: (bool) 활성상태 여부
Example
model_deployment = ml_model_client.get_model_deployment(name="my_manual_model", version="v1") model_deployment = ml_model_client.update_model_deployment( model_deployment=model_deployment, name="my_new_manual_model_deployment", description="updated manual model deployment", model_data="/models/my_new_manual_model/v1/model.joblib", )
- model_deployment: (
def update_model_deployment_components(self, model_deployment: ManualModel, components: List[Component]) ‑> ManualModel
-
일반 모델 배포의 컴포넌트 정보를 수정합니다. 위 메소드는 update_manual_model_components와 같은 기능을 수행합니다.
Args
- model_deployment: (
ManualModel
) 일반 모델 객체 - components: list(
Component
) 수정할 컴포넌트 리스트
Returns
- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- model_type: (str) ML모델 타입 (
automl
|manual
) - version: (str) ML모델 버전
- description: (str) ML모델 설명
- creator: (str) ML모델 생성 계정명
- status: (
MLModelStatus
) ML모델 상태 - model_meta: (dict) ML모델 메타정보
- components: list(
Component
) ML모델 컴포넌트 - table: (str) ML모델 테이블
- model_lib: (str) ML모델 라이브러리
- model_data: (str) ML모델 데이터
- features: (str) ML모델에 사용된 피쳐
- is_enabled: (bool) 활성상태 여부
Example
component = component_client.get_component(name="test_component") model_deployment = ml_model_client.get_model_deployment(name="manual_test_model", version="v1") updated_manual_model = ml_model_client.update_model_deployment_components( model_deployment=model_deployment, components=[component], ) no_component_manual_model = ml_model_client.update_model_deployment_components( model_deployment=model_deployment, components=[], )
- model_deployment: (
def update_model_deployment_meta(self, model_deployment: ManualModel, model_meta: dict, partial_update: bool = False) ‑> ManualModel
-
일반 모델 배포의 모델 메타 정보를 수정합니다. 위 메소드는 update_manual_model_meta와 같은 기능을 수행합니다.
Args
- model_deployment: (
ManualModel
) 일반 모델 객체 - model_meta: (dict) 수정할 모델 메타 정보
- partial_update: (optional) (dict) 기존 모델 메타에 덮어씌울지(True) 기존 모델 메타를 교체할지(False) 여부 (기본값:
False
)
Returns
- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- model_type: (str) ML모델 타입 (
automl
|manual
) - version: (str) ML모델 버전
- description: (str) ML모델 설명
- creator: (str) ML모델 생성 계정명
- status: (
MLModelStatus
) ML모델 상태 - model_meta: (dict) ML모델 메타정보
- components: list(
Component
) ML모델 컴포넌트 - table: (str) ML모델 테이블
- model_lib: (str) ML모델 라이브러리
- model_data: (str) ML모델 데이터
- features: (str) ML모델에 사용된 피쳐
- is_enabled: (bool) 활성상태 여부
Example
model_deployment = ml_model_client.get_model_deployment(name="my_manual_model", version="v1") model_deployment = ml_model_client.update_model_deployment_meta( model_deployment=model_deployment, model_meta={ "model_lib": "xgboost", "model_lib_version": "1.2.0", }, partial_update = True ) manual_model_deployment_without_meta = ml_model_client.update_manual_model_meta( model_deployment=model_deployment, model_meta={} )
- model_deployment: (
- env: (
class MLModelStatus (value, names=None, *, module=None, qualname=None, type=None, start=1)
-
An enumeration.
Ancestors
- enum.Enum
Class variables
var AUTOML_DONE
var AUTOML_FAILED
var AUTOML_TRAINING
var IN_USE
var NOT_IN_USE
var UNKNOWN
class ManualModel (**kwargs)
-
일반 모델 클래스이자, 모델 배포 객체입니다. 위 객체를 생성해 배치 추론 테이블 또는 모델 레지스트리에 등록된 모델 아티팩트를 서비스 가능하도록 배포합니다. 배포된 모델만 버킷에 연결하여 서비스 가능합니다.
Args
- kwargs
- id: (int) ML모델 고유 ID
- name: (str) ML모델 이름
- model_type: (str) ML모델 타입 (
automl
|manual
) - version: (str) ML모델 버전
- description: (str) ML모델 설명
- creator: (str) ML모델 생성 계정명
- status: (
MLModelStatus
) ML모델 상태 - model_meta: (dict) ML모델 메타정보
- components: list(
Component
) ML모델 컴포넌트 리스트 - table: (str) ML모델 테이블
- model_lib: (str) ML모델 라이브러리
- model_data: (str) ML모델 데이터
- features: (str) ML모델에 사용된 피쳐
- is_enabled: (bool) 활성상태 여부
Returns
Ancestors
- kwargs