Documentation Index
Fetch the complete documentation index at: https://wb-21fd5541-john-wbdocs-2044-rename-serverless-products.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
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
| 名 | タイプ |
|---|
options | EvaluationLoggerOptions |
EvaluationLogger
evaluationLogger.ts:554
メソッド
▸ logPrediction(inputs, output): ScoreLogger
入力と出力を含む予測をログする (同期バージョン) 。
predict_and_score call (子 predict call を含む) を作成します。
スコアを追加するための ScoreLogger をすぐに返します。
この method は ScoreLogger を同期的に返します。初期化が完了すると、
ScoreLogger に対する操作 (logScore、finish) はキューに追加され、実行されます。
| 名 | タイプ |
|---|
inputs | Record<string, any> |
output | any |
ScoreLogger
例
// ファイア・アンド・フォーゲット方式
const scoreLogger = evalLogger.logPrediction({input: 'test'}, 'output');
scoreLogger.logScore('accuracy', 0.95);
scoreLogger.finish();
await evalLogger.logSummary(); // すべての完了を待機
evaluationLogger.ts:641
▸ logPredictionAsync(inputs, output): Promise<ScoreLogger>
入力と出力とともに予測をログする (非同期版) 。
logPrediction() と同様ですが、
予測 call が完全に初期化された時点で解決する Promise を返します。
続行する前に初期化の完了を await する必要がある場合は、これを使用します。
| 名 | タイプ |
|---|
inputs | Record<string, any> |
output | any |
Promise<ScoreLogger>
例
// Awaitableスタイル
const scoreLogger = await evalLogger.logPredictionAsync({input: 'test'}, 'output');
await scoreLogger.logScore('accuracy', 0.95);
await scoreLogger.finish();
evaluationLogger.ts:666
▸ logSummary(summary?): Promise<void>
サマリーをログし、評価を完了します。
summarize call を作成し、evaluate call を完了します。
この method は await なしでも呼び出せます (fire-and-forget) が、内部的には
保留中のすべての operation が完了するまで待機します。
| 名 | タイプ |
|---|
summary? | Record<string, any> |
Promise<void>
evaluationLogger.ts:767