memento-mcp-server 1.15.0 → 1.16.0-a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/domains/relation/tools/visualize-relations-tool.d.ts +2 -2
- package/dist/infrastructure/database/database/migration/migrations/009-quality-assurance-schema.d.ts +60 -0
- package/dist/infrastructure/database/database/migration/migrations/009-quality-assurance-schema.d.ts.map +1 -0
- package/dist/infrastructure/database/database/migration/migrations/009-quality-assurance-schema.js +276 -0
- package/dist/infrastructure/database/database/migration/migrations/009-quality-assurance-schema.js.map +1 -0
- package/dist/infrastructure/database/database/migration/migrations/009-quality-assurance-schema.sql +128 -0
- package/dist/infrastructure/scheduler/batch-scheduler.d.ts +17 -0
- package/dist/infrastructure/scheduler/batch-scheduler.d.ts.map +1 -1
- package/dist/infrastructure/scheduler/batch-scheduler.js +124 -0
- package/dist/infrastructure/scheduler/batch-scheduler.js.map +1 -1
- package/dist/infrastructure/scheduler/jobs/quality-measurement-batch-job.d.ts +108 -0
- package/dist/infrastructure/scheduler/jobs/quality-measurement-batch-job.d.ts.map +1 -0
- package/dist/infrastructure/scheduler/jobs/quality-measurement-batch-job.js +184 -0
- package/dist/infrastructure/scheduler/jobs/quality-measurement-batch-job.js.map +1 -0
- package/dist/server/http-server.d.ts.map +1 -1
- package/dist/server/http-server.js +3 -0
- package/dist/server/http-server.js.map +1 -1
- package/dist/server/routes/quality.routes.d.ts +14 -0
- package/dist/server/routes/quality.routes.d.ts.map +1 -0
- package/dist/server/routes/quality.routes.js +460 -0
- package/dist/server/routes/quality.routes.js.map +1 -0
- package/dist/services/quality-assurance/quality-assurance-service.d.ts +207 -0
- package/dist/services/quality-assurance/quality-assurance-service.d.ts.map +1 -0
- package/dist/services/quality-assurance/quality-assurance-service.js +247 -0
- package/dist/services/quality-assurance/quality-assurance-service.js.map +1 -0
- package/dist/services/quality-assurance/quality-evaluator.d.ts +163 -0
- package/dist/services/quality-assurance/quality-evaluator.d.ts.map +1 -0
- package/dist/services/quality-assurance/quality-evaluator.js +256 -0
- package/dist/services/quality-assurance/quality-evaluator.js.map +1 -0
- package/dist/services/quality-assurance/quality-metrics-collector.d.ts +219 -0
- package/dist/services/quality-assurance/quality-metrics-collector.d.ts.map +1 -0
- package/dist/services/quality-assurance/quality-metrics-collector.js +725 -0
- package/dist/services/quality-assurance/quality-metrics-collector.js.map +1 -0
- package/dist/services/quality-assurance/quality-recorder.d.ts +108 -0
- package/dist/services/quality-assurance/quality-recorder.d.ts.map +1 -0
- package/dist/services/quality-assurance/quality-recorder.js +281 -0
- package/dist/services/quality-assurance/quality-recorder.js.map +1 -0
- package/dist/services/quality-assurance/quality-reporter.d.ts +189 -0
- package/dist/services/quality-assurance/quality-reporter.d.ts.map +1 -0
- package/dist/services/quality-assurance/quality-reporter.js +558 -0
- package/dist/services/quality-assurance/quality-reporter.js.map +1 -0
- package/dist/services/quality-assurance/quality-threshold-manager.d.ts +102 -0
- package/dist/services/quality-assurance/quality-threshold-manager.d.ts.map +1 -0
- package/dist/services/quality-assurance/quality-threshold-manager.js +252 -0
- package/dist/services/quality-assurance/quality-threshold-manager.js.map +1 -0
- package/dist/test/helpers/search-quality-metrics.d.ts +96 -0
- package/dist/test/helpers/search-quality-metrics.d.ts.map +1 -0
- package/dist/test/helpers/search-quality-metrics.js +185 -0
- package/dist/test/helpers/search-quality-metrics.js.map +1 -0
- package/dist/test/helpers/vector-search-quality-metrics.d.ts +1287 -0
- package/dist/test/helpers/vector-search-quality-metrics.d.ts.map +1 -0
- package/dist/test/helpers/vector-search-quality-metrics.js +2214 -0
- package/dist/test/helpers/vector-search-quality-metrics.js.map +1 -0
- package/package.json +4 -1
- package/scripts/quality-report.ts +166 -0
- package/scripts/quality-thresholds.ts +279 -0
|
@@ -0,0 +1,1287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 벡터 검색 품질 검증 헬퍼
|
|
3
|
+
* 벡터 검색 결과 순서 보존 검증 및 품질 지표 비교
|
|
4
|
+
* Consolidation 점수 반영 전/후 비교를 위한 지표 계산
|
|
5
|
+
*/
|
|
6
|
+
import type { SearchResult, GroundTruth } from './search-quality-metrics.js';
|
|
7
|
+
import type { HybridSearchResult } from '../../domains/search/algorithms/hybrid-search-engine.js';
|
|
8
|
+
/**
|
|
9
|
+
* 벡터-only 검색 결과와 Consolidation 반영 후 검색 결과 쌍
|
|
10
|
+
*/
|
|
11
|
+
export interface SearchResultPair {
|
|
12
|
+
/**
|
|
13
|
+
* 벡터 유사도만 사용한 검색 결과 (점수 순으로 정렬됨)
|
|
14
|
+
*/
|
|
15
|
+
vectorOnly: SearchResult[];
|
|
16
|
+
/**
|
|
17
|
+
* Consolidation 점수 반영 후 검색 결과 (점수 순으로 정렬됨)
|
|
18
|
+
*/
|
|
19
|
+
withConsolidation: SearchResult[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 순서 보존 지표
|
|
23
|
+
* 벡터-only 결과와 Consolidation 반영 후 결과 간의 순서 일치도를 측정
|
|
24
|
+
*/
|
|
25
|
+
export interface OrderPreservationMetrics {
|
|
26
|
+
/**
|
|
27
|
+
* Kendall's Tau 순서 일치도 (-1 ~ 1)
|
|
28
|
+
* 1에 가까울수록 순서가 일치함
|
|
29
|
+
*/
|
|
30
|
+
kendallTau: number;
|
|
31
|
+
/**
|
|
32
|
+
* Spearman's Rho 순서 일치도 (-1 ~ 1)
|
|
33
|
+
* 1에 가까울수록 순서가 일치함 (선택적)
|
|
34
|
+
*/
|
|
35
|
+
spearmanRho?: number;
|
|
36
|
+
/**
|
|
37
|
+
* 상위 K개 결과 유지율 (0 ~ 1)
|
|
38
|
+
* 벡터-only 상위 K개가 Consolidation 반영 후에도 상위에 유지되는 비율
|
|
39
|
+
*/
|
|
40
|
+
topKRetention: Record<number, number>;
|
|
41
|
+
/**
|
|
42
|
+
* Top10 유지율 (0 ~ 1)
|
|
43
|
+
* 벡터-only 상위 10개가 Consolidation 반영 후에도 상위에 유지되는 비율
|
|
44
|
+
*/
|
|
45
|
+
top10Retention: number;
|
|
46
|
+
/**
|
|
47
|
+
* Top5 유지율 (0 ~ 1)
|
|
48
|
+
* 벡터-only 상위 5개가 Consolidation 반영 후에도 상위에 유지되는 비율
|
|
49
|
+
*/
|
|
50
|
+
top5Retention: number;
|
|
51
|
+
/**
|
|
52
|
+
* 전체 결과 수
|
|
53
|
+
*/
|
|
54
|
+
totalResults: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* 순서 보존 검증 결과 리포트
|
|
58
|
+
*/
|
|
59
|
+
export interface OrderPreservationReport {
|
|
60
|
+
/**
|
|
61
|
+
* 리포트 생성 시간 (ISO 8601 형식)
|
|
62
|
+
*/
|
|
63
|
+
timestamp?: string;
|
|
64
|
+
/**
|
|
65
|
+
* 순서 보존 지표
|
|
66
|
+
*/
|
|
67
|
+
metrics: OrderPreservationMetrics;
|
|
68
|
+
/**
|
|
69
|
+
* 검증 통과 여부
|
|
70
|
+
*/
|
|
71
|
+
passed: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* 검증 실패 사유 (통과 시 undefined)
|
|
74
|
+
*/
|
|
75
|
+
failureReasons?: string[];
|
|
76
|
+
/**
|
|
77
|
+
* 상세 검증 결과
|
|
78
|
+
*/
|
|
79
|
+
validation: {
|
|
80
|
+
/**
|
|
81
|
+
* Kendall's Tau >= 0.7 검증
|
|
82
|
+
*/
|
|
83
|
+
kendallTauValid: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Top10 유지율 >= 80% 검증
|
|
86
|
+
*/
|
|
87
|
+
top10RetentionValid: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Top5 유지율 >= 90% 검증
|
|
90
|
+
*/
|
|
91
|
+
top5RetentionValid: boolean;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* 검증 임계값 (선택적)
|
|
95
|
+
*/
|
|
96
|
+
thresholds?: {
|
|
97
|
+
kendallTauThreshold?: number;
|
|
98
|
+
top10RetentionThreshold?: number;
|
|
99
|
+
top5RetentionThreshold?: number;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Kendall's Tau-b 순서 일치도 계산
|
|
104
|
+
* 두 순서 간의 순위 상관관계를 측정 (-1 ~ 1)
|
|
105
|
+
*
|
|
106
|
+
* Tau-b는 동점(tie)을 처리하는 버전으로, 검색 결과에서 동일 점수를 가진 항목들을 올바르게 처리합니다.
|
|
107
|
+
*
|
|
108
|
+
* @param order1 첫 번째 순서 (ID 배열, 점수 순으로 정렬됨)
|
|
109
|
+
* @param order2 두 번째 순서 (ID 배열, 점수 순으로 정렬됨)
|
|
110
|
+
* @returns Kendall's Tau-b 값 (-1 ~ 1)
|
|
111
|
+
* - 1: 완전히 일치하는 순서
|
|
112
|
+
* - 0: 무관한 순서
|
|
113
|
+
* - -1: 완전히 반대인 순서
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* const order1 = ['id1', 'id2', 'id3', 'id4'];
|
|
118
|
+
* const order2 = ['id1', 'id3', 'id2', 'id4'];
|
|
119
|
+
* const tau = calculateKendallTau(order1, order2);
|
|
120
|
+
* // tau는 0.67 정도 (부분적으로 일치)
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
export declare function calculateKendallTau(order1: string[], order2: string[]): number;
|
|
124
|
+
/**
|
|
125
|
+
* Spearman's Rho 순서 일치도 계산
|
|
126
|
+
* 두 순서 간의 순위 상관관계를 측정 (-1 ~ 1)
|
|
127
|
+
*
|
|
128
|
+
* Spearman's Rho는 순위 차이를 기반으로 계산되며, Kendall's Tau와 함께 사용하여
|
|
129
|
+
* 순서 보존 정도를 다각도로 검증할 수 있습니다.
|
|
130
|
+
*
|
|
131
|
+
* @param order1 첫 번째 순서 (ID 배열, 점수 순으로 정렬됨)
|
|
132
|
+
* @param order2 두 번째 순서 (ID 배열, 점수 순으로 정렬됨)
|
|
133
|
+
* @returns Spearman's Rho 값 (-1 ~ 1)
|
|
134
|
+
* - 1: 완전히 일치하는 순서
|
|
135
|
+
* - 0: 무관한 순서
|
|
136
|
+
* - -1: 완전히 반대인 순서
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* const order1 = ['id1', 'id2', 'id3', 'id4'];
|
|
141
|
+
* const order2 = ['id1', 'id3', 'id2', 'id4'];
|
|
142
|
+
* const rho = calculateSpearmanRho(order1, order2);
|
|
143
|
+
* // rho는 0.8 정도 (대체로 일치)
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
export declare function calculateSpearmanRho(order1: string[], order2: string[]): number;
|
|
147
|
+
/**
|
|
148
|
+
* 상위 K개 결과 유지율 계산
|
|
149
|
+
* 벡터-only 상위 K개가 Consolidation 반영 후에도 상위에 유지되는 비율
|
|
150
|
+
*
|
|
151
|
+
* Acceptance Criteria:
|
|
152
|
+
* - Top10 유지율 >= 80%
|
|
153
|
+
* - Top5 유지율 >= 90%
|
|
154
|
+
*
|
|
155
|
+
* @param pair 벡터-only와 Consolidation 반영 후 검색 결과 쌍
|
|
156
|
+
* @param kValues 계산할 K 값 배열 (예: [5, 10])
|
|
157
|
+
* @returns K 값별 유지율 (0 ~ 1)
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* const pair = {
|
|
162
|
+
* vectorOnly: [{ id: 'id1' }, { id: 'id2' }, { id: 'id3' }, ...],
|
|
163
|
+
* withConsolidation: [{ id: 'id1' }, { id: 'id3' }, { id: 'id2' }, ...]
|
|
164
|
+
* };
|
|
165
|
+
* const retention = calculateTopKRetention(pair, [5, 10]);
|
|
166
|
+
* // retention = { 5: 0.8, 10: 0.7 }
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
export declare function calculateTopKRetention(pair: SearchResultPair, kValues?: number[]): Record<number, number>;
|
|
170
|
+
/**
|
|
171
|
+
* 벡터 유사도만 사용한 검색 결과 생성
|
|
172
|
+
* Consolidation 점수를 제외하고 벡터 유사도만으로 정렬한 결과를 생성합니다.
|
|
173
|
+
*
|
|
174
|
+
* 이 함수는 실제 검색 결과를 받아서 벡터 유사도만으로 재정렬합니다.
|
|
175
|
+
* 벡터 유사도가 없는 경우 textScore를 사용하거나, 해당 결과를 제외할 수 있습니다.
|
|
176
|
+
*
|
|
177
|
+
* @param searchResults 실제 검색 결과 (HybridSearchResult 배열)
|
|
178
|
+
* @param limit 반환할 결과 수 (기본값: 전체)
|
|
179
|
+
* @returns 벡터 유사도만으로 정렬된 SearchResult 배열
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```typescript
|
|
183
|
+
* const results = await hybridSearchEngine.search(query, options);
|
|
184
|
+
* const vectorOnlyResults = generateVectorOnlySearchResults(results);
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
export declare function generateVectorOnlySearchResults(searchResults: HybridSearchResult[], limit?: number): SearchResult[];
|
|
188
|
+
/**
|
|
189
|
+
* Consolidation 점수 반영 후 검색 결과 생성
|
|
190
|
+
* 벡터 유사도와 Consolidation 점수가 모두 반영된 최종 점수로 정렬한 결과를 생성합니다.
|
|
191
|
+
*
|
|
192
|
+
* 이 함수는 실제 검색 결과를 받아서 finalScore(벡터 유사도 + Consolidation 점수)로 정렬합니다.
|
|
193
|
+
* finalScore는 이미 검색 엔진에서 계산된 최종 점수입니다.
|
|
194
|
+
*
|
|
195
|
+
* @param searchResults 실제 검색 결과 (HybridSearchResult 배열)
|
|
196
|
+
* @param limit 반환할 결과 수 (기본값: 전체)
|
|
197
|
+
* @returns Consolidation 점수 반영 후 정렬된 SearchResult 배열
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```typescript
|
|
201
|
+
* const results = await hybridSearchEngine.search(query, options);
|
|
202
|
+
* const consolidationResults = generateConsolidationSearchResults(results);
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
export declare function generateConsolidationSearchResults(searchResults: HybridSearchResult[], limit?: number): SearchResult[];
|
|
206
|
+
/**
|
|
207
|
+
* 순서 보존 검증 결과 리포트 생성
|
|
208
|
+
* 벡터-only 결과와 Consolidation 반영 후 결과 간의 순서 보존 정도를 검증하고 리포트를 생성합니다.
|
|
209
|
+
*
|
|
210
|
+
* Acceptance Criteria:
|
|
211
|
+
* - Kendall's Tau >= 0.7
|
|
212
|
+
* - Top10 유지율 >= 80%
|
|
213
|
+
* - Top5 유지율 >= 90%
|
|
214
|
+
*
|
|
215
|
+
* @param pair 벡터-only와 Consolidation 반영 후 검색 결과 쌍
|
|
216
|
+
* @param options 리포트 생성 옵션
|
|
217
|
+
* @param options.includeSpearmanRho Spearman's Rho 계산 포함 여부 (기본값: false)
|
|
218
|
+
* @param options.kValues TopK 유지율 계산할 K 값 배열 (기본값: [5, 10])
|
|
219
|
+
* @param options.kendallTauThreshold Kendall's Tau 임계값 (기본값: 0.7)
|
|
220
|
+
* @param options.top10RetentionThreshold Top10 유지율 임계값 (기본값: 0.8)
|
|
221
|
+
* @param options.top5RetentionThreshold Top5 유지율 임계값 (기본값: 0.9)
|
|
222
|
+
* @returns 순서 보존 검증 결과 리포트
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```typescript
|
|
226
|
+
* const pair = {
|
|
227
|
+
* vectorOnly: vectorOnlyResults,
|
|
228
|
+
* withConsolidation: consolidationResults
|
|
229
|
+
* };
|
|
230
|
+
* const report = generateOrderPreservationReport(pair);
|
|
231
|
+
* console.log(`검증 통과: ${report.passed}`);
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
export declare function generateOrderPreservationReport(pair: SearchResultPair, options?: {
|
|
235
|
+
includeSpearmanRho?: boolean;
|
|
236
|
+
kValues?: number[];
|
|
237
|
+
kendallTauThreshold?: number;
|
|
238
|
+
top10RetentionThreshold?: number;
|
|
239
|
+
top5RetentionThreshold?: number;
|
|
240
|
+
}): OrderPreservationReport;
|
|
241
|
+
/**
|
|
242
|
+
* 품질 지표 인터페이스
|
|
243
|
+
*/
|
|
244
|
+
export interface QualityMetrics {
|
|
245
|
+
/**
|
|
246
|
+
* Precision@K 값들 (K 값별)
|
|
247
|
+
*/
|
|
248
|
+
precision: Record<number, number>;
|
|
249
|
+
/**
|
|
250
|
+
* Recall@K 값들 (K 값별)
|
|
251
|
+
*/
|
|
252
|
+
recall: Record<number, number>;
|
|
253
|
+
/**
|
|
254
|
+
* NDCG@K 값들 (K 값별)
|
|
255
|
+
*/
|
|
256
|
+
ndcg: Record<number, number>;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* 벡터 유사도만 사용한 검색 결과에서 품질 지표 측정
|
|
260
|
+
* Ground Truth를 기반으로 Precision/Recall/NDCG를 계산합니다.
|
|
261
|
+
*
|
|
262
|
+
* @param results 벡터 유사도만으로 정렬된 검색 결과
|
|
263
|
+
* @param groundTruth Ground Truth (관련 결과 ID 목록)
|
|
264
|
+
* @param kValues 계산할 K 값 배열 (기본값: [1, 5, 10])
|
|
265
|
+
* @returns 품질 지표 (Precision/Recall/NDCG)
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* ```typescript
|
|
269
|
+
* const vectorOnlyResults = generateVectorOnlySearchResults(searchResults);
|
|
270
|
+
* const groundTruth = { queryId: 'query1', relevantIds: ['id1', 'id2', 'id3'] };
|
|
271
|
+
* const metrics = measureVectorOnlyQuality(vectorOnlyResults, groundTruth);
|
|
272
|
+
* console.log(`NDCG@5: ${metrics.ndcg[5]}`);
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
export declare function measureVectorOnlyQuality(results: SearchResult[], groundTruth: {
|
|
276
|
+
queryId: string;
|
|
277
|
+
relevantIds: string[];
|
|
278
|
+
}, kValues?: number[]): QualityMetrics;
|
|
279
|
+
/**
|
|
280
|
+
* Consolidation 점수 반영 후 검색 결과에서 품질 지표 측정
|
|
281
|
+
* Ground Truth를 기반으로 Precision/Recall/NDCG를 계산합니다.
|
|
282
|
+
*
|
|
283
|
+
* @param results Consolidation 점수 반영 후 정렬된 검색 결과
|
|
284
|
+
* @param groundTruth Ground Truth (관련 결과 ID 목록)
|
|
285
|
+
* @param kValues 계산할 K 값 배열 (기본값: [1, 5, 10])
|
|
286
|
+
* @returns 품질 지표 (Precision/Recall/NDCG)
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* ```typescript
|
|
290
|
+
* const consolidationResults = generateConsolidationSearchResults(searchResults);
|
|
291
|
+
* const groundTruth = { queryId: 'query1', relevantIds: ['id1', 'id2', 'id3'] };
|
|
292
|
+
* const metrics = measureConsolidationQuality(consolidationResults, groundTruth);
|
|
293
|
+
* console.log(`NDCG@5: ${metrics.ndcg[5]}`);
|
|
294
|
+
* ```
|
|
295
|
+
*/
|
|
296
|
+
export declare function measureConsolidationQuality(results: SearchResult[], groundTruth: {
|
|
297
|
+
queryId: string;
|
|
298
|
+
relevantIds: string[];
|
|
299
|
+
}, kValues?: number[]): QualityMetrics;
|
|
300
|
+
/**
|
|
301
|
+
* 품질 저하율 인터페이스
|
|
302
|
+
*/
|
|
303
|
+
export interface QualityDegradation {
|
|
304
|
+
/**
|
|
305
|
+
* Precision@K 저하율 (K 값별, 0-1)
|
|
306
|
+
* 양수면 저하, 음수면 개선
|
|
307
|
+
*/
|
|
308
|
+
precision: Record<number, number>;
|
|
309
|
+
/**
|
|
310
|
+
* Recall@K 저하율 (K 값별, 0-1)
|
|
311
|
+
* 양수면 저하, 음수면 개선
|
|
312
|
+
*/
|
|
313
|
+
recall: Record<number, number>;
|
|
314
|
+
/**
|
|
315
|
+
* NDCG@K 저하율 (K 값별, 0-1)
|
|
316
|
+
* 양수면 저하, 음수면 개선
|
|
317
|
+
*/
|
|
318
|
+
ndcg: Record<number, number>;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* 품질 저하율 계산
|
|
322
|
+
* 벡터-only 품질과 Consolidation 반영 후 품질을 비교하여 저하율을 계산합니다.
|
|
323
|
+
*
|
|
324
|
+
* 저하율 공식: (vectorOnly - consolidation) / vectorOnly
|
|
325
|
+
* - 양수: 품질 저하
|
|
326
|
+
* - 음수: 품질 개선
|
|
327
|
+
* - 0: 변화 없음
|
|
328
|
+
*
|
|
329
|
+
* @param vectorOnlyMetrics 벡터-only 품질 지표
|
|
330
|
+
* @param consolidationMetrics Consolidation 반영 후 품질 지표
|
|
331
|
+
* @param kValues 계산할 K 값 배열 (기본값: [1, 5, 10])
|
|
332
|
+
* @returns 품질 저하율 (K 값별)
|
|
333
|
+
*
|
|
334
|
+
* @example
|
|
335
|
+
* ```typescript
|
|
336
|
+
* const vectorOnlyMetrics = measureVectorOnlyQuality(vectorOnlyResults, groundTruth);
|
|
337
|
+
* const consolidationMetrics = measureConsolidationQuality(consolidationResults, groundTruth);
|
|
338
|
+
* const degradation = calculateQualityDegradation(vectorOnlyMetrics, consolidationMetrics);
|
|
339
|
+
* console.log(`NDCG@5 저하율: ${(degradation.ndcg[5] * 100).toFixed(2)}%`);
|
|
340
|
+
* ```
|
|
341
|
+
*/
|
|
342
|
+
export declare function calculateQualityDegradation(vectorOnlyMetrics: QualityMetrics, consolidationMetrics: QualityMetrics, kValues?: number[]): QualityDegradation;
|
|
343
|
+
/**
|
|
344
|
+
* 품질 저하 임계값 검증 결과
|
|
345
|
+
*/
|
|
346
|
+
export interface QualityThresholdValidation {
|
|
347
|
+
/**
|
|
348
|
+
* 검증 통과 여부
|
|
349
|
+
*/
|
|
350
|
+
passed: boolean;
|
|
351
|
+
/**
|
|
352
|
+
* 검증 실패 사유 (통과 시 undefined)
|
|
353
|
+
*/
|
|
354
|
+
failureReasons?: string[];
|
|
355
|
+
/**
|
|
356
|
+
* 상세 검증 결과
|
|
357
|
+
*/
|
|
358
|
+
validation: {
|
|
359
|
+
/**
|
|
360
|
+
* NDCG@5 저하율 < 5% 검증
|
|
361
|
+
*/
|
|
362
|
+
ndcg5Valid: boolean;
|
|
363
|
+
/**
|
|
364
|
+
* Precision@5 저하율 < 10% 검증
|
|
365
|
+
*/
|
|
366
|
+
precision5Valid: boolean;
|
|
367
|
+
/**
|
|
368
|
+
* Recall@5 저하율 < 10% 검증
|
|
369
|
+
*/
|
|
370
|
+
recall5Valid: boolean;
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
373
|
+
* 실제 저하율 값
|
|
374
|
+
*/
|
|
375
|
+
degradation: {
|
|
376
|
+
ndcg5: number;
|
|
377
|
+
precision5: number;
|
|
378
|
+
recall5: number;
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* 품질 저하 임계값 검증
|
|
383
|
+
* 품질 저하율이 임계값을 초과하지 않는지 검증합니다.
|
|
384
|
+
*
|
|
385
|
+
* Acceptance Criteria:
|
|
386
|
+
* - NDCG@5 저하율 < 5%
|
|
387
|
+
* - Precision@5 저하율 < 10%
|
|
388
|
+
* - Recall@5 저하율 < 10%
|
|
389
|
+
*
|
|
390
|
+
* @param degradation 품질 저하율
|
|
391
|
+
* @param options 검증 옵션
|
|
392
|
+
* @param options.ndcg5Threshold NDCG@5 저하율 임계값 (기본값: 0.05 = 5%)
|
|
393
|
+
* @param options.precision5Threshold Precision@5 저하율 임계값 (기본값: 0.10 = 10%)
|
|
394
|
+
* @param options.recall5Threshold Recall@5 저하율 임계값 (기본값: 0.10 = 10%)
|
|
395
|
+
* @returns 검증 결과
|
|
396
|
+
*
|
|
397
|
+
* @example
|
|
398
|
+
* ```typescript
|
|
399
|
+
* const degradation = calculateQualityDegradation(vectorOnlyMetrics, consolidationMetrics);
|
|
400
|
+
* const validation = validateQualityThresholds(degradation);
|
|
401
|
+
* if (!validation.passed) {
|
|
402
|
+
* console.error('품질 저하 임계값 초과:', validation.failureReasons);
|
|
403
|
+
* }
|
|
404
|
+
* ```
|
|
405
|
+
*/
|
|
406
|
+
export declare function validateQualityThresholds(degradation: QualityDegradation, options?: {
|
|
407
|
+
ndcg5Threshold?: number;
|
|
408
|
+
precision5Threshold?: number;
|
|
409
|
+
recall5Threshold?: number;
|
|
410
|
+
}): QualityThresholdValidation;
|
|
411
|
+
/**
|
|
412
|
+
* Ground Truth 기반 품질 비교 결과
|
|
413
|
+
*/
|
|
414
|
+
export interface QualityComparison {
|
|
415
|
+
/**
|
|
416
|
+
* 벡터-only 품질 지표
|
|
417
|
+
*/
|
|
418
|
+
vectorOnly: QualityMetrics;
|
|
419
|
+
/**
|
|
420
|
+
* Consolidation 반영 후 품질 지표
|
|
421
|
+
*/
|
|
422
|
+
consolidation: QualityMetrics;
|
|
423
|
+
/**
|
|
424
|
+
* 품질 저하율
|
|
425
|
+
*/
|
|
426
|
+
degradation: QualityDegradation;
|
|
427
|
+
/**
|
|
428
|
+
* 품질 저하 임계값 검증 결과
|
|
429
|
+
*/
|
|
430
|
+
thresholdValidation: QualityThresholdValidation;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Ground Truth 기반 품질 비교
|
|
434
|
+
* 벡터-only 결과와 Consolidation 반영 후 결과를 Ground Truth와 비교하여 품질을 측정하고 비교합니다.
|
|
435
|
+
*
|
|
436
|
+
* @param vectorOnlyResults 벡터 유사도만으로 정렬된 검색 결과
|
|
437
|
+
* @param consolidationResults Consolidation 점수 반영 후 정렬된 검색 결과
|
|
438
|
+
* @param groundTruth Ground Truth (관련 결과 ID 목록)
|
|
439
|
+
* @param kValues 계산할 K 값 배열 (기본값: [1, 5, 10])
|
|
440
|
+
* @param thresholdOptions 품질 저하 임계값 검증 옵션
|
|
441
|
+
* @returns 품질 비교 결과
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* ```typescript
|
|
445
|
+
* const vectorOnlyResults = generateVectorOnlySearchResults(searchResults);
|
|
446
|
+
* const consolidationResults = generateConsolidationSearchResults(searchResults);
|
|
447
|
+
* const groundTruth = { queryId: 'query1', relevantIds: ['id1', 'id2', 'id3'] };
|
|
448
|
+
* const comparison = compareQualityWithGroundTruth(
|
|
449
|
+
* vectorOnlyResults,
|
|
450
|
+
* consolidationResults,
|
|
451
|
+
* groundTruth
|
|
452
|
+
* );
|
|
453
|
+
* console.log(`벡터-only NDCG@5: ${comparison.vectorOnly.ndcg[5]}`);
|
|
454
|
+
* console.log(`Consolidation NDCG@5: ${comparison.consolidation.ndcg[5]}`);
|
|
455
|
+
* console.log(`검증 통과: ${comparison.thresholdValidation.passed}`);
|
|
456
|
+
* ```
|
|
457
|
+
*/
|
|
458
|
+
export declare function compareQualityWithGroundTruth(vectorOnlyResults: SearchResult[], consolidationResults: SearchResult[], groundTruth: {
|
|
459
|
+
queryId: string;
|
|
460
|
+
relevantIds: string[];
|
|
461
|
+
}, kValues?: number[], thresholdOptions?: {
|
|
462
|
+
ndcg5Threshold?: number;
|
|
463
|
+
precision5Threshold?: number;
|
|
464
|
+
recall5Threshold?: number;
|
|
465
|
+
}): QualityComparison;
|
|
466
|
+
/**
|
|
467
|
+
* 품질 비교 결과 리포트
|
|
468
|
+
*/
|
|
469
|
+
export interface QualityComparisonReport {
|
|
470
|
+
/**
|
|
471
|
+
* 리포트 생성 시간
|
|
472
|
+
*/
|
|
473
|
+
timestamp: string;
|
|
474
|
+
/**
|
|
475
|
+
* Ground Truth 정보
|
|
476
|
+
*/
|
|
477
|
+
groundTruth: {
|
|
478
|
+
queryId: string;
|
|
479
|
+
relevantIdsCount: number;
|
|
480
|
+
};
|
|
481
|
+
/**
|
|
482
|
+
* 벡터-only 품질 지표
|
|
483
|
+
*/
|
|
484
|
+
vectorOnly: QualityMetrics;
|
|
485
|
+
/**
|
|
486
|
+
* Consolidation 반영 후 품질 지표
|
|
487
|
+
*/
|
|
488
|
+
consolidation: QualityMetrics;
|
|
489
|
+
/**
|
|
490
|
+
* 품질 저하율
|
|
491
|
+
*/
|
|
492
|
+
degradation: QualityDegradation;
|
|
493
|
+
/**
|
|
494
|
+
* 품질 저하 임계값 검증 결과
|
|
495
|
+
*/
|
|
496
|
+
thresholdValidation: QualityThresholdValidation;
|
|
497
|
+
/**
|
|
498
|
+
* 요약 정보
|
|
499
|
+
*/
|
|
500
|
+
summary: {
|
|
501
|
+
/**
|
|
502
|
+
* 검증 통과 여부
|
|
503
|
+
*/
|
|
504
|
+
passed: boolean;
|
|
505
|
+
/**
|
|
506
|
+
* 주요 지표 요약 (K=5 기준)
|
|
507
|
+
*/
|
|
508
|
+
keyMetrics: {
|
|
509
|
+
vectorOnlyNDCG5: number;
|
|
510
|
+
consolidationNDCG5: number;
|
|
511
|
+
ndcg5Degradation: number;
|
|
512
|
+
};
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* 품질 비교 결과 리포트 생성
|
|
517
|
+
* Ground Truth 기반 품질 비교 결과를 구조화된 리포트 형식으로 생성합니다.
|
|
518
|
+
*
|
|
519
|
+
* @param comparison 품질 비교 결과
|
|
520
|
+
* @param groundTruth Ground Truth 정보
|
|
521
|
+
* @returns 품질 비교 결과 리포트
|
|
522
|
+
*
|
|
523
|
+
* @example
|
|
524
|
+
* ```typescript
|
|
525
|
+
* const comparison = compareQualityWithGroundTruth(
|
|
526
|
+
* vectorOnlyResults,
|
|
527
|
+
* consolidationResults,
|
|
528
|
+
* groundTruth
|
|
529
|
+
* );
|
|
530
|
+
* const report = generateQualityComparisonReport(comparison, groundTruth);
|
|
531
|
+
* console.log(JSON.stringify(report, null, 2));
|
|
532
|
+
* ```
|
|
533
|
+
*/
|
|
534
|
+
export declare function generateQualityComparisonReport(comparison: QualityComparison, groundTruth: {
|
|
535
|
+
queryId: string;
|
|
536
|
+
relevantIds: string[];
|
|
537
|
+
}): QualityComparisonReport;
|
|
538
|
+
/**
|
|
539
|
+
* 품질 비교 결과 시각화
|
|
540
|
+
* 품질 비교 결과를 Markdown 표 형식으로 시각화합니다.
|
|
541
|
+
*
|
|
542
|
+
* @param report 품질 비교 결과 리포트
|
|
543
|
+
* @param options 시각화 옵션
|
|
544
|
+
* @param options.kValues 표시할 K 값 배열 (기본값: [1, 5, 10])
|
|
545
|
+
* @param options.includeDegradation 저하율 포함 여부 (기본값: true)
|
|
546
|
+
* @returns Markdown 형식의 시각화된 리포트
|
|
547
|
+
*
|
|
548
|
+
* @example
|
|
549
|
+
* ```typescript
|
|
550
|
+
* const report = generateQualityComparisonReport(comparison, groundTruth);
|
|
551
|
+
* const visualization = visualizeQualityComparison(report);
|
|
552
|
+
* console.log(visualization);
|
|
553
|
+
* ```
|
|
554
|
+
*/
|
|
555
|
+
export declare function visualizeQualityComparison(report: QualityComparisonReport, options?: {
|
|
556
|
+
kValues?: number[];
|
|
557
|
+
includeDegradation?: boolean;
|
|
558
|
+
}): string;
|
|
559
|
+
/**
|
|
560
|
+
* 극단적 시나리오 검증 결과
|
|
561
|
+
*/
|
|
562
|
+
export interface ExtremeScenarioValidation {
|
|
563
|
+
/**
|
|
564
|
+
* 검증 통과 여부
|
|
565
|
+
*/
|
|
566
|
+
passed: boolean;
|
|
567
|
+
/**
|
|
568
|
+
* 검증 실패 사유 (통과 시 undefined)
|
|
569
|
+
*/
|
|
570
|
+
failureReasons?: string[];
|
|
571
|
+
/**
|
|
572
|
+
* 최종 점수 범위
|
|
573
|
+
*/
|
|
574
|
+
finalScoreRange: {
|
|
575
|
+
min: number;
|
|
576
|
+
max: number;
|
|
577
|
+
average: number;
|
|
578
|
+
};
|
|
579
|
+
/**
|
|
580
|
+
* 벡터 유사도 통계
|
|
581
|
+
*/
|
|
582
|
+
vectorSimilarityStats: {
|
|
583
|
+
min: number;
|
|
584
|
+
max: number;
|
|
585
|
+
average: number;
|
|
586
|
+
};
|
|
587
|
+
/**
|
|
588
|
+
* Consolidation 점수 통계
|
|
589
|
+
*/
|
|
590
|
+
consolidationScoreStats: {
|
|
591
|
+
min: number;
|
|
592
|
+
max: number;
|
|
593
|
+
average: number;
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* 저벡터 유사도 + 고 consolidation 점수 시나리오 검증
|
|
598
|
+
* 벡터 유사도는 낮지만 consolidation 점수가 매우 높은 경우의 랭킹을 검증합니다.
|
|
599
|
+
*
|
|
600
|
+
* 예: 벡터 유사도 0.3, consolidation 0.9
|
|
601
|
+
* 최종 점수가 합리적인 범위 내인지 검증합니다.
|
|
602
|
+
*
|
|
603
|
+
* @param results 검색 결과 (HybridSearchResult 배열)
|
|
604
|
+
* @param options 검증 옵션
|
|
605
|
+
* @param options.lowVectorThreshold 저벡터 유사도 임계값 (기본값: 0.4)
|
|
606
|
+
* @param options.highConsolidationThreshold 고 consolidation 점수 임계값 (기본값: 0.7)
|
|
607
|
+
* @param options.minFinalScore 최종 점수 최소값 (기본값: 0.0)
|
|
608
|
+
* @param options.maxFinalScore 최종 점수 최대값 (기본값: 1.0)
|
|
609
|
+
* @returns 검증 결과
|
|
610
|
+
*
|
|
611
|
+
* @example
|
|
612
|
+
* ```typescript
|
|
613
|
+
* const results = await hybridSearchEngine.search(query, options);
|
|
614
|
+
* const validation = validateLowVectorHighConsolidation(results);
|
|
615
|
+
* if (!validation.passed) {
|
|
616
|
+
* console.error('극단적 시나리오 검증 실패:', validation.failureReasons);
|
|
617
|
+
* }
|
|
618
|
+
* ```
|
|
619
|
+
*/
|
|
620
|
+
export declare function validateLowVectorHighConsolidation(results: HybridSearchResult[], options?: {
|
|
621
|
+
lowVectorThreshold?: number;
|
|
622
|
+
highConsolidationThreshold?: number;
|
|
623
|
+
minFinalScore?: number;
|
|
624
|
+
maxFinalScore?: number;
|
|
625
|
+
}): ExtremeScenarioValidation;
|
|
626
|
+
/**
|
|
627
|
+
* 고벡터 유사도 + 저 consolidation 점수 시나리오 검증
|
|
628
|
+
* 벡터 유사도는 높지만 consolidation 점수가 낮은 경우의 랭킹을 검증합니다.
|
|
629
|
+
*
|
|
630
|
+
* 예: 벡터 유사도 0.9, consolidation 0.1
|
|
631
|
+
* 벡터 유사도가 우선 반영되는지 검증합니다.
|
|
632
|
+
*
|
|
633
|
+
* @param results 검색 결과 (HybridSearchResult 배열)
|
|
634
|
+
* @param options 검증 옵션
|
|
635
|
+
* @param options.highVectorThreshold 고벡터 유사도 임계값 (기본값: 0.7)
|
|
636
|
+
* @param options.lowConsolidationThreshold 저 consolidation 점수 임계값 (기본값: 0.3)
|
|
637
|
+
* @param options.vectorPriorityRatio 벡터 유사도가 최종 점수에 미치는 최소 영향 비율 (기본값: 0.6)
|
|
638
|
+
* @returns 검증 결과
|
|
639
|
+
*
|
|
640
|
+
* @example
|
|
641
|
+
* ```typescript
|
|
642
|
+
* const results = await hybridSearchEngine.search(query, options);
|
|
643
|
+
* const validation = validateHighVectorLowConsolidation(results);
|
|
644
|
+
* if (!validation.passed) {
|
|
645
|
+
* console.error('극단적 시나리오 검증 실패:', validation.failureReasons);
|
|
646
|
+
* }
|
|
647
|
+
* ```
|
|
648
|
+
*/
|
|
649
|
+
export declare function validateHighVectorLowConsolidation(results: HybridSearchResult[], options?: {
|
|
650
|
+
highVectorThreshold?: number;
|
|
651
|
+
lowConsolidationThreshold?: number;
|
|
652
|
+
vectorPriorityRatio?: number;
|
|
653
|
+
}): ExtremeScenarioValidation;
|
|
654
|
+
/**
|
|
655
|
+
* w2 상한 검증 결과
|
|
656
|
+
*/
|
|
657
|
+
export interface W2UpperBoundValidation {
|
|
658
|
+
/**
|
|
659
|
+
* 검증 통과 여부
|
|
660
|
+
*/
|
|
661
|
+
passed: boolean;
|
|
662
|
+
/**
|
|
663
|
+
* 검증 실패 사유 (통과 시 undefined)
|
|
664
|
+
*/
|
|
665
|
+
failureReasons?: string[];
|
|
666
|
+
/**
|
|
667
|
+
* w2=0.4일 때 품질 지표
|
|
668
|
+
*/
|
|
669
|
+
w2_04: QualityMetrics;
|
|
670
|
+
/**
|
|
671
|
+
* w2=0.6일 때 품질 지표
|
|
672
|
+
*/
|
|
673
|
+
w2_06: QualityMetrics;
|
|
674
|
+
/**
|
|
675
|
+
* 품질 저하율 (w2=0.4 대비 w2=0.6)
|
|
676
|
+
*/
|
|
677
|
+
degradation: QualityDegradation;
|
|
678
|
+
/**
|
|
679
|
+
* w2 상한이 품질을 보호하는지 여부
|
|
680
|
+
*/
|
|
681
|
+
w2UpperBoundProtects: boolean;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* w2 상한(0.4) 검증
|
|
685
|
+
* w2=0.4일 때와 w2=0.6일 때의 품질을 비교하여 w2 상한이 벡터 검색 품질을 보호하는지 검증합니다.
|
|
686
|
+
*
|
|
687
|
+
* w2가 높을수록 consolidation 점수의 영향이 커지므로, w2=0.6일 때 품질이 저하되는지 확인합니다.
|
|
688
|
+
*
|
|
689
|
+
* @param originalResults 원본 검색 결과 (HybridSearchResult 배열, vectorScore와 consolidation_score 포함)
|
|
690
|
+
* @param groundTruth Ground Truth
|
|
691
|
+
* @param kValues 계산할 K 값 배열 (기본값: [1, 5, 10])
|
|
692
|
+
* @returns 검증 결과
|
|
693
|
+
*
|
|
694
|
+
* @example
|
|
695
|
+
* ```typescript
|
|
696
|
+
* const results = await hybridSearchEngine.search(query, options);
|
|
697
|
+
* const validation = validateW2UpperBound(results, groundTruth);
|
|
698
|
+
* console.log(`w2 상한 보호: ${validation.w2UpperBoundProtects}`);
|
|
699
|
+
* ```
|
|
700
|
+
*/
|
|
701
|
+
export declare function validateW2UpperBound(originalResults: HybridSearchResult[], groundTruth: {
|
|
702
|
+
queryId: string;
|
|
703
|
+
relevantIds: string[];
|
|
704
|
+
}, kValues?: number[]): W2UpperBoundValidation;
|
|
705
|
+
/**
|
|
706
|
+
* 극단적 시나리오 검증 결과 리포트
|
|
707
|
+
*/
|
|
708
|
+
export interface ExtremeScenarioReport {
|
|
709
|
+
/**
|
|
710
|
+
* 리포트 생성 시간
|
|
711
|
+
*/
|
|
712
|
+
timestamp: string;
|
|
713
|
+
/**
|
|
714
|
+
* 저벡터 유사도 + 고 consolidation 점수 검증 결과
|
|
715
|
+
*/
|
|
716
|
+
lowVectorHighConsolidation: ExtremeScenarioValidation;
|
|
717
|
+
/**
|
|
718
|
+
* 고벡터 유사도 + 저 consolidation 점수 검증 결과
|
|
719
|
+
*/
|
|
720
|
+
highVectorLowConsolidation: ExtremeScenarioValidation;
|
|
721
|
+
/**
|
|
722
|
+
* w2 상한 검증 결과
|
|
723
|
+
*/
|
|
724
|
+
w2UpperBound: W2UpperBoundValidation;
|
|
725
|
+
/**
|
|
726
|
+
* 전체 검증 통과 여부
|
|
727
|
+
*/
|
|
728
|
+
overallPassed: boolean;
|
|
729
|
+
/**
|
|
730
|
+
* 요약 정보
|
|
731
|
+
*/
|
|
732
|
+
summary: {
|
|
733
|
+
/**
|
|
734
|
+
* 검증 통과한 시나리오 수
|
|
735
|
+
*/
|
|
736
|
+
passedCount: number;
|
|
737
|
+
/**
|
|
738
|
+
* 전체 시나리오 수
|
|
739
|
+
*/
|
|
740
|
+
totalCount: number;
|
|
741
|
+
/**
|
|
742
|
+
* 실패한 시나리오 목록
|
|
743
|
+
*/
|
|
744
|
+
failedScenarios: string[];
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* 극단적 시나리오 검증 결과 리포트 생성
|
|
749
|
+
* 저벡터+고 consolidation, 고벡터+저 consolidation, w2 상한 검증 결과를 종합하여 리포트를 생성합니다.
|
|
750
|
+
*
|
|
751
|
+
* @param lowVectorHighConsolidation 저벡터 유사도 + 고 consolidation 점수 검증 결과
|
|
752
|
+
* @param highVectorLowConsolidation 고벡터 유사도 + 저 consolidation 점수 검증 결과
|
|
753
|
+
* @param w2UpperBound w2 상한 검증 결과
|
|
754
|
+
* @returns 극단적 시나리오 검증 결과 리포트
|
|
755
|
+
*
|
|
756
|
+
* @example
|
|
757
|
+
* ```typescript
|
|
758
|
+
* const lowVectorHigh = validateLowVectorHighConsolidation(results);
|
|
759
|
+
* const highVectorLow = validateHighVectorLowConsolidation(results);
|
|
760
|
+
* const w2Validation = validateW2UpperBound(results, groundTruth);
|
|
761
|
+
* const report = generateExtremeScenarioReport(
|
|
762
|
+
* lowVectorHigh,
|
|
763
|
+
* highVectorLow,
|
|
764
|
+
* w2Validation
|
|
765
|
+
* );
|
|
766
|
+
* console.log(`전체 검증 통과: ${report.overallPassed}`);
|
|
767
|
+
* ```
|
|
768
|
+
*/
|
|
769
|
+
export declare function generateExtremeScenarioReport(lowVectorHighConsolidation: ExtremeScenarioValidation, highVectorLowConsolidation: ExtremeScenarioValidation, w2UpperBound: W2UpperBoundValidation): ExtremeScenarioReport;
|
|
770
|
+
/**
|
|
771
|
+
* Baseline 스냅샷 인터페이스
|
|
772
|
+
* 벡터 검색 품질의 baseline을 저장하고 비교하기 위한 구조
|
|
773
|
+
*/
|
|
774
|
+
export interface BaselineSnapshot {
|
|
775
|
+
/**
|
|
776
|
+
* 스냅샷 버전
|
|
777
|
+
*/
|
|
778
|
+
version: string;
|
|
779
|
+
/**
|
|
780
|
+
* 스냅샷 생성 시간 (ISO 8601 형식)
|
|
781
|
+
*/
|
|
782
|
+
timestamp: string;
|
|
783
|
+
/**
|
|
784
|
+
* 테스트 설정 정보
|
|
785
|
+
*/
|
|
786
|
+
testConfiguration: {
|
|
787
|
+
/**
|
|
788
|
+
* 테스트 데이터 크기
|
|
789
|
+
*/
|
|
790
|
+
dataSize: number;
|
|
791
|
+
/**
|
|
792
|
+
* 가중치 설정
|
|
793
|
+
*/
|
|
794
|
+
weights: {
|
|
795
|
+
/**
|
|
796
|
+
* 벡터 유사도 가중치 (w1)
|
|
797
|
+
*/
|
|
798
|
+
vectorSimilarity: number;
|
|
799
|
+
/**
|
|
800
|
+
* Consolidation 점수 가중치 (w2)
|
|
801
|
+
*/
|
|
802
|
+
consolidationScore: number;
|
|
803
|
+
};
|
|
804
|
+
};
|
|
805
|
+
/**
|
|
806
|
+
* 품질 지표
|
|
807
|
+
*/
|
|
808
|
+
metrics: {
|
|
809
|
+
/**
|
|
810
|
+
* 순서 보존 지표
|
|
811
|
+
*/
|
|
812
|
+
orderPreservation: {
|
|
813
|
+
/**
|
|
814
|
+
* Kendall's Tau 순서 일치도
|
|
815
|
+
*/
|
|
816
|
+
kendallTau: number;
|
|
817
|
+
/**
|
|
818
|
+
* 상위 10개 결과 유지율
|
|
819
|
+
*/
|
|
820
|
+
top10Retention: number;
|
|
821
|
+
/**
|
|
822
|
+
* 상위 5개 결과 유지율
|
|
823
|
+
*/
|
|
824
|
+
top5Retention: number;
|
|
825
|
+
};
|
|
826
|
+
/**
|
|
827
|
+
* 품질 지표 (Precision, Recall, NDCG)
|
|
828
|
+
*/
|
|
829
|
+
quality: {
|
|
830
|
+
/**
|
|
831
|
+
* Precision@K (K 값별 Precision)
|
|
832
|
+
*/
|
|
833
|
+
precision: Record<number, number>;
|
|
834
|
+
/**
|
|
835
|
+
* Recall@K (K 값별 Recall)
|
|
836
|
+
*/
|
|
837
|
+
recall: Record<number, number>;
|
|
838
|
+
/**
|
|
839
|
+
* NDCG@K (K 값별 NDCG)
|
|
840
|
+
*/
|
|
841
|
+
ndcg: Record<number, number>;
|
|
842
|
+
};
|
|
843
|
+
/**
|
|
844
|
+
* 극단적 시나리오 검증 결과
|
|
845
|
+
*/
|
|
846
|
+
extremeScenarios: {
|
|
847
|
+
/**
|
|
848
|
+
* 저벡터 유사도 + 고 consolidation 점수 검증 통과 여부 (1: 통과, 0: 실패)
|
|
849
|
+
*/
|
|
850
|
+
lowVectorHighConsolidation: number;
|
|
851
|
+
/**
|
|
852
|
+
* 고벡터 유사도 + 저 consolidation 점수 검증 통과 여부 (1: 통과, 0: 실패)
|
|
853
|
+
*/
|
|
854
|
+
highVectorLowConsolidation: number;
|
|
855
|
+
};
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Baseline 스냅샷 저장
|
|
860
|
+
* Baseline 스냅샷을 JSON 형식으로 파일에 저장합니다.
|
|
861
|
+
*
|
|
862
|
+
* @param snapshot 저장할 Baseline 스냅샷
|
|
863
|
+
* @param filePath 저장할 파일 경로 (기본값: `data/vector-search-quality-baseline.json`)
|
|
864
|
+
* @throws 파일 저장 실패 시 에러 발생
|
|
865
|
+
*
|
|
866
|
+
* @example
|
|
867
|
+
* ```typescript
|
|
868
|
+
* const snapshot: BaselineSnapshot = {
|
|
869
|
+
* version: '1.0.0',
|
|
870
|
+
* timestamp: new Date().toISOString(),
|
|
871
|
+
* testConfiguration: { dataSize: 100, weights: { vectorSimilarity: 0.6, consolidationScore: 0.4 } },
|
|
872
|
+
* metrics: {
|
|
873
|
+
* orderPreservation: { kendallTau: 0.85, top10Retention: 0.9, top5Retention: 0.95 },
|
|
874
|
+
* quality: { precision: {}, recall: {}, ndcg: {} },
|
|
875
|
+
* extremeScenarios: { lowVectorHighConsolidation: 1, highVectorLowConsolidation: 1 }
|
|
876
|
+
* }
|
|
877
|
+
* };
|
|
878
|
+
* saveBaselineSnapshot(snapshot);
|
|
879
|
+
* ```
|
|
880
|
+
*/
|
|
881
|
+
export declare function saveBaselineSnapshot(snapshot: BaselineSnapshot, filePath?: string): void;
|
|
882
|
+
/**
|
|
883
|
+
* Baseline 스냅샷 로드
|
|
884
|
+
* 저장된 Baseline 스냅샷을 파일에서 로드합니다.
|
|
885
|
+
*
|
|
886
|
+
* @param filePath 로드할 파일 경로 (기본값: `data/vector-search-quality-baseline.json`)
|
|
887
|
+
* @returns 로드된 Baseline 스냅샷 또는 null (파일이 없거나 로드 실패 시)
|
|
888
|
+
*
|
|
889
|
+
* @example
|
|
890
|
+
* ```typescript
|
|
891
|
+
* const snapshot = loadBaselineSnapshot();
|
|
892
|
+
* if (snapshot) {
|
|
893
|
+
* console.log(`Baseline 버전: ${snapshot.version}`);
|
|
894
|
+
* console.log(`Baseline 생성 시간: ${snapshot.timestamp}`);
|
|
895
|
+
* } else {
|
|
896
|
+
* console.log('Baseline 스냅샷이 없습니다.');
|
|
897
|
+
* }
|
|
898
|
+
* ```
|
|
899
|
+
*/
|
|
900
|
+
export declare function loadBaselineSnapshot(filePath?: string): BaselineSnapshot | null;
|
|
901
|
+
/**
|
|
902
|
+
* Baseline 비교 결과
|
|
903
|
+
*/
|
|
904
|
+
export interface BaselineComparisonResult {
|
|
905
|
+
/**
|
|
906
|
+
* Baseline 스냅샷 정보
|
|
907
|
+
*/
|
|
908
|
+
baseline: {
|
|
909
|
+
version: string;
|
|
910
|
+
timestamp: string;
|
|
911
|
+
};
|
|
912
|
+
/**
|
|
913
|
+
* 순서 보존 지표 비교 결과
|
|
914
|
+
*/
|
|
915
|
+
orderPreservation: {
|
|
916
|
+
/**
|
|
917
|
+
* Kendall's Tau 변화 (현재 - baseline)
|
|
918
|
+
*/
|
|
919
|
+
kendallTauChange: number;
|
|
920
|
+
/**
|
|
921
|
+
* Top10 유지율 변화 (현재 - baseline)
|
|
922
|
+
*/
|
|
923
|
+
top10RetentionChange: number;
|
|
924
|
+
/**
|
|
925
|
+
* Top5 유지율 변화 (현재 - baseline)
|
|
926
|
+
*/
|
|
927
|
+
top5RetentionChange: number;
|
|
928
|
+
};
|
|
929
|
+
/**
|
|
930
|
+
* 품질 지표 비교 결과
|
|
931
|
+
*/
|
|
932
|
+
quality: {
|
|
933
|
+
/**
|
|
934
|
+
* Precision@K 변화율 (K 값별)
|
|
935
|
+
*/
|
|
936
|
+
precisionChange: Record<number, number>;
|
|
937
|
+
/**
|
|
938
|
+
* Recall@K 변화율 (K 값별)
|
|
939
|
+
*/
|
|
940
|
+
recallChange: Record<number, number>;
|
|
941
|
+
/**
|
|
942
|
+
* NDCG@K 변화율 (K 값별)
|
|
943
|
+
*/
|
|
944
|
+
ndcgChange: Record<number, number>;
|
|
945
|
+
};
|
|
946
|
+
/**
|
|
947
|
+
* 극단적 시나리오 검증 비교 결과
|
|
948
|
+
*/
|
|
949
|
+
extremeScenarios: {
|
|
950
|
+
/**
|
|
951
|
+
* 저벡터 유사도 + 고 consolidation 점수 검증 변화 (현재 - baseline)
|
|
952
|
+
*/
|
|
953
|
+
lowVectorHighConsolidationChange: number;
|
|
954
|
+
/**
|
|
955
|
+
* 고벡터 유사도 + 저 consolidation 점수 검증 변화 (현재 - baseline)
|
|
956
|
+
*/
|
|
957
|
+
highVectorLowConsolidationChange: number;
|
|
958
|
+
};
|
|
959
|
+
/**
|
|
960
|
+
* 전체 품질 저하 여부
|
|
961
|
+
*/
|
|
962
|
+
hasDegradation: boolean;
|
|
963
|
+
/**
|
|
964
|
+
* 품질 저하 세부 사항
|
|
965
|
+
*/
|
|
966
|
+
degradationDetails: string[];
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Baseline과 현재 결과 비교
|
|
970
|
+
* Baseline 스냅샷과 현재 검증 결과를 비교하여 품질 저하를 감지합니다.
|
|
971
|
+
*
|
|
972
|
+
* @param baseline Baseline 스냅샷
|
|
973
|
+
* @param currentOrderPreservation 현재 순서 보존 검증 결과
|
|
974
|
+
* @param currentQuality 현재 품질 지표 (QualityMetrics)
|
|
975
|
+
* @param currentExtremeScenarios 현재 극단적 시나리오 검증 결과
|
|
976
|
+
* @param kValues 비교할 K 값 배열 (기본값: [1, 5, 10])
|
|
977
|
+
* @returns Baseline 비교 결과
|
|
978
|
+
*
|
|
979
|
+
* @example
|
|
980
|
+
* ```typescript
|
|
981
|
+
* const baseline = loadBaselineSnapshot();
|
|
982
|
+
* if (baseline) {
|
|
983
|
+
* const comparison = compareWithBaseline(
|
|
984
|
+
* baseline,
|
|
985
|
+
* orderPreservationReport,
|
|
986
|
+
* qualityMetrics,
|
|
987
|
+
* extremeScenarioReport
|
|
988
|
+
* );
|
|
989
|
+
* if (comparison.hasDegradation) {
|
|
990
|
+
* console.warn('품질 저하 감지:', comparison.degradationDetails);
|
|
991
|
+
* }
|
|
992
|
+
* }
|
|
993
|
+
* ```
|
|
994
|
+
*/
|
|
995
|
+
export declare function compareWithBaseline(baseline: BaselineSnapshot, currentOrderPreservation: OrderPreservationReport, currentQuality: QualityMetrics, currentExtremeScenarios: ExtremeScenarioReport, kValues?: number[]): BaselineComparisonResult;
|
|
996
|
+
/**
|
|
997
|
+
* 품질 저하 감지 결과
|
|
998
|
+
*/
|
|
999
|
+
export interface QualityDegradationDetection {
|
|
1000
|
+
/**
|
|
1001
|
+
* 품질 저하 감지 여부
|
|
1002
|
+
*/
|
|
1003
|
+
detected: boolean;
|
|
1004
|
+
/**
|
|
1005
|
+
* 심각도 레벨
|
|
1006
|
+
*/
|
|
1007
|
+
severity: 'none' | 'warning' | 'critical';
|
|
1008
|
+
/**
|
|
1009
|
+
* 품질 저하 메시지 목록
|
|
1010
|
+
*/
|
|
1011
|
+
messages: string[];
|
|
1012
|
+
/**
|
|
1013
|
+
* Baseline 비교 결과
|
|
1014
|
+
*/
|
|
1015
|
+
comparison: BaselineComparisonResult;
|
|
1016
|
+
/**
|
|
1017
|
+
* 권장 조치 사항
|
|
1018
|
+
*/
|
|
1019
|
+
recommendations: string[];
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* 품질 저하 감지 및 알림
|
|
1023
|
+
* Baseline 비교 결과를 분석하여 품질 저하를 감지하고 알림을 생성합니다.
|
|
1024
|
+
*
|
|
1025
|
+
* @param comparison Baseline 비교 결과
|
|
1026
|
+
* @param options 감지 옵션
|
|
1027
|
+
* @param options.ndcg5Threshold NDCG@5 저하 임계값 (기본값: 0.05 = 5%)
|
|
1028
|
+
* @param options.precision5Threshold Precision@5 저하 임계값 (기본값: 0.10 = 10%)
|
|
1029
|
+
* @param options.recall5Threshold Recall@5 저하 임계값 (기본값: 0.10 = 10%)
|
|
1030
|
+
* @param options.kendallTauThreshold Kendall's Tau 저하 임계값 (기본값: 0.1)
|
|
1031
|
+
* @param options.criticalThreshold 심각한 저하 임계값 (기본값: 0.20 = 20%)
|
|
1032
|
+
* @returns 품질 저하 감지 결과
|
|
1033
|
+
*
|
|
1034
|
+
* @example
|
|
1035
|
+
* ```typescript
|
|
1036
|
+
* const comparison = compareWithBaseline(baseline, ...);
|
|
1037
|
+
* const detection = detectQualityDegradation(comparison);
|
|
1038
|
+
* if (detection.detected) {
|
|
1039
|
+
* console.warn(`[${detection.severity.toUpperCase()}] 품질 저하 감지:`);
|
|
1040
|
+
* detection.messages.forEach(msg => console.warn(` - ${msg}`));
|
|
1041
|
+
* }
|
|
1042
|
+
* ```
|
|
1043
|
+
*/
|
|
1044
|
+
export declare function detectQualityDegradation(comparison: BaselineComparisonResult, options?: {
|
|
1045
|
+
ndcg5Threshold?: number;
|
|
1046
|
+
precision5Threshold?: number;
|
|
1047
|
+
recall5Threshold?: number;
|
|
1048
|
+
kendallTauThreshold?: number;
|
|
1049
|
+
criticalThreshold?: number;
|
|
1050
|
+
}): QualityDegradationDetection;
|
|
1051
|
+
/**
|
|
1052
|
+
* 경고 메시지 출력 옵션
|
|
1053
|
+
*/
|
|
1054
|
+
export interface QualityAlertOptions {
|
|
1055
|
+
/**
|
|
1056
|
+
* 출력 대상 ('console' | 'file' | 'both')
|
|
1057
|
+
*/
|
|
1058
|
+
output?: 'console' | 'file' | 'both';
|
|
1059
|
+
/**
|
|
1060
|
+
* 파일 경로 (output이 'file' 또는 'both'일 때 사용)
|
|
1061
|
+
*/
|
|
1062
|
+
filePath?: string;
|
|
1063
|
+
/**
|
|
1064
|
+
* 색상 사용 여부 (콘솔 출력 시, 기본값: true)
|
|
1065
|
+
*/
|
|
1066
|
+
useColors?: boolean;
|
|
1067
|
+
/**
|
|
1068
|
+
* 상세 정보 포함 여부 (기본값: true)
|
|
1069
|
+
*/
|
|
1070
|
+
includeDetails?: boolean;
|
|
1071
|
+
/**
|
|
1072
|
+
* Baseline 정보 포함 여부 (기본값: true)
|
|
1073
|
+
*/
|
|
1074
|
+
includeBaselineInfo?: boolean;
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* 품질 저하 경고 메시지 출력
|
|
1078
|
+
* 품질 저하 감지 결과를 사용자 친화적인 형식으로 출력합니다.
|
|
1079
|
+
*
|
|
1080
|
+
* @param detection 품질 저하 감지 결과
|
|
1081
|
+
* @param options 출력 옵션
|
|
1082
|
+
*
|
|
1083
|
+
* @example
|
|
1084
|
+
* ```typescript
|
|
1085
|
+
* const detection = detectQualityDegradation(comparison);
|
|
1086
|
+
* printQualityAlert(detection, { output: 'console', useColors: true });
|
|
1087
|
+
* ```
|
|
1088
|
+
*/
|
|
1089
|
+
export declare function printQualityAlert(detection: QualityDegradationDetection, options?: QualityAlertOptions): void;
|
|
1090
|
+
/**
|
|
1091
|
+
* 품질 저하 감지 및 경고 출력 (통합 함수)
|
|
1092
|
+
* Baseline 비교 결과를 분석하여 품질 저하를 감지하고 경고 메시지를 출력합니다.
|
|
1093
|
+
*
|
|
1094
|
+
* @param comparison Baseline 비교 결과
|
|
1095
|
+
* @param detectionOptions 감지 옵션
|
|
1096
|
+
* @param alertOptions 경고 출력 옵션
|
|
1097
|
+
* @returns 품질 저하 감지 결과
|
|
1098
|
+
*
|
|
1099
|
+
* @example
|
|
1100
|
+
* ```typescript
|
|
1101
|
+
* const comparison = compareWithBaseline(baseline, currentMetrics);
|
|
1102
|
+
* detectAndAlertQualityDegradation(comparison, {}, { output: 'console' });
|
|
1103
|
+
* ```
|
|
1104
|
+
*/
|
|
1105
|
+
export declare function detectAndAlertQualityDegradation(comparison: BaselineComparisonResult, detectionOptions?: Parameters<typeof detectQualityDegradation>[1], alertOptions?: QualityAlertOptions): QualityDegradationDetection;
|
|
1106
|
+
/**
|
|
1107
|
+
* Ground Truth 생성 옵션
|
|
1108
|
+
*/
|
|
1109
|
+
export interface GroundTruthGenerationOptions {
|
|
1110
|
+
/**
|
|
1111
|
+
* 시드 값 (재현성을 위해 사용, 기본값: 12345)
|
|
1112
|
+
*/
|
|
1113
|
+
seed?: number;
|
|
1114
|
+
/**
|
|
1115
|
+
* 쿼리 목록 (기본값: ['React', 'TypeScript', 'database', 'MCP', 'optimization'])
|
|
1116
|
+
*/
|
|
1117
|
+
queries?: string[];
|
|
1118
|
+
/**
|
|
1119
|
+
* 각 쿼리당 관련 결과 수 (기본값: 5)
|
|
1120
|
+
*/
|
|
1121
|
+
relevantCountPerQuery?: number;
|
|
1122
|
+
/**
|
|
1123
|
+
* 관련 결과 선택 전략 (기본값: 'random')
|
|
1124
|
+
* - 'random': 랜덤 선택
|
|
1125
|
+
* - 'first': 처음 N개 선택
|
|
1126
|
+
* - 'pattern': 패턴 기반 선택 (i % 3 === 0 등)
|
|
1127
|
+
*/
|
|
1128
|
+
selectionStrategy?: 'random' | 'first' | 'pattern';
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Ground Truth 자동 생성
|
|
1132
|
+
* 시드 기반으로 재현 가능한 Ground Truth 생성
|
|
1133
|
+
*
|
|
1134
|
+
* @param memoryIds 메모리 ID 배열
|
|
1135
|
+
* @param options 생성 옵션
|
|
1136
|
+
* @returns Ground Truth 배열
|
|
1137
|
+
*
|
|
1138
|
+
* @example
|
|
1139
|
+
* ```typescript
|
|
1140
|
+
* // 기본 옵션으로 생성
|
|
1141
|
+
* const groundTruths = generateGroundTruth(memoryIds);
|
|
1142
|
+
*
|
|
1143
|
+
* // 시드와 쿼리 지정
|
|
1144
|
+
* const groundTruths = generateGroundTruth(memoryIds, {
|
|
1145
|
+
* seed: 12345,
|
|
1146
|
+
* queries: ['React', 'TypeScript'],
|
|
1147
|
+
* relevantCountPerQuery: 3
|
|
1148
|
+
* });
|
|
1149
|
+
* ```
|
|
1150
|
+
*/
|
|
1151
|
+
export declare function generateGroundTruth(memoryIds: string[], options?: GroundTruthGenerationOptions): GroundTruth[];
|
|
1152
|
+
/**
|
|
1153
|
+
* Ground Truth 저장
|
|
1154
|
+
* JSON 파일로 Ground Truth를 저장합니다.
|
|
1155
|
+
*
|
|
1156
|
+
* @param groundTruths 저장할 Ground Truth 배열
|
|
1157
|
+
* @param filePath 저장할 파일 경로 (기본값: `data/vector-search-quality-ground-truth.json`)
|
|
1158
|
+
*
|
|
1159
|
+
* @example
|
|
1160
|
+
* ```typescript
|
|
1161
|
+
* const groundTruths = generateGroundTruth(memoryIds);
|
|
1162
|
+
* saveGroundTruth(groundTruths);
|
|
1163
|
+
* ```
|
|
1164
|
+
*/
|
|
1165
|
+
export declare function saveGroundTruth(groundTruths: GroundTruth[], filePath?: string): void;
|
|
1166
|
+
/**
|
|
1167
|
+
* Ground Truth 로드
|
|
1168
|
+
* JSON 파일에서 Ground Truth를 로드합니다.
|
|
1169
|
+
*
|
|
1170
|
+
* @param filePath 로드할 파일 경로 (기본값: `data/vector-search-quality-ground-truth.json`)
|
|
1171
|
+
* @returns 로드된 Ground Truth 배열 또는 null (파일이 없거나 로드 실패 시)
|
|
1172
|
+
*
|
|
1173
|
+
* @example
|
|
1174
|
+
* ```typescript
|
|
1175
|
+
* const groundTruths = loadGroundTruth();
|
|
1176
|
+
* if (groundTruths) {
|
|
1177
|
+
* console.log(`로드된 Ground Truth 수: ${groundTruths.length}`);
|
|
1178
|
+
* } else {
|
|
1179
|
+
* console.log('Ground Truth 파일이 없습니다. 새로 생성합니다.');
|
|
1180
|
+
* const newGroundTruths = generateGroundTruth(memoryIds);
|
|
1181
|
+
* saveGroundTruth(newGroundTruths);
|
|
1182
|
+
* }
|
|
1183
|
+
* ```
|
|
1184
|
+
*/
|
|
1185
|
+
export declare function loadGroundTruth(filePath?: string): GroundTruth[] | null;
|
|
1186
|
+
/**
|
|
1187
|
+
* Ground Truth 생성 또는 로드
|
|
1188
|
+
* 파일이 있으면 로드하고, 없으면 자동 생성하여 저장합니다.
|
|
1189
|
+
*
|
|
1190
|
+
* @param memoryIds 메모리 ID 배열
|
|
1191
|
+
* @param options 생성 옵션 (파일이 없을 때만 사용)
|
|
1192
|
+
* @param filePath Ground Truth 파일 경로 (기본값: `data/vector-search-quality-ground-truth.json`)
|
|
1193
|
+
* @returns Ground Truth 배열
|
|
1194
|
+
*
|
|
1195
|
+
* @example
|
|
1196
|
+
* ```typescript
|
|
1197
|
+
* // 파일이 있으면 로드, 없으면 생성
|
|
1198
|
+
* const groundTruths = generateOrLoadGroundTruth(memoryIds, {
|
|
1199
|
+
* seed: 12345,
|
|
1200
|
+
* queries: ['React', 'TypeScript']
|
|
1201
|
+
* });
|
|
1202
|
+
* ```
|
|
1203
|
+
*/
|
|
1204
|
+
export declare function generateOrLoadGroundTruth(memoryIds: string[], options?: GroundTruthGenerationOptions, filePath?: string): GroundTruth[];
|
|
1205
|
+
/**
|
|
1206
|
+
* 리포트 저장 옵션
|
|
1207
|
+
*/
|
|
1208
|
+
export interface ReportSaveOptions {
|
|
1209
|
+
/**
|
|
1210
|
+
* 저장할 파일 경로 (기본값: 리포트 타입에 따라 자동 생성)
|
|
1211
|
+
*/
|
|
1212
|
+
filePath?: string;
|
|
1213
|
+
/**
|
|
1214
|
+
* 저장 형식 ('json' | 'markdown' | 'both')
|
|
1215
|
+
*/
|
|
1216
|
+
format?: 'json' | 'markdown' | 'both';
|
|
1217
|
+
/**
|
|
1218
|
+
* 파일명에 타임스탬프 포함 여부 (기본값: true)
|
|
1219
|
+
*/
|
|
1220
|
+
includeTimestamp?: boolean;
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* 순서 보존 리포트 저장
|
|
1224
|
+
* 순서 보존 리포트를 JSON 또는 Markdown 형식으로 파일에 저장합니다.
|
|
1225
|
+
*
|
|
1226
|
+
* @param report 저장할 순서 보존 리포트
|
|
1227
|
+
* @param options 저장 옵션
|
|
1228
|
+
*
|
|
1229
|
+
* @example
|
|
1230
|
+
* ```typescript
|
|
1231
|
+
* const report = generateOrderPreservationReport(pair);
|
|
1232
|
+
* saveOrderPreservationReport(report, { format: 'markdown' });
|
|
1233
|
+
* ```
|
|
1234
|
+
*/
|
|
1235
|
+
export declare function saveOrderPreservationReport(report: OrderPreservationReport, options?: ReportSaveOptions): void;
|
|
1236
|
+
/**
|
|
1237
|
+
* 품질 비교 리포트 저장
|
|
1238
|
+
* 품질 비교 리포트를 JSON 또는 Markdown 형식으로 파일에 저장합니다.
|
|
1239
|
+
*
|
|
1240
|
+
* @param report 저장할 품질 비교 리포트
|
|
1241
|
+
* @param options 저장 옵션
|
|
1242
|
+
*
|
|
1243
|
+
* @example
|
|
1244
|
+
* ```typescript
|
|
1245
|
+
* const report = generateQualityComparisonReport(comparison, groundTruth);
|
|
1246
|
+
* saveQualityComparisonReport(report, { format: 'markdown' });
|
|
1247
|
+
* ```
|
|
1248
|
+
*/
|
|
1249
|
+
export declare function saveQualityComparisonReport(report: QualityComparisonReport, options?: ReportSaveOptions): void;
|
|
1250
|
+
/**
|
|
1251
|
+
* 극단적 시나리오 리포트 저장
|
|
1252
|
+
* 극단적 시나리오 리포트를 JSON 또는 Markdown 형식으로 파일에 저장합니다.
|
|
1253
|
+
*
|
|
1254
|
+
* @param report 저장할 극단적 시나리오 리포트
|
|
1255
|
+
* @param options 저장 옵션
|
|
1256
|
+
*
|
|
1257
|
+
* @example
|
|
1258
|
+
* ```typescript
|
|
1259
|
+
* const report = generateExtremeScenarioReport(lowVectorHigh, highVectorLow, w2Validation);
|
|
1260
|
+
* saveExtremeScenarioReport(report, { format: 'markdown' });
|
|
1261
|
+
* ```
|
|
1262
|
+
*/
|
|
1263
|
+
export declare function saveExtremeScenarioReport(report: ExtremeScenarioReport, options?: ReportSaveOptions): void;
|
|
1264
|
+
/**
|
|
1265
|
+
* 통합 리포트 저장
|
|
1266
|
+
* 모든 리포트(순서 보존, 품질 비교, 극단적 시나리오)를 하나의 파일로 저장합니다.
|
|
1267
|
+
*
|
|
1268
|
+
* @param reports 저장할 리포트들
|
|
1269
|
+
* @param options 저장 옵션
|
|
1270
|
+
*
|
|
1271
|
+
* @example
|
|
1272
|
+
* ```typescript
|
|
1273
|
+
* const orderReport = generateOrderPreservationReport(pair);
|
|
1274
|
+
* const qualityReport = generateQualityComparisonReport(comparison, groundTruth);
|
|
1275
|
+
* const extremeReport = generateExtremeScenarioReport(lowVectorHigh, highVectorLow, w2Validation);
|
|
1276
|
+
* saveIntegratedReport({ orderReport, qualityReport, extremeReport }, { format: 'markdown' });
|
|
1277
|
+
* ```
|
|
1278
|
+
*/
|
|
1279
|
+
export interface IntegratedReports {
|
|
1280
|
+
orderReport?: OrderPreservationReport;
|
|
1281
|
+
qualityReport?: QualityComparisonReport;
|
|
1282
|
+
extremeReport?: ExtremeScenarioReport;
|
|
1283
|
+
baselineComparison?: BaselineComparisonResult;
|
|
1284
|
+
qualityDegradation?: QualityDegradationDetection;
|
|
1285
|
+
}
|
|
1286
|
+
export declare function saveIntegratedReport(reports: IntegratedReports, options?: ReportSaveOptions): void;
|
|
1287
|
+
//# sourceMappingURL=vector-search-quality-metrics.d.ts.map
|