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 / 評価
一連の scorer とデータセットを含む評価を設定します。
evaluation.evaluate(model) を呼び出すと、データセットの各行がモデルに渡されます。このとき、
データセットの列名が model.predict の引数名に対応付けられます。
その後、すべての scorer が呼び出され、結果が weave に保存されます。
Example
// サンプルをデータセットに収集する
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 評価<R, E, M>(parameters): 評価<R, E, M>
型パラメーター
| 名 | タイプ |
|---|
R | extends DatasetRow |
E | extends DatasetRow |
M | M |
| 名 | タイプ |
|---|
parameters | EvaluationParameters<R, E, M> |
評価<R, E, M>
WeaveObject.constructor
evaluation.ts:148
プロパティ
• 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
Methods
▸ 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