Module sktmls.models.automl.automl_prediction
Classes
class AutoMLBatchPrediction (**kwargs)-
AutoML 배치 예측 작업 클래스입니다.
Args
- id: (int) 예측 작업 ID.
- channel: (string) 전송 채널 (
EMAIL|TOS|EDD|YE) - status: (string) 예측 진행 상태 (
RUNNING|DONE|ERROR_BATCH_PREDICT) - created_at: (datetime) 예측 시작 시간
- updated_at: (datetime) 예측 완료 시간
Returns
class AutoMLBatchPredictionClient (env: MLSENV = None, runtime_env: MLSRuntimeENV = None, username: str = None, password: str = None)-
AutoML 배치 예측 관련 기능을 제공하는 클라이언트입니다.
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
client = AutoMLBatchPredictionClient(env=MLSENV.STG, runtime_env=MLSRuntimeENV.YE, username="mls_account", password="mls_password")Ancestors
Methods
def predict(self, model: AutoMLModel, export_channel_config: Union[EmailChannelConfig, TOSChannelConfig, EDDChannelConfig, YEChannelConfig], score_export_option: ScoreExportOption = None, period: str = None, custom_feature_source_config: CustomFeatureSourceConfig = None) ‑> AutoMLBatchPrediction-
배치 예측을 수행합니다.
Args
- model: (
AutoMLModel) 학습 모델 - export_channel_config: (
ExportChannelConfig) 예측 결과 전송 채널 설정 - score_export_option: (
ScoreExportOption) 스코어 전송 옵션 (스코어 기반 고객 타겟팅 문제의 경우 필수) - period: (str) 예측에 적용할 피쳐 스토어 기준연월 (형식: YYYYMM, 만약 입력하지 않을 경우 가장 최신의 기준연월을 적용)
- custom_feature_source_config: (
CustomFeatureSourceConfig) 예측에 적용할 커스텀 피쳐 데이터 파일 설정 (커스텀 피쳐를 사용한 모델의 경우 필수)
Returns
Example
client = AutoMLBatchPredictionClient(env=MLSENV.STG, runtime_env=MLSRuntimeENV.YE, username="mls_account", password="mls_password") model = model_client.get_automl_model(id=72) export_channel_config = YEChannelConfig(username="x1234567", table="triple_a_test") score_export_option = ScoreExportOption(sort=True, target_limit=100) custom_feature_config = CustomFeatureSourceConfig("ye", "my_custom_feature_table") prediction = client.predict( model=model, export_channel_config=export_channel_config, score_export_option=score_export_option, custom_feature_source_config=custom_feature_config, ) - model: (
- env: (
class AutoMLPredictionError (*args, **kwargs)-
Common base class for all non-exit exceptions.
Ancestors
- builtins.Exception
- builtins.BaseException
class CustomFeatureSourceConfig (source_type: str, source_path: str)-
예측 시 추가로 사용할 사용자 데이터 설정입니다(사용자 피쳐를 추가로 적용한 모델의 경우 필수).
Args
- source_type: (str) 데이터 타입 (
csv (deprecated)|edd2 (deprecated)|ye(deprecated)|file|table). - source_path: (str) 데이터의 이름 또는 테이블 경로.
- file: 파일 이름 (ex. test.csv)
- table: BigQuery 테이블의 경로 (ex. sktaic-datahub.x1234567.test)
Example
config = LabelDataConf(source_type="table", source_path="sktaic-datahub.x1234567.test") - source_type: (str) 데이터 타입 (
class EDDChannelConfig (username: str, database: str, table: str)-
EDD로 예측 결과를 전송하기 위한 설정 값입니다.
Args
- username: (str) EDD 계정 (ex. g1234567)
- database: (str) 데이터베이스 이름
- table: (str) 테이블 이름
Returns
Example
config = EDDChannelConfig("g1234567", "test_db", "test_table")Ancestors
Class variables
var param_name
class EmailChannelConfig (email: str)-
이메일로 예측 결과를 전송하기 위한 설정 값입니다.
Args
- email: (str) 전송받을 이메일 경로 (@sktelecom.com 또는 @sk.com 도메인만 지원)
Returns
Example
config = EmailChannelConfig("test@sktelecom.com")Ancestors
Class variables
var param_name
class ExportChannelConfig (channel: str)-
Subclasses
class ScoreExportOption (sort: bool, target_limit: int = None)-
스코어 출력 옵션 값입니다(스코어 기반 고객 타겟팅 문제만 지원).
Args
- sort: (bool) 결과 정렬 여부
- target_limit: (int) 총 출력 개수 (sort = True 인 경우 필수)
Returns
Example
score_export_option = ScoreExportOption(sort=True, target_limit=1000000)Methods
def value(self) ‑> Dict[str, Any]
class TOSChannelConfig (employee_num: str, target_group_name: str)-
TOS로 예측 결과를 전송하기 위한 설정 값입니다.
Args
- employee_num: (str) 사번 (TOS 계정)
- target_group_name: (str) 원하는 대상군 명
Returns
Example
config = TOSChannelConfig("test@sktelecom.com")Ancestors
Class variables
var param_name
class YEChannelConfig (username: str, table: str)-
YE로 예측 결과를 전송하기 위한 설정 값입니다.
Args
- username: (str) YE 계정 (ex. "x1234567") 또는 BigQuery 데이터셋 이름 ("test_dataset")
- table: (str) 테이블 이름 (ex. "test_table")
Returns
Example
config = YEChannelConfig("x1234567", "test_table")Ancestors
Class variables
var param_name