メインコンテンツへスキップ
weave / EvaluationLogger EvaluationLogger を使うと、予測とスコアを段階的にログできます。 事前にデータセットを用意してバッチ処理を行う必要がある従来の Evaluation クラスとは異なり、 EvaluationLogger では、予測が発生したタイミングで、柔軟にスコアリングしながらログできます。 Example
const ev = new EvaluationLogger({name: 'my-eval', dataset: 'my-dataset'});

for (const example of streamingData) {
  const output = await myModel.predict(example);
  const pred = ev.logPrediction(example, output);

  if (shouldScore(output)) {
    pred.logScore("accuracy", calculateAccuracy(output));
  }
  pred.finish();
}

await ev.logSummary();

目次

コンストラクター

メソッド

コンストラクター

コンストラクター

new EvaluationLogger(options): EvaluationLogger

パラメーター

タイプ
optionsEvaluationLoggerOptions

戻り値

EvaluationLogger

定義元

evaluationLogger.ts:554

メソッド

logPrediction

logPrediction(inputs, output): ScoreLogger 入力と出力を含む予測をログする (同期バージョン) 。 predict_and_score call (子 predict call を含む) を作成します。 スコアを追加するための ScoreLogger をすぐに返します。 この method は ScoreLogger を同期的に返します。初期化が完了すると、 ScoreLogger に対する操作 (logScorefinish) はキューに追加され、実行されます。

パラメーター

タイプ
inputsRecord<string, any>
outputany

戻り値

ScoreLogger
// ファイア・アンド・フォーゲット方式
const scoreLogger = evalLogger.logPrediction({input: 'test'}, 'output');
scoreLogger.logScore('accuracy', 0.95);
scoreLogger.finish();
await evalLogger.logSummary(); // すべての完了を待機

定義元

evaluationLogger.ts:641

logPredictionAsync

logPredictionAsync(inputs, output): Promise<ScoreLogger> 入力と出力とともに予測をログする (非同期版) 。 logPrediction() と同様ですが、 予測 call が完全に初期化された時点で解決する Promise を返します。 続行する前に初期化の完了を await する必要がある場合は、これを使用します。

パラメーター

タイプ
inputsRecord<string, any>
outputany

戻り値

Promise<ScoreLogger>
// Awaitableスタイル
const scoreLogger = await evalLogger.logPredictionAsync({input: 'test'}, 'output');
await scoreLogger.logScore('accuracy', 0.95);
await scoreLogger.finish();

定義元

evaluationLogger.ts:666

logSummary

logSummary(summary?): Promise<void> サマリーをログし、評価を完了します。 summarize call を作成し、evaluate call を完了します。 この method は await なしでも呼び出せます (fire-and-forget) が、内部的には 保留中のすべての operation が完了するまで待機します。

パラメーター

タイプ
summary?Record<string, any>

戻り値

Promise<void>

定義元

evaluationLogger.ts:767