Documentation Index
Fetch the complete documentation index at: https://translations.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
weave / Evaluation
Scorer 집합과 데이터셋을 포함하는 평가를 구성합니다.
evaluation.evaluate(model)을 호출하면 데이터셋의 행들을 model에 전달하면서,
데이터셋의 열 이름을 model.predict의 인자 이름과 매칭합니다.
그런 다음 모든 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 });
타입 매개변수
| 이름 | 타입 |
|---|
R | extends DatasetRow |
E | extends DatasetRow |
M | M |
생성자
• new Evaluation<R, E, M>(parameters): Evaluation<R, E, M>
| 이름 | 타입 |
|---|
R | extends DatasetRow |
E | extends DatasetRow |
M | M |
| 이름 | 타입 |
|---|
parameters | EvaluationParameters<R, E, M> |
Evaluation<R, E, M>
WeaveObject.constructor
정의 위치
evaluation.ts:148
__savedRef
• Optional __savedRef: ObjectRef | Promise<ObjectRef>
WeaveObject.__savedRef
정의 위치
weaveObject.ts:73
접근자
• get description(): undefined | string
undefined | string
WeaveObject.description
정의 위치
weaveObject.ts:100
• get name(): string
string
WeaveObject.name
정의 위치
weaveObject.ts:96
메서드
▸ evaluate(«destructured»): Promise<Record<string, any>>
| 이름 | 타입 | 기본값 |
|---|
«destructured» | Object | undefined |
› maxConcurrency? | number | 5 |
› model | WeaveCallable<(…args: [{ datasetRow: R }]) => Promise<M>> | undefined |
› nTrials? | number | 1 |
Promise<Record<string, any>>
evaluation.ts:163
▸ predictAndScore(«destructured»): Promise<{ model_latency: number = modelLatency; model_output: any = modelOutput; model_success: boolean = !modelError; scores: { [key: string]: any; } }>
| 이름 | 타입 |
|---|
«destructured» | Object |
› columnMapping? | ColumnMapping<R, E> |
› example | R |
› model | WeaveCallable<(…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(): Object
Object
WeaveObject.saveAttrs
weaveObject.ts:77