このgithubのサンプルコード。各種metricを設定して可視化できる・・が、閾値の設定方法が書かれていなかったので、メモ。
https://github.com/IBM/ibm-watsonx-gov/blob/samples/notebooks/python_sdk/model_insights/Model%20Insights.ipynb
各種メトリックススは以下で設定されているが、
metrics = [
AveragePrecisionMetric(),
ContextRelevanceMetric(),
FaithfulnessMetric(),
HitRateMetric(),
NDCGMetric(),
ReciprocalRankMetric(),
RetrievalPrecisionMetric(),
UnsuccessfulRequestsMetric(),
]
閾値は以下のように設定できる。
他のメトリックも同様に設定できる模様。
metrics = [
ContextRelevanceMetric(method="sentence_bert_mini_lm",thresholds=[MetricThreshold(type="lower_limit", value=0.1)]),
]
なお、初期値はtype=lower_limit, value=0.8になっている。
upper_limitも設定できる。