메인 콘텐츠로 건너뛰기
weave / Evaluation scorer 집합과 데이터셋을 포함하는 Evaluation을 설정합니다. evaluation.evaluate(model)을 호출하면 데이터셋의 각 행이 모델에 전달되며, 데이터셋의 column 이름이 model.predict의 argument 이름에 맞게 매핑됩니다. 그런 다음 모든 scorer를 호출하고 결과를 weave에 저장합니다. 예시
// 예시를 데이터셋에 수집합니다
const dataset = new weave.Dataset({
  id: 'my-dataset',
  rows: [
    { question: 'What is the capital of France?', expected: 'Paris' },
    { question: 'Who wrote "To Kill a Mockingbird"?', expected: 'Harper Lee' },
    { question: 'What is the square root of 64?', expected: '8' },
  ],
});

// 맞춤형 채점 함수를 정의합니다
const scoringFunction = weave.op(function isEqual({ modelOutput, datasetRow }) {
  return modelOutput == datasetRow.expected;
});

// 평가할 함수를 정의합니다
const model = weave.op(async function alwaysParisModel({ question }) {
  return 'Paris';
});

// 평가를 시작합니다
const evaluation = new weave.Evaluation({
  id: 'my-evaluation',
  dataset: dataset,
  scorers: [scoringFunction],
});

const results = await evaluation.evaluate({ model });

타입 매개변수

이름유형
Rextends DatasetRow
Eextends DatasetRow
MM

계층

목차

생성자

속성

접근자

메서드

생성자

생성자

new Evaluation<R, E, M>(parameters): Evaluation<R, E, M>

타입 매개변수

이름유형
Rextends DatasetRow
Eextends DatasetRow
MM

매개변수

이름유형
parametersEvaluationParameters<R, E, M>

반환값

Evaluation<R, E, M>

오버라이드

WeaveObject.constructor

정의 위치

evaluation.ts:148

속성

__savedRef

선택 __savedRef: ObjectRef | Promise<ObjectRef>

상속 출처

WeaveObject.__savedRef

정의 위치

weaveObject.ts:73

접근자

설명

get 설명(): undefined | string

반환값

undefined | string

상속 출처

WeaveObject.description

정의 위치

weaveObject.ts:100

이름

get name(): string

반환값

string

상속 출처

WeaveObject.name

정의 위치

weaveObject.ts:96

메서드

evaluate

evaluate(«destructured»): Promise<Record<string, any>>

매개변수

이름유형기본값
«destructured»객체undefined
› maxConcurrency?number5
› modelWeaveCallable<(…args: [{ datasetRow: R }]) => Promise<M>>undefined
› nTrials?number1

반환값

Promise<Record<string, any>>

정의 위치

evaluation.ts:163

predictAndScore

predictAndScore(«destructured»): Promise<{ model_latency: number = modelLatency; model_output: any = modelOutput; model_success: boolean = !modelError; scores: { [key: string]: any; } }>

매개변수

이름유형
«destructured»객체
› columnMapping?ColumnMapping<R, E>
› exampleR
› modelWeaveCallable<(…args: [{ datasetRow: E }]) => Promise<M>>

반환값

Promise<{ model_latency: number = modelLatency; model_output: any = modelOutput; model_success: boolean = !modelError; scores: { [key: string]: any; } }>

정의 위치

evaluation.ts:231

saveAttrs

saveAttrs(): 객체

반환값

객체

상속 출처

WeaveObject.saveAttrs

정의 위치

weaveObject.ts:77