Slide 46
Slide 46 text
46 Copyright © 2024, Oracle and/or its affiliates
OML4Py Metrics
OML4Py メトリック
OML4Pyにおいて、機械学習モデルのパフォーマンスの評価ができるメトリックが計算できる関数を含むメトリクスモジュール
が使用できるようになりました。
例: confusion_matrix関数を用いて、混同行列を計算
oml.metrics.metric_functionクラスの属性およびメソッドの詳細は、help(oml.metrics.metric_function)を実行す
るか、Oracle Machine Learning for Python APIリファレンスを参照してください。
例えば、confusion_matrixについて参照するには、help(oml.metrics.confusion_matrix)を実行します。
2024/12
Documentation: OML4Py Metrics
Serverless
import oml
import pandas as pd
from oml.metrics import confusion_matrix
y_true = [1, 0, 1, 0, 1, 1, 0, 1, 1, 0] --実際の値
y_pred = [1, 1, 1, 0, 0, 1, 1, 0, 0, 0] --予測値
sample_weight = [1, 2, 1, 1, 1, 1, 1, 3, 1, 1] –-各サンプルの重み
pdf = pd.DataFrame({'y_true': y_true 'y_pred': y_pred, 'sample_weight': sample_weight}) --モデル評価のために実際の値、予
測値、サンプルの重みを含んだデータフレーム
df = oml.create(pdf, ‘test_class’) --モデル評価に使用するために、OMLで使用されるデータフレーム
confusion_matrix(df, 'y_true', 'y_pred', sample_weight='sample_weight') --混同行列の計算