메인 콘텐츠로 건너뛰기
weave / EvaluationLogger EvaluationLogger를 사용하면 예측과 점수를 점진적으로 로깅할 수 있습니다. 사전에 데이터셋을 준비하고 일괄 처리해야 하는 기존 Evaluation 클래스와 달리, EvaluationLogger를 사용하면 예측이 발생하는 대로 유연하게 점수를 매기며 로깅할 수 있습니다. 예시
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 call을 포함하는 predict_and_score call을 생성합니다. 점수를 추가할 수 있도록 즉시 ScoreLogger를 반환합니다. 이 방법은 ScoreLogger를 동기적으로 반환합니다. ScoreLogger에 대한 오퍼레이션(logScore, finish)은 큐에 들어가며 초기화가 완료되면 실행됩니다.

매개변수

이름유형
inputsRecord<string, any>
outputany

반환값

ScoreLogger 예시
// Fire-and-forget 방식
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()과 유사하지만 prediction call이 완전히 초기화되면 resolve되는 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> summary를 기록하고 evaluation을 마무리합니다. summarize call을 생성하고 evaluate call을 마무리합니다. 이 방법은 await 없이도 호출할 수 있지만(fire-and-forget), 내부적으로는 대기 중인 모든 오퍼레이션이 완료될 때까지 기다립니다.

매개변수

이름유형
summary?Record<string, any>

반환값

Promise<void>

정의 위치

evaluationLogger.ts:767