generateTextReport generates a human-readable text report
(report *BatchAnalysisReport)
| 481 | |
| 482 | // generateTextReport generates a human-readable text report |
| 483 | func generateTextReport(report *BatchAnalysisReport) string { |
| 484 | var sb strings.Builder |
| 485 | |
| 486 | sb.WriteString("Batch Analysis Report\n") |
| 487 | sb.WriteString("=====================\n") |
| 488 | sb.WriteString(fmt.Sprintf("Batch Directories: %s\n", strings.Join(report.BatchDirectories, ", "))) |
| 489 | sb.WriteString(fmt.Sprintf("Analysis Date: %s\n\n", report.AnalysisDate.Format("2006-01-02 15:04:05"))) |
| 490 | |
| 491 | sb.WriteString("Model Performance Summary:\n") |
| 492 | sb.WriteString("--------------------------\n") |
| 493 | |
| 494 | for _, model := range report.Models { |
| 495 | sb.WriteString(fmt.Sprintf("%s:\n", model.ModelName)) |
| 496 | if model.BatchSource != "" { |
| 497 | sb.WriteString(fmt.Sprintf(" Batch Source: %s\n", model.BatchSource)) |
| 498 | } |
| 499 | sb.WriteString(fmt.Sprintf(" Runs: %d, Tests: %d\n", model.TotalRuns, model.TotalTests)) |
| 500 | sb.WriteString(fmt.Sprintf(" Average Response Time: %.2fs\n", model.AverageResponseTime)) |
| 501 | sb.WriteString(" Tool Invocation (Binary):\n") |
| 502 | sb.WriteString(fmt.Sprintf(" Precision: %.3f (%d/%d)\n", |
| 503 | model.ToolInvocation.Precision, |
| 504 | model.ToolInvocation.TruePositives, |
| 505 | model.ToolInvocation.TruePositives+model.ToolInvocation.FalsePositives)) |
| 506 | sb.WriteString(fmt.Sprintf(" Recall: %.3f (%d/%d)\n", |
| 507 | model.ToolInvocation.Recall, |
| 508 | model.ToolInvocation.TruePositives, |
| 509 | model.ToolInvocation.TruePositives+model.ToolInvocation.FalseNegatives)) |
| 510 | sb.WriteString(fmt.Sprintf(" F1: %.3f\n", model.ToolInvocation.F1)) |
| 511 | |
| 512 | sb.WriteString(" Tool Selection:\n") |
| 513 | sb.WriteString(fmt.Sprintf(" Precision: %.3f (%d/%d)\n", |
| 514 | model.ToolSelection.Precision, |
| 515 | model.ToolSelection.TruePositives, |
| 516 | model.ToolSelection.TruePositives+model.ToolSelection.FalsePositives)) |
| 517 | sb.WriteString(fmt.Sprintf(" Recall: %.3f (%d/%d)\n", |
| 518 | model.ToolSelection.Recall, |
| 519 | model.ToolSelection.TruePositives, |
| 520 | model.ToolSelection.TruePositives+model.ToolSelection.FalseNegatives)) |
| 521 | sb.WriteString(fmt.Sprintf(" F1: %.3f\n\n", model.ToolSelection.F1)) |
| 522 | } |
| 523 | |
| 524 | if len(report.Models) > 1 { |
| 525 | sb.WriteString("Overall Rankings (by Tool Selection F1):\n") |
| 526 | sb.WriteString("-----------------------------------------\n") |
| 527 | for i, model := range report.Models { |
| 528 | sb.WriteString(fmt.Sprintf("%d. %s (F1: %.3f)\n", i+1, model.ModelName, model.ToolSelection.F1)) |
| 529 | } |
| 530 | sb.WriteString("\n") |
| 531 | } |
| 532 | |
| 533 | sb.WriteString(report.Summary) |
| 534 | |
| 535 | return sb.String() |
| 536 | } |
| 537 | |
| 538 | // generateSummary generates a summary of the analysis |
| 539 | func generateSummary(models []ModelAnalysis) string { |