Eureka Engineering
Published in

Eureka Engineering

ML System Monitoring Tips

目次

はじめに

対象読者

ML System Monitoringについて

ML System Montitoring Overview

Software system health

Data quality and intergrity/ML model quality and relevance

Business KPI

ML Monitoring Tool(shapash/evidently) 紹介

shapash

デモサイトのスクリーンショット

evidently

ML Monitoring Tool(shapash/evidently) 導入Tips

shapash

対応モデル形式でない場合にも、shapashが読み込めるようにする

def check_model(model):
"""
Check if model has a predict_proba method is a one column dataframe of integer or float
and if y_pred index matches x_init index
Parameters
----------
model: model object
model used to check the different values of target estimate predict or predict_proba
Returns
-------
string:
'regression' or 'classification' according to the attributes of the model
"""
_classes = None
if hasattr(model, 'predict'):
if hasattr(model, 'predict_proba') or \
any(hasattr(model, attrib) for attrib in ['classes_', '_classes']):
if hasattr(model, '_classes'): _classes = model._classes
if hasattr(model, 'classes_'): _classes = model.classes_
if isinstance(_classes, np.ndarray): _classes = _classes.tolist()
if hasattr(model, 'predict_proba') and _classes == []: _classes = [0, 1] # catboost binary
if hasattr(model, 'predict_proba') and _classes is None:
raise ValueError(
"No attribute _classes, classification model not supported"
)
if _classes not in (None, []):
return 'classification', _classes
else:
return 'regression', None
else:
raise ValueError(
"No method predict in the specified model. Please, check model parameter"
)
ValueError: 
Type of contributions parameter specified is not compatible with
regression model.
Please check model and contributions parameters.
booster._classes = [0, 1]

LightGBM Boosterのmodelについて、学習後のモデルについてレポートを出力する

pip install shapash[report]

evidently

学習に使用したデータとオンラインデータのドリフトを検知する

bcancer_data_and_target_drift_dashboard = Dashboard(tabs=[DataDriftTab(verbose_level=0), 
CatTargetDriftTab(verbose_level=0)])

終わりに

参考文献

--

--

Learn about Eureka’s engineering efforts, product developments and more.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
TAKASHI NARIKAWA

Site Reliablity Engineer in Tokyo. SRE/devops/Go/AWS/Terraform/Kubernetes/Docker