File size: 35,455 Bytes
53f8912 566d56a 53f8912 9274963 53f8912 9274963 53f8912 2e11de3 18c3ac3 53f8912 9274963 53f8912 9274963 53f8912 9274963 53f8912 2e11de3 ab5cab9 2e11de3 ab5cab9 2e11de3 ab5cab9 2e11de3 ab5cab9 2e11de3 18c3ac3 79c8ff9 53f8912 566d56a 53f8912 566d56a 53f8912 566d56a 53f8912 18c3ac3 9274963 2e11de3 53f8912 9274963 53f8912 9274963 7242cca 9274963 53f8912 9274963 53f8912 18c3ac3 9274963 53f8912 9274963 53f8912 6748670 9274963 53f8912 6748670 9274963 53f8912 18c3ac3 9274963 53f8912 ab5cab9 53f8912 9274963 53f8912 18c3ac3 9274963 53f8912 18c3ac3 9274963 53f8912 18c3ac3 9274963 53f8912 18c3ac3 53f8912 18c3ac3 9274963 53f8912 18c3ac3 9ba470c 18c3ac3 53f8912 9274963 53f8912 9274963 523d53a 53f8912 9274963 53f8912 9274963 53f8912 7242cca 53f8912 90db99b 7242cca 90db99b 7242cca 90db99b 7242cca 90db99b 7242cca 90db99b 7242cca 53f8912 2e11de3 53f8912 2e11de3 53f8912 2e11de3 53f8912 90db99b d6d6bcf 90db99b d6d6bcf 90db99b 53f8912 90db99b 53f8912 90db99b d6d6bcf 90db99b d6d6bcf 90db99b 53f8912 90db99b 53f8912 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Interactive Report: Marathi Sentence Similarity</title>
--
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<!-- Chosen Palette: Dark Theme (Background: #121212, Text: #E0E0E0, Card: #1E1E1E, Accent: #80BFFF, Chart Colors: #98DF8A, #CCCCCC) -->
<!-- Application Structure Plan: The application is structured as a narrative journey through the research process. It starts with a high-level summary, then dives into three key phases: 1) Benchmarking various models, 2) Enhancing the best model via fine-tuning, and 3) Testing the model's robustness against real-world errors. This thematic, story-driven structure is chosen over a rigid report format to make the complex technical information more digestible and engaging for a broader audience. The user flow is guided by clear sections, interactive charts, and contextual explanations, culminating in a conclusion that summarizes the key insights. This approach prioritizes understanding and exploration over simple data presentation. -->
<!-- Visualization & Content Choices:
- Section 1 (Intro): Goal: Inform & Hook. Method: Large stat cards to present the key result upfront. Justification: Immediately grabs user attention and states the project's main success.
- Section 2 (Benchmarking): Goal: Compare. Method: Interactive Bar Chart (Chart.js) with buttons to switch metrics (Pearson, MSE, Accuracy). Justification: Allows users to compare 6 models across multiple metrics without overwhelming them with data. A single, switchable chart is cleaner than three separate static charts.
- Section 3 (Enhancement): Goal: Compare. Method: A grouped bar chart (Chart.js) showing "Before vs. After" fine-tuning. Justification: Clearly visualizes the performance lift achieved through fine-tuning, directly addressing the "enhancement" part of the research.
- Section 4 (Robustness): Goal: Compare & Analyze. Method: A grouped bar chart (Chart.js) comparing baseline vs. fine-tuned model performance on three different datasets (Clean, Basic Errors, Advanced Errors). Justification: This is the most effective way to show the fine-tuned model's superior resilience to noise, a key finding of the report.
- Section 5 (Process Flow): Goal: Organize. Method: A simple, non-interactive diagram built with HTML/CSS. Justification: Visually summarizes the research methodology, providing a clear mental map for the user.
- All text is dynamically supported by the visuals, explaining what is being shown and what the key takeaway is for that section.
-->
<!-- CONFIRMATION: NO SVG graphics used. NO Mermaid JS used. -->
<style>
body {
font-family: 'Inter', sans-serif;
background-color: #121212; /* Very dark gray, almost black */
color: #E0E0E0; /* Light gray text */
}
p {
text-align: justify; /* Justify all paragraphs */
}
.text-center p { /* Override for paragraphs within text-center containers if needed */
text-align: center;
}
.nav-button {
transition: all 0.3s ease;
border-bottom: 2px solid transparent;
}
.nav-button.active {
border-bottom-color: #80BFFF; /* Lighter blue accent for active button */
color: #80BFFF;
}
.card {
background-color: #1E1E1E; /* Slightly lighter dark background for cards */
border-radius: 0.75rem;
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.2);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.chart-container {
position: relative;
width: 100%;
max-width: 800px;
margin-left: auto;
margin-right: auto;
height: 400px;
max-height: 50vh;
}
/* Styling for metric buttons */
.metric-btn {
padding: 0.75rem 1.5rem; /* Increased padding */
border-radius: 0.5rem; /* Rounded corners */
font-weight: 600; /* Semi-bold font */
transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease; /* Added box-shadow to transition */
border: 1px solid #4B5563; /* Visible border, a darker gray */
background-color: #374151; /* Darker gray background for default state */
color: #E0E0E0; /* Light text color */
cursor: pointer; /* Indicate clickable */
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* Subtle shadow */
}
.metric-btn:hover {
background-color: #4B5563; /* Slightly lighter on hover */
color: #FFFFFF; /* White text on hover */
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); /* More prominent shadow on hover */
}
.metric-btn.active {
background-color: #80BFFF; /* Accent color for active button */
color: #121212; /* Dark text on active button */
border-color: #80BFFF; /* Accent border for active button */
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* Consistent shadow */
}
.feature-box, .insight-box {
background-color: #2A2A2A; /* Slightly lighter than card for distinction */
border-radius: 0.5rem;
padding: 1.5rem;
box-shadow: 0 2px 4px -1px rgb(0 0 0 / 0.2), 0 1px 2px -1px rgb(0 0 0 / 0.1);
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start; /* Align text to start */
text-align: justify; /* Justify text within boxes */
}
.feature-box strong, .insight-box strong {
color: #80BFFF; /* Accent color for strong text */
margin-bottom: 0.5rem;
font-size: 1.125rem; /* Equivalent to text-lg */
text-align: left; /* Ensure title in box is left-aligned */
width: 100%; /* Take full width */
}
.feature-box p, .insight-box p {
font-size: 0.95rem; /* Slightly smaller text for readability in boxes */
color: #C0C0C0; /* Slightly darker than main text for contrast */
text-align: justify; /* Ensure text within box is justified */
}
.gradio-iframe {
width: 100%;
height: 500px; /* Adjust height as needed */
border: 1px solid #4B5563; /* Darker border for iframe */
border-radius: 0.75rem;
}
</style>
</head>
<body class="antialiased">
<div class="container mx-auto px-4 py-8 sm:px-6 lg:px-8">
<!--
<header class="text-center mb-12">
<h1 class="text-4xl font-bold text-gray-50 mb-2">
Evaluating & Enhancing Marathi Sentence Similarity
</h1>
<p class="text-lg text-gray-300">
An interactive exploration of adapting AI for a low-resource language.
</p>
</header>
-->
<main>
<div id="overview" class="page-section space-y-8">
<div class="card p-6 md:p-8">
<h2 class="text-2xl font-bold text-gray-50 mb-4 text-center">Project Summary</h2>
<p class="text-gray-300 leading-relaxed mb-6">
Natural Language Processing (NLP) has made incredible strides, but many advancements are for high-resource languages like English. This project addresses the challenge of building effective tools for Marathi, a language spoken by over 99 million people. The goal was to find and enhance the best AI model for understanding semantic similarity between Marathi sentences. This interactive report walks you through the process, from benchmarking existing models to fine-tuning a champion and testing its resilience.
</p>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 text-center">
<div class="bg-blue-900 rounded-lg p-6">
<span class="text-4xl font-bold text-blue-200">6</span>
<p class="text-gray-200 mt-2">Models Benchmarked</p>
</div>
<div class="bg-green-900 rounded-lg p-6">
<span class="text-4xl font-bold text-green-200">92%</span>
<p class="text-gray-200 mt-2">Accuracy</p>
</div>
<div class="bg-orange-900 rounded-lg p-6">
<span class="text-4xl font-bold text-orange-200">0.98</span>
<p class="text-gray-200 mt-2">Final Pearson Correlation</p>
</div>
</div>
</div>
<div class="card p-6 md:p-8">
<h2 class="text-2xl font-bold text-gray-50 mb-4 text-center">The Research Journey</h2>
<p class="text-gray-300 leading-relaxed mb-6">
This research followed a structured, three-phase approach to systematically identify and improve upon the best model for the task. This visual guide outlines the steps we will explore in detail throughout this report.
</p>
<div class="flex flex-col md:flex-row items-center justify-center space-y-4 md:space-y-0 md:space-x-4 text-center">
<div class="flex-1 p-4 bg-gray-800 rounded-lg">
<div class="text-2xl font-bold text-blue-400 mb-2">1</div>
<h3 class="font-semibold text-gray-100">Benchmark</h3>
<p class="text-sm text-gray-300">Compared six pre-trained models to find the best baseline.</p>
</div>
<div class="text-2xl text-gray-500 font-light hidden md:block">→</div>
<div class="flex-1 p-4 bg-gray-800 rounded-lg">
<div class="text-2xl font-bold text-blue-400 mb-2">2</div>
<h3 class="font-semibold text-gray-100">Enhance</h3>
<p class="text-sm text-gray-300">Fine-tuned the top model on a larger Marathi dataset.</p>
</div>
<div class="text-2xl text-gray-500 font-light hidden md:block">→</div>
<div class="flex-1 p-4 bg-gray-800 rounded-lg">
<div class="text-2xl font-bold text-blue-400 mb-2">3</div>
<h3 class="font-semibold text-gray-100">Test Robustness</h3>
<p class="text-sm text-gray-300">Evaluated performance on grammatically flawed text.</p>
</div>
</div>
</div>
<div class="card p-6 md:p-8">
<h2 class="text-2xl font-bold text-gray-50 mb-2 text-center">Phase 1: Finding the Best Baseline Model</h2>
<p class="text-gray-300 leading-relaxed mb-6">
The first step was to establish a performance baseline. We evaluated six different pre-trained transformer models on a standard set of 200 human-annotated Marathi sentence pairs. The models included both multilingual options and one specifically pre-trained on Marathi text (L3Cube-MahaBERT). The chart below shows their performance across different metrics. Use the buttons to switch between Pearson Correlation (higher is better), Mean Squared Error (lower is better), and Accuracy.
</p>
<div class="text-center mb-6">
<button id="btn-pearson" class="metric-btn active">Pearson Correlation</button>
<button id="btn-mse" class="metric-btn ml-2">Mean Squared Error</button>
<button id="btn-accuracy" class="metric-btn ml-2">Accuracy</button>
</div>
<div class="chart-container">
<canvas id="benchmarkChart"></canvas>
</div>
<p id="benchmark-context" class="mt-4 text-center text-gray-300">The results clearly show that L3Cube-MahaBERT, the monolingual Marathi model, significantly outperforms the multilingual models, achieving the highest correlation with human judgments.</p>
</div>
<div class="card p-6 md:p-8">
<h2 class="text-2xl font-bold text-gray-50 mb-2 text-center">Phase 2: Enhancing the Champion with Fine-Tuning</h2>
<p class="text-gray-300 leading-relaxed mb-6">
After identifying L3Cube-MahaBERT as the strongest baseline model, the next step was to enhance its performance further. We fine-tuned the model on a larger dataset of approximately 5,700 Marathi sentence pairs. This process adapts the model's general language understanding to the specific task of semantic similarity. The chart below illustrates the significant performance improvement across all six key evaluation metrics after this fine-tuning process.
</p>
<div class="chart-container">
<canvas id="finetuneChart"></canvas>
</div>
</div>
<div class="card p-6 md:p-8">
<h2 class="text-2xl font-bold text-gray-50 mb-2 text-center">Phase 3: The Ultimate Test of Robustness</h2>
<p class="text-gray-300 leading-relaxed mb-6">
A good model should not only be accurate but also robust. Real-world text is often imperfect, containing typos or grammatical errors. To test this, we evaluated the baseline L3Cube model and our new fine-tuned version on three different datasets: a clean one, one with basic grammatical errors, and one with more advanced errors. The results demonstrate that fine-tuning not only boosts accuracy on clean data but dramatically improves the model's resilience to noisy, imperfect input.
</p>
<div class="chart-container">
<canvas id="robustnessChart"></canvas>
</div>
</div>
<div class="card p-6 md:p-8">
<h2 class="text-2xl font-bold text-gray-50 mb-4 text-center">Key Features of our Marathi NLP Project - Sentence Similarity Analysis</h2>
<p class="text-gray-300 leading-relaxed mb-6">
Our project focuses on advancing Natural Language Processing for Marathi, a low-resource language. We address the crucial task of sentence similarity detection using state-of-the-art transformer models. Key features include:
</p>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 xl:grid-cols-4 gap-4">
<div class="feature-box">
<strong>Systematic Model Evaluation</strong>
<p>We benchmarked six diverse transformer models, including the Marathi-specific L3Cube-MahaBERT and several multilingual options, to identify the most effective baseline.</p>
</div>
<div class="feature-box">
<strong>Performance Enhancement through Fine-tuning</strong>
<p>We significantly improved the top-performing model by fine-tuning it on a large Marathi sentence pair dataset, demonstrating substantial gains in accuracy and correlation.</p>
</div>
<div class="feature-box">
<strong>Robustness to Real-world Noise</strong>
<p>A unique aspect of our research is the rigorous testing of models on grammatically erroneous datasets, proving the fine-tuned model's superior resilience to imperfect text inputs.</p>
</div>
<div class="feature-box">
<strong>Practical Implications</strong>
<p>Our findings provide a clear roadmap for developing high-accuracy and robust NLP tools for Marathi and other low-resource languages, contributing to broader AI inclusivity.</p>
</div>
</div>
</div>
<div class="card p-6 md:p-8">
<h2 class="text-2xl font-bold text-gray-50 mb-4 text-center">Research Insights</h2>
<p class="text-gray-300 leading-relaxed mb-6">
The study yielded several critical insights into effective NLP development for low-resource languages:
</p>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 xl:grid-cols-4 gap-4">
<div class="insight-box">
<strong>Monolingual Models Excel</strong>
<p>Language-specific pre-training (e.g., L3Cube-MahaBERT) is crucial for capturing the semantic nuances of Marathi, outperforming general multilingual models lacking task-specific optimization.</p>
</div>
<div class="insight-box">
<strong>Fine-tuning is Transformative</strong>
<p>Task-specific fine-tuning, even on relatively smaller datasets, dramatically boosts performance, making models highly accurate and reliable for real-world applications.</p>
</div>
<div class="insight-box">
<strong>Robustness is Key</strong>
<p>Fine-tuning not only improves accuracy on clean data but also significantly enhances a model's ability to handle noisy, grammatically incorrect text, a common challenge in practical scenarios.</p>
</div>
<div class="insight-box">
<strong>SBERT Paradigm & Data Quality</strong>
<p>The Sentence-BERT (SBERT) fine-tuning approach is a dominant factor, and the careful curation and expansion of human-annotated datasets are foundational for successful model development.</p>
</div>
</div>
</div>
<div class="card p-6 md:p-8">
<h2 class="text-2xl font-bold text-gray-50 mb-4 text-center">Practical Applications in Real-World Scenarios</h2>
<p class="text-gray-300 leading-relaxed mb-6">
This Marathi Sentence Similarity project has several practical applications in real-world scenarios, especially given its focus on a low-resource language and its robustness to errors. These applications can significantly enhance various Marathi-language services and tools:
</p>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 xl:grid-cols-4 gap-4">
<div class="feature-box">
<strong>Improved Search & Information Retrieval</strong>
<p>Enhances search engines and databases for Marathi content by understanding the semantic meaning of queries, rather than just keywords. This leads to more accurate and relevant search results, even if the exact words don't match.</p>
</div>
<div class="feature-box">
<strong>Enhanced Chatbots & Virtual Assistants</strong>
<p>Enables more natural interactions with chatbots and virtual assistants for Marathi speakers, improving user experience in customer service, educational platforms, and general information retrieval.</p>
</div>
<div class="feature-box">
<strong>Content Moderation & Analysis</strong>
<p>Useful for identifying duplicate content, detecting plagiarism, and flagging inappropriate or abusive texts in Marathi, even if rephrased. This aids in maintaining healthier online environments.</p>
</div>
<div class="feature-box">
<strong>Education & Language Learning</strong>
<p>Can be used to develop tools that assess understanding in Marathi by comparing student answers to correct ones, or to provide feedback on sentence construction for language learners, facilitating better learning outcomes.</p>
</div>
</div>
</div>
<div class="card p-6 md:p-8 text-center">
<h2 class="text-2xl font-bold text-gray-50 mb-4">Key Conclusion</h2>
<p class="text-gray-300 leading-relaxed max-w-3xl mx-auto">
This research demonstrates a clear and effective path for developing NLP tools for low-resource languages like Marathi. The most successful strategy is to start with a language-specific pre-trained model and then fine-tune it on a task-specific dataset. This approach yields a model that is not only highly accurate but also robust enough to handle the complexities of real-world text, paving the way for more inclusive and capable AI.
</p>
</div>
</div>
</main>
<footer class="text-center mt-12 text-gray-400">
<p>Interactive Report created from the research by Sangam Sanjay Bhamare.</p>
</footer>
</div>
<script>
const benchmarkData = {
models: ['L3Cube', 'MuRIL', 'MiniLM', 'DistilUSE', 'BERT', 'E5'],
pearson: [0.8635, 0.4327, 0.8661, 0.1342, 0.3568, 0.4465],
mse: [0.0294, 0.3785, 0.0353, 0.3166, 0.2139, 0.3196],
accuracy: [0.4650, 0.1050, 0.4600, 0.1500, 0.2050, 0.1250]
};
const finetuneData = {
metrics: ['MSE', 'MAE', 'Pearson', 'Spearman', 'Accuracy (±0.1)', 'Collision Rate'],
baseline: [0.0232, 0.1181, 0.8722, 0.8549, 0.5249, 0.2712],
finetuned: [0.0036, 0.0457, 0.983, 0.9802, 0.9134, 0.2503]
};
const robustnessData = {
datasets: ['Clean Data', 'Basic Errors', 'Advanced Errors'],
baseline: [0.4673, 0.4623, 0.4121],
finetuned: [0.5226, 0.5477, 0.4774]
};
let benchmarkChart, finetuneChart, robustnessChart;
// Adjusted chart colors for a dark theme with better contrast
const chartColors = {
accent: '#80BFFF', /* Lighter blue for primary accent */
accentLight: 'rgba(128, 191, 255, 0.6)',
secondary: '#98DF8A', /* Lighter green for secondary data */
secondaryLight: 'rgba(152, 223, 138, 0.6)',
gray: '#CCCCCC', /* Light gray for chart text/lines */
grayLight: 'rgba(204, 204, 204, 0.2)' /* Very light gray for grid lines */
};
function formatLabel(str, maxLen = 16) {
if (str.length <= maxLen) return str;
const parts = str.split(' ');
let lines = [];
let currentLine = '';
for (const part of parts) {
if (currentLine.length + part.length + 1 <= maxLen) {
currentLine += (currentLine ? ' ' : '') + part;
} else {
lines.push(currentLine);
currentLine = part;
}
}
if (currentLine) lines.push(currentLine);
return lines;
}
document.addEventListener('DOMContentLoaded', () => {
// Set global Chart.js defaults for text color
Chart.defaults.color = chartColors.gray;
Chart.defaults.borderColor = chartColors.grayLight; // For grid lines and borders
const benchmarkCtx = document.getElementById('benchmarkChart').getContext('2d');
const finetuneCtx = document.getElementById('finetuneChart').getContext('2d');
const robustnessCtx = document.getElementById('robustnessChart').getContext('2d');
function createBenchmarkChart(metric) {
if (benchmarkChart) {
benchmarkChart.destroy();
}
const higherIsBetter = metric !== 'mse';
benchmarkChart = new Chart(benchmarkCtx, {
type: 'bar',
data: {
labels: benchmarkData.models,
datasets: [{
label: metric.toUpperCase(),
data: benchmarkData[metric],
backgroundColor: chartColors.accentLight,
borderColor: chartColors.accent,
borderWidth: 1
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
title: {
display: true,
text: `Score (${higherIsBetter ? 'Higher is Better' : 'Lower is Better'})`,
color: chartColors.gray
},
ticks: {
color: chartColors.gray
},
grid: {
color: chartColors.grayLight
}
},
x: {
ticks: {
color: chartColors.gray
},
grid: {
color: chartColors.grayLight
}
}
},
plugins: {
legend: {
display: false
},
tooltip: {
callbacks: {
title: (tooltipItems) => {
return `Model: ${tooltipItems[0].label}`;
},
label: (context) => {
return `${context.dataset.label}: ${context.raw.toFixed(4)}`;
}
}
}
}
}
});
}
createBenchmarkChart('pearson');
document.querySelectorAll('.metric-btn').forEach(button => {
button.addEventListener('click', (e) => {
const metric = e.target.id.split('-')[1];
createBenchmarkChart(metric);
// Remove active class from all buttons
document.querySelectorAll('.metric-btn').forEach(btn => {
btn.classList.remove('active');
});
// Add active class to the clicked button
e.target.classList.add('active');
const contextText = document.getElementById('benchmark-context');
if (metric === 'pearson') {
contextText.innerText = "The results clearly show that L3Cube-MahaBERT, the monolingual Marathi model, significantly outperforms the multilingual models, achieving the highest correlation with human judgments.";
} else if (metric === 'mse') {
contextText.innerText = "In terms of Mean Squared Error, L3Cube-MahaBERT achieves the lowest score, indicating its predictions are closest to the human-annotated ground truth.";
} else {
contextText.innerText = "With the highest accuracy, L3Cube-MahaBERT proves to be the most reliable model for correctly identifying sentence similarity within the defined tolerance.";
}
});
});
finetuneChart = new Chart(finetuneCtx, {
type: 'bar',
data: {
labels: finetuneData.metrics.map(m => formatLabel(m)),
datasets: [
{
label: 'Baseline',
data: finetuneData.baseline,
backgroundColor: chartColors.grayLight,
borderColor: chartColors.gray,
borderWidth: 1
},
{
label: 'Fine-tuned',
data: finetuneData.finetuned,
backgroundColor: chartColors.secondaryLight,
borderColor: chartColors.secondary,
borderWidth: 1
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
title: { display: true, text: 'Performance Score', color: chartColors.gray },
ticks: {
color: chartColors.gray
},
grid: {
color: chartColors.grayLight
}
},
x: {
ticks: {
color: chartColors.gray
},
grid: {
color: chartColors.grayLight
}
}
},
plugins: {
title: { display: true, text: 'Performance: Baseline vs. Fine-tuned', color: chartColors.gray },
legend: {
position: 'top',
labels: {
color: chartColors.gray
}
},
tooltip: {
callbacks: {
label: (context) => {
let label = context.dataset.label || '';
if (label) {
label += ': ';
}
if (context.parsed.y !== null) {
// Format Accuracy and Collision Rate as percentages
if (context.label.includes('Accuracy') || context.label.includes('Collision')) {
return `${label}${(context.raw * 100).toFixed(2)}%`;
}
return `${label}${context.raw.toFixed(4)}`;
}
return label;
}
}
}
}
}
});
robustnessChart = new Chart(robustnessCtx, {
type: 'bar',
data: {
labels: robustnessData.datasets.map(d => formatLabel(d)),
datasets: [
{
label: 'Baseline Model',
data: robustnessData.baseline,
backgroundColor: chartColors.grayLight,
borderColor: chartColors.gray,
borderWidth: 1
},
{
label: 'Fine-tuned Model',
data: robustnessData.finetuned,
backgroundColor: chartColors.secondaryLight,
borderColor: chartColors.secondary,
borderWidth: 1
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
title: { display: true, text: 'Accuracy Score (Higher is Better)', color: chartColors.gray },
ticks: {
color: chartColors.gray
},
grid: {
color: chartColors.grayLight
}
},
x: {
ticks: {
color: chartColors.gray
},
grid: {
color: chartColors.grayLight
}
}
},
plugins: {
title: { display: true, text: 'Model Accuracy on Clean vs. Noisy Data', color: chartColors.gray },
legend: {
position: 'top',
labels: {
color: chartColors.gray
}
},
tooltip: {
callbacks: {
label: (context) => {
let label = context.dataset.label || '';
if (label) {
label += ': ';
}
if (context.parsed.y !== null) {
label += `${(context.parsed.y * 100).toFixed(1)}%`;
}
return label;
}
}
}
}
}
});
});
</script>
</body>
</html>
|