alexandremoraisdarosa commited on
Commit
e786a26
·
verified ·
1 Parent(s): 21af66c

Add 2 files

Browse files
Files changed (2) hide show
  1. index.html +231 -117
  2. prompts.txt +2 -1
index.html CHANGED
@@ -6,101 +6,181 @@
6
  <title>Matriz de Confusão</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
 
9
  <style>
10
  body {
11
- background-color: #ffffff;
12
- color: #000000;
13
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
 
14
  }
15
  #center {
16
- @apply max-w-4xl mx-auto p-6 bg-blue-950 rounded-lg shadow-xl text-white mt-8;
17
  }
18
  #title {
19
- @apply text-4xl font-extrabold text-center mb-2 text-white;
20
- text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
21
  }
22
  #breadcrumps ol {
23
- @apply flex text-sm mb-6 space-x-2 text-gray-300;
 
24
  }
25
  #breadcrumps a {
26
- @apply hover:text-white transition-colors;
 
 
 
27
  }
28
  .info {
29
- @apply text-sm text-gray-300 mt-3 mb-1;
 
 
 
30
  }
 
 
 
 
31
  label {
32
- @apply block mt-2 text-white font-medium;
33
  }
34
  input[type="text"] {
35
- @apply border border-gray-600 rounded px-3 py-1 bg-gray-800 text-white focus:outline-none focus:ring-2 focus:ring-blue-500;
36
  }
37
  button {
38
- @apply mt-4 bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-6 rounded transition-colors duration-200 shadow-md;
39
- }
40
- button:hover {
41
- @apply transform scale-105;
42
  }
43
  .cf {
44
- @apply mt-4 text-sm text-gray-400;
45
  }
46
  .cf a {
47
- @apply text-blue-300 hover:underline;
48
  }
49
  .matrix {
50
- @apply mt-6 grid grid-cols-2 gap-0 border border-gray-500 text-center text-lg font-bold;
51
- box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.1);
52
  }
53
- .matrix-cell {
54
- @apply p-4 border border-gray-600 flex flex-col justify-center items-center;
55
  }
56
  .matrix-header {
57
- @apply bg-gray-800 text-white py-2 font-semibold;
 
 
 
 
 
 
 
58
  }
 
 
 
 
59
  .metric-card {
60
- @apply mt-6 p-4 bg-gray-800 rounded-lg shadow border border-gray-700;
61
  }
62
  .metric-title {
63
- @apply font-bold text-blue-300 text-sm uppercase tracking-wider;
64
  }
65
  .metric-value {
66
- @apply text-2xl font-extrabold text-white;
67
  }
68
  .instructions {
69
- @apply mt-8 p-5 bg-gray-800 rounded-lg text-gray-200 text-sm leading-relaxed border border-gray-700;
70
  }
71
  .instructions h3 {
72
- @apply font-bold text-white text-lg mb-2;
73
  }
74
  .instructions ul {
75
- @apply list-disc list-inside ml-4 space-y-1 mb-3;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  }
77
  </style>
78
  </head>
79
- <body class="bg-white text-black">
80
 
81
  <!-- Header -->
82
- <header class="bg-blue-950 text-white py-6 shadow-md">
83
  <div class="container mx-auto text-center">
84
- <h1 class="text-3xl font-bold"><i class="fas fa-project-diagram mr-2"></i>Aplicativo de Matriz de Confusão</h1>
85
- <p class="mt-2 text-blue-200">Analise o desempenho do seu modelo de classificação com precisão</p>
 
 
86
  </div>
87
  </header>
88
 
89
  <!-- Main Content -->
90
- <div id="center" class="transition-all duration-300 ease-in-out">
91
 
92
  <!-- Breadcrumb -->
93
- <div id="breadcrumps">
94
- <ol itemscope itemtype="http://schema.org/BreadcrumbList" class="flex">
95
  <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
96
- <a itemprop="item" href="#" class="flex items-center">
 
97
  <span itemprop="name">Processamento de Dados</span>
98
  </a>
99
  <meta itemprop="position" content="1" />
100
  </li>
101
- <span class="mx-2">›</span>
102
  <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
103
- <a itemprop="item" href="#" class="flex items-center">
 
104
  <span itemprop="name">Matriz de Confusão</span>
105
  </a>
106
  <meta itemprop="position" content="2" />
@@ -108,77 +188,98 @@
108
  </ol>
109
  </div>
110
 
111
- <!-- Confusion Matrix Form -->
112
- <h2 class="h2_form text-2xl font-bold text-white mb-4">Matriz de Confusão</h2>
113
- <form id="confusion_matrix" method="post" class="bg-gray-900 p-6 rounded-lg shadow-inner">
 
 
114
 
115
- <!-- True Positive -->
116
- <p class="info">
117
- <i class="fas fa-check-circle text-green-400 mr-1"></i>
118
- Positivo Verdadeiro (PV): item declarado VERDADEIRO, e na realidade VERDADEIRO
119
- </p>
120
- <label for="confusion_matrix_tp">Número de Positivos Verdadeiros (PV)</label>
121
- <input type="text" id="confusion_matrix_tp" name="tp" value="70" size="8" spellcheck="false" class="w-full" />
122
-
123
- <!-- False Positive -->
124
- <p class="info mt-4">
125
- <i class="fas fa-exclamation-triangle text-yellow-400 mr-1"></i>
126
- Falso Positivo (FP) ou Erro Tipo I: item declarado VERDADEIRO mas na realidade FALSO
127
- </p>
128
- <label for="confusion_matrix_fp">Número de Falsos Positivos (FP)</label>
129
- <input type="text" id="confusion_matrix_fp" name="fp" value="5" size="8" spellcheck="false" class="w-full" />
130
-
131
- <!-- True Negative -->
132
- <p class="info mt-4">
133
- <i class="fas fa-check-circle text-green-400 mr-1"></i>
134
- Negativo Verdadeiro (NV): item declarado FALSO, e na realidade FALSO
135
- </p>
136
- <label for="confusion_matrix_tn">Número de Negativos Verdadeiros (NV)</label>
137
- <input type="text" id="confusion_matrix_tn" name="tn" value="15" size="8" spellcheck="false" class="w-full" />
138
-
139
- <!-- False Negative -->
140
- <p class="info mt-4">
141
- <i class="fas fa-times-circle text-red-400 mr-1"></i>
142
- Falso Negativo (FN) ou Erro Tipo II: item declarado FALSO mas na realidade VERDADEIRO
143
- </p>
144
- <label for="confusion_matrix_fn">Número de Falsos Negativos (FN)</label>
145
- <input type="text" id="confusion_matrix_fn" name="fn" value="10" size="8" spellcheck="false" class="w-full" />
 
 
 
 
 
 
 
 
 
 
146
 
147
  <!-- Analyze Button -->
148
- <button type="button" id="analyzeBtn" class="mt-6 flex items-center justify-center">
149
- <i class="fas fa-calculator mr-2"></i> Analisar
150
- </button>
 
 
151
 
152
  <!-- Related Tools -->
153
- <div class="cf mt-6 text-center">
154
- <span>Consulte também:</span>
155
- <a href="#" class="ml-1">Precisão e Revocação</a>
156
- <a href="#" class="ml-1">Sensibilidade e Especificidade</a>
 
 
 
 
 
157
  </div>
158
- </form>
159
 
160
  <!-- Confusion Matrix Display -->
161
- <div id="matrixContainer" class="mt-8 hidden">
162
- <h3 class="text-xl font-bold text-center text-white mb-4">Matriz de Confusão</h3>
 
 
163
  <div class="flex justify-center">
164
- <table class="matrix border-collapse text-white text-center">
165
- <thead>
166
  <tr>
167
- <th class="matrix-header"></th>
168
- <th class="matrix-header">Previsto: Sim</th>
169
- <th class="matrix-header">Previsto: Não</th>
170
  </tr>
171
  </thead>
172
  <tbody>
173
- <tr>
174
- <td class="matrix-header">Real: Sim</td>
175
- <td id="cell_tp" class="matrix-cell bg-green-900/50">PV</td>
176
- <td id="cell_fn" class="matrix-cell bg-red-900/50">FN</td>
177
  </tr>
178
- <tr>
179
- <td class="matrix-header">Real: Não</td>
180
- <td id="cell_fp" class="matrix-cell bg-yellow-900/50">FP</td>
181
- <td id="cell_tn" class="matrix-cell bg-blue-900/50">NV</td>
182
  </tr>
183
  </tbody>
184
  </table>
@@ -186,43 +287,47 @@
186
  </div>
187
 
188
  <!-- Metrics Display -->
189
- <div id="metricsContainer" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mt-6 hidden">
190
- <div class="metric-card">
191
  <div class="metric-title">Acurácia</div>
192
  <div id="accuracy" class="metric-value">--</div>
 
193
  </div>
194
- <div class="metric-card">
195
  <div class="metric-title">Precisão (PV)</div>
196
  <div id="precision" class="metric-value">--</div>
 
197
  </div>
198
- <div class="metric-card">
199
  <div class="metric-title">Sensibilidade</div>
200
  <div id="recall" class="metric-value">--</div>
 
201
  </div>
202
- <div class="metric-card">
203
  <div class="metric-title">Especificidade</div>
204
  <div id="specificity" class="metric-value">--</div>
 
205
  </div>
206
  </div>
207
 
208
  <!-- Instructions -->
209
- <div class="instructions mt-8">
210
- <h3><i class="fas fa-lightbulb mr-2"></i>Instruções de Uso</h3>
211
  <ul>
212
- <li><strong>PV (Positivo Verdadeiro):</strong> Quantidade de instâncias corretamente classificadas como positivas.</li>
213
- <li><strong>FP (Falso Positivo):</strong> Quantidade de instâncias negativas classificadas incorretamente como positivas (Erro Tipo I).</li>
214
- <li><strong>NV (Negativo Verdadeiro):</strong> Quantidade de instâncias corretamente classificadas como negativas.</li>
215
- <li><strong>FN (Falso Negativo):</strong> Quantidade de instâncias positivas classificadas incorretamente como negativas (Erro Tipo II).</li>
216
  </ul>
217
- <p>Após preencher os valores, clique em <strong>Analisar</strong> para gerar a matriz e visualizar métricas de desempenho do modelo.</p>
218
- <p class="mt-2"><i class="fas fa-info-circle text-blue-400 mr-1"></i> Este aplicativo é ideal para cientistas de dados, analistas e estudantes que desejam avaliar modelos de classificação binária.</p>
219
  </div>
220
 
221
  </div>
222
 
223
  <!-- Footer -->
224
- <footer class="bg-blue-950 text-gray-400 py-4 text-center text-sm mt-12">
225
- <p>© 2023 Aplicativo de Matriz de Confusão | Desenvolvido para análise de modelos de classificação</p>
226
  </footer>
227
 
228
  <script>
@@ -239,15 +344,24 @@
239
  document.getElementById('cell_tn').textContent = tn;
240
  document.getElementById('cell_fn').textContent = fn;
241
 
242
- // Show matrix and metrics
243
- document.getElementById('matrixContainer').classList.remove('hidden');
244
- document.getElementById('metricsContainer').classList.remove('hidden');
 
 
 
 
 
 
 
 
245
 
246
  // Calculate metrics
247
- const accuracy = (tp + tn) / (tp + fp + tn + fn);
248
- const precision = tp / (tp + fp) || 0;
249
- const recall = tp / (tp + fn) || 0; // also known as sensitivity
250
- const specificity = tn / (tn + fp) || 0;
 
251
 
252
  // Display metrics
253
  document.getElementById('accuracy').textContent = accuracy.toFixed(3);
 
6
  <title>Matriz de Confusão</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
9
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
10
  <style>
11
  body {
12
+ background: linear-gradient(135deg, #000000 0%, #001833 100%);
13
+ color: #ffffff;
14
+ font-family: 'Inter', sans-serif;
15
+ background-attachment: fixed;
16
  }
17
  #center {
18
+ @apply max-w-6xl mx-auto p-8 bg-blue-950/30 backdrop-blur-lg rounded-2xl shadow-2xl text-white mt-10 border border-blue-800/30;
19
  }
20
  #title {
21
+ @apply text-5xl font-extrabold text-center mb-2 bg-gradient-to-r from-white to-blue-200 bg-clip-text text-transparent;
22
+ text-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
23
  }
24
  #breadcrumps ol {
25
+ @apply flex text-sm mb-8 space-x-2 text-gray-300;
26
+ list-style: none;
27
  }
28
  #breadcrumps a {
29
+ @apply hover:text-white transition-all duration-300 flex items-center;
30
+ }
31
+ #breadcrumps a:hover i {
32
+ @apply text-blue-300;
33
  }
34
  .info {
35
+ @apply text-sm text-gray-300 mt-3 mb-1 flex items-start;
36
+ }
37
+ .info i {
38
+ @apply mr-2 mt-0.5 text-lg;
39
  }
40
+ .true-positive .info i { @apply text-green-400; }
41
+ .false-positive .info i { @apply text-yellow-400; }
42
+ .true-negative .info i { @apply text-blue-400; }
43
+ .false-negative .info i { @apply text-red-400; }
44
  label {
45
+ @apply block mt-2 text-white font-semibold;
46
  }
47
  input[type="text"] {
48
+ @apply border border-gray-600 rounded-lg px-4 py-2 bg-gray-800/70 text-white focus:outline-none focus:ring-3 focus:ring-blue-500 transition-all duration-200 w-full;
49
  }
50
  button {
51
+ @apply mt-6 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-700 hover:to-blue-800 text-white font-bold py-3 px-8 rounded-xl transition-all duration-300 shadow-lg hover:shadow-xl transform hover:scale-105;
 
 
 
52
  }
53
  .cf {
54
+ @apply mt-6 text-sm text-gray-400;
55
  }
56
  .cf a {
57
+ @apply text-blue-300 hover:underline hover:text-blue-200 transition-colors;
58
  }
59
  .matrix {
60
+ @apply mt-8 w-full border border-blue-700 rounded-lg overflow-hidden;
61
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
62
  }
63
+ .matrix th, .matrix td {
64
+ @apply p-4;
65
  }
66
  .matrix-header {
67
+ @apply bg-blue-900/80 text-white text-center font-bold text-base uppercase tracking-wider;
68
+ }
69
+ .matrix-cell {
70
+ @apply text-center font-bold text-lg relative;
71
+ transition: all 0.3s ease;
72
+ }
73
+ .matrix-cell:hover {
74
+ @apply transform scale-105 z-10;
75
  }
76
+ #cell_tp { @apply bg-green-900/40 text-green-100; }
77
+ #cell_fp { @apply bg-yellow-900/40 text-yellow-100; }
78
+ #cell_tn { @apply bg-blue-900/40 text-blue-100; }
79
+ #cell_fn { @apply bg-red-900/40 text-red-100; }
80
  .metric-card {
81
+ @apply p-6 bg-gradient-to-b from-gray-900/80 to-gray-800/80 backdrop-blur-sm rounded-xl shadow-lg border border-gray-700/50 text-center transition-all duration-300 hover:shadow-xl;
82
  }
83
  .metric-title {
84
+ @apply font-bold text-blue-300 text-sm uppercase tracking-widest mb-2 opacity-90;
85
  }
86
  .metric-value {
87
+ @apply text-3xl md:text-4xl font-extrabold bg-gradient-to-r from-white to-gray-300 bg-clip-text text-transparent;
88
  }
89
  .instructions {
90
+ @apply mt-10 p-6 bg-black/30 rounded-xl text-gray-200 text-sm leading-relaxed border border-gray-700/50;
91
  }
92
  .instructions h3 {
93
+ @apply flex items-center font-bold text-white text-lg mb-3;
94
  }
95
  .instructions ul {
96
+ @apply list-disc list-inside ml-6 space-y-2 mb-4;
97
+ }
98
+ .instructions p {
99
+ @apply mt-3;
100
+ }
101
+ .tooltip {
102
+ @apply relative inline-block;
103
+ }
104
+ .tooltip .tooltiptext {
105
+ visibility: hidden;
106
+ width: 220px;
107
+ background-color: #1e293b;
108
+ color: #e2e8f0;
109
+ text-align: center;
110
+ border-radius: 6px;
111
+ padding: 8px;
112
+ position: absolute;
113
+ z-index: 1;
114
+ bottom: 125%;
115
+ left: 50%;
116
+ margin-left: -110px;
117
+ opacity: 0;
118
+ transition: opacity 0.3s;
119
+ font-size: 14px;
120
+ border: 1px solid #334155;
121
+ box-shadow: 0 5px 15px rgba(0,0,0,0.2);
122
+ }
123
+ .tooltip .tooltiptext::after {
124
+ content: "";
125
+ position: absolute;
126
+ top: 100%;
127
+ left: 50%;
128
+ margin-left: -5px;
129
+ border-width: 5px;
130
+ border-style: solid;
131
+ border-color: #1e293b transparent transparent transparent;
132
+ }
133
+ .tooltip:hover .tooltiptext {
134
+ visibility: visible;
135
+ opacity: 1;
136
+ }
137
+ footer {
138
+ @apply bg-blue-950/30 backdrop-blur-sm text-gray-400 py-6 text-center text-sm mt-16 border-t border-blue-800/30;
139
+ }
140
+ .fade-in {
141
+ animation: fadeIn 0.6s ease-in-out;
142
+ }
143
+ @keyframes fadeIn {
144
+ from { opacity: 0; transform: translateY(10px); }
145
+ to { opacity: 1; transform: translateY(0); }
146
+ }
147
+ .form-row {
148
+ @apply mb-6;
149
+ }
150
+ .form-container {
151
+ @apply bg-gradient-to-br from-gray-900/50 to-gray-800/50 p-8 rounded-2xl shadow-xl border border-gray-700/50;
152
  }
153
  </style>
154
  </head>
155
+ <body class="bg-black text-white">
156
 
157
  <!-- Header -->
158
+ <header class="bg-blue-950/80 backdrop-blur-sm text-white py-8 shadow-lg">
159
  <div class="container mx-auto text-center">
160
+ <h1 class="text-4xl font-bold"><i class="fas fa-project-diagram mr-3"></i>Aplicativo de Matriz de Confusão</h1>
161
+ <p class="mt-3 text-blue-200 text-lg max-w-3xl mx-auto leading-relaxed">
162
+ Analise o desempenho do seu modelo de classificação com precisão e facilidade. Insira os valores e obtenha métricas essenciais em segundos.
163
+ </p>
164
  </div>
165
  </header>
166
 
167
  <!-- Main Content -->
168
+ <div id="center" class="transition-all duration-500 ease-in-out">
169
 
170
  <!-- Breadcrumb -->
171
+ <div id="breadcrumps" class="mt-6">
172
+ <ol itemscope itemtype="http://schema.org/BreadcrumbList" class="flex items-center justify-center">
173
  <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
174
+ <a itemprop="item" href="#" class="flex items-center hover:text-blue-300 transition-colors">
175
+ <i class="fas fa-database mr-1"></i>
176
  <span itemprop="name">Processamento de Dados</span>
177
  </a>
178
  <meta itemprop="position" content="1" />
179
  </li>
180
+ <span class="mx-2 opacity-50"><i class="fas fa-chevron-right"></i></span>
181
  <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
182
+ <a itemprop="item" href="#" class="flex items-center hover:text-blue-300 transition-colors">
183
+ <i class="fas fa-project-diagram mr-1"></i>
184
  <span itemprop="name">Matriz de Confusão</span>
185
  </a>
186
  <meta itemprop="position" content="2" />
 
188
  </ol>
189
  </div>
190
 
191
+ <div class="form-container mt-8">
192
+ <!-- Confusion Matrix Form -->
193
+ <h2 class="h2_form text-3xl font-bold text-center text-white mb-6 flex items-center justify-center">
194
+ <i class="fas fa-edit mr-3"></i>Entrada de Dados
195
+ </h2>
196
 
197
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
198
+ <!-- True Positive -->
199
+ <div class="true-positive">
200
+ <p class="info">
201
+ <i class="fas fa-check-circle"></i>
202
+ <span><strong>Positivo Verdadeiro (PV):</strong> itens corretamente previstos como positivos (verdadeiros positivos).</span>
203
+ </p>
204
+ <label for="confusion_matrix_tp"><i class="fas fa-check-circle text-green-400 mr-2"></i>PV (VERDADEIRO POSITIVO)</label>
205
+ <input type="text" id="confusion_matrix_tp" name="tp" value="70" size="8" spellcheck="false" class="mt-1" />
206
+ </div>
207
+
208
+ <!-- False Positive -->
209
+ <div class="false-positive">
210
+ <p class="info">
211
+ <i class="fas fa-exclamation-triangle"></i>
212
+ <span><strong>Falso Positivo (FP):</strong> itens negativos classificados incorretamente como positivos (Erro Tipo I).</span>
213
+ </p>
214
+ <label for="confusion_matrix_fp"><i class="fas fa-exclamation-triangle text-yellow-400 mr-2"></i>FP (FALSO POSITIVO)</label>
215
+ <input type="text" id="confusion_matrix_fp" name="fp" value="5" size="8" spellcheck="false" class="mt-1" />
216
+ </div>
217
+
218
+ <!-- True Negative -->
219
+ <div class="true-negative">
220
+ <p class="info">
221
+ <i class="fas fa-check-circle"></i>
222
+ <span><strong>Negativo Verdadeiro (NV):</strong> itens corretamente previstos como negativos (verdadeiros negativos).</span>
223
+ </p>
224
+ <label for="confusion_matrix_tn"><i class="fas fa-check-circle text-blue-400 mr-2"></i>NV (VERDADEIRO NEGATIVO)</label>
225
+ <input type="text" id="confusion_matrix_tn" name="tn" value="15" size="8" spellcheck="false" class="mt-1" />
226
+ </div>
227
+
228
+ <!-- False Negative -->
229
+ <div class="false-negative">
230
+ <p class="info">
231
+ <i class="fas fa-times-circle"></i>
232
+ <span><strong>Falso Negativo (FN):</strong> itens positivos classificados incorretamente como negativos (Erro Tipo II).</span>
233
+ </p>
234
+ <label for="confusion_matrix_fn"><i class="fas fa-times-circle text-red-400 mr-2"></i>FN (FALSO NEGATIVO)</label>
235
+ <input type="text" id="confusion_matrix_fn" name="fn" value="10" size="8" spellcheck="false" class="mt-1" />
236
+ </div>
237
+ </div>
238
 
239
  <!-- Analyze Button -->
240
+ <div class="text-center mt-8">
241
+ <button type="button" id="analyzeBtn" class="flex items-center justify-center mx-auto">
242
+ <i class="fas fa-calculator mr-3"></i> <span class="uppercase font-semibold">Analisar Resultados</span>
243
+ </button>
244
+ </div>
245
 
246
  <!-- Related Tools -->
247
+ <div class="cf mt-8 text-center">
248
+ <span class="opacity-80">Explore também:</span>
249
+ <a href="#" class="ml-2 hover:text-blue-300 transition-colors inline-flex items-center">
250
+ <i class="fas fa-chart-line mr-1"></i> Precisão e Revocação
251
+ </a>
252
+ <span class="mx-2 opacity-50">|</span>
253
+ <a href="#" class="hover:text-blue-300 transition-colors inline-flex items-center">
254
+ <i class="fas fa-heartbeat mr-1"></i> Sensibilidade e Especificidade
255
+ </a>
256
  </div>
257
+ </div>
258
 
259
  <!-- Confusion Matrix Display -->
260
+ <div id="matrixContainer" class="mt-12 hidden fade-in">
261
+ <h3 class="text-2xl font-bold text-center text-white mb-6 flex items-center justify-center">
262
+ <i class="fas fa-th-large mr-3"></i>Matriz de Confusão
263
+ </h3>
264
  <div class="flex justify-center">
265
+ <table class="matrix text-white text-center min-w-full max-w-2xl">
266
+ <thead class="bg-gradient-to-r from-gray-900 to-gray-800">
267
  <tr>
268
+ <th class="matrix-header" style="width: 25%;"></th>
269
+ <th class="matrix-header" style="width: 37.5%;">Previsto: SIM</th>
270
+ <th class="matrix-header" style="width: 37.5%;">Previsto: NÃO</th>
271
  </tr>
272
  </thead>
273
  <tbody>
274
+ <tr class="bg-gradient-to-r from-gray-900/50 to-gray-950/50">
275
+ <td class="matrix-header">Real: SIM</td>
276
+ <td id="cell_tp" class="matrix-cell text-2xl">PV</td>
277
+ <td id="cell_fn" class="matrix-cell text-2xl">FN</td>
278
  </tr>
279
+ <tr class="bg-gradient-to-r from-gray-800/50 to-gray-900/50">
280
+ <td class="matrix-header">Real: NÃO</td>
281
+ <td id="cell_fp" class="matrix-cell text-2xl">FP</td>
282
+ <td id="cell_tn" class="matrix-cell text-2xl">NV</td>
283
  </tr>
284
  </tbody>
285
  </table>
 
287
  </div>
288
 
289
  <!-- Metrics Display -->
290
+ <div id="metricsContainer" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mt-12 hidden fade-in">
291
+ <div class="tooltip metric-card">
292
  <div class="metric-title">Acurácia</div>
293
  <div id="accuracy" class="metric-value">--</div>
294
+ <div class="tooltiptext">Proporção de previsões corretas (PV + NV) / Total</div>
295
  </div>
296
+ <div class="tooltip metric-card">
297
  <div class="metric-title">Precisão (PV)</div>
298
  <div id="precision" class="metric-value">--</div>
299
+ <div class="tooltiptext">Entre os classificados como positivos, quantos são realmente positivos? (PV / (PV+FP))</div>
300
  </div>
301
+ <div class="tooltip metric-card">
302
  <div class="metric-title">Sensibilidade</div>
303
  <div id="recall" class="metric-value">--</div>
304
+ <div class="tooltiptext">Capacidade de identificar positivos: PV / (PV+FN)</div>
305
  </div>
306
+ <div class="tooltip metric-card">
307
  <div class="metric-title">Especificidade</div>
308
  <div id="specificity" class="metric-value">--</div>
309
+ <div class="tooltiptext">Capacidade de identificar negativos: NV / (NV+FP)</div>
310
  </div>
311
  </div>
312
 
313
  <!-- Instructions -->
314
+ <div class="instructions mt-14">
315
+ <h3><i class="fas fa-lightbulb mr-3"></i>Instruções de Uso</h3>
316
  <ul>
317
+ <li><strong>PV (Positivo Verdadeiro):</strong> Instâncias que são positivas e foram classificadas corretamente como positivas.</li>
318
+ <li><strong>FP (Falso Positivo):</strong> Instâncias que são negativas mas foram classificadas erradamente como positivas.</li>
319
+ <li><strong>NV (Negativo Verdadeiro):</strong> Instâncias que são negativas e foram classificadas corretamente como negativas.</li>
320
+ <li><strong>FN (Falso Negativo):</strong> Instâncias que são positivas mas foram classificadas erradamente como negativas.</li>
321
  </ul>
322
+ <p>Após preencher os valores, clique em <strong class="text-blue-300">"Analisar Resultados"</strong> para gerar a matriz e visualizar as métricas de desempenho do modelo.</p>
323
+ <p class="mt-4"><i class="fas fa-star text-yellow-400 mr-2"></i> <strong>Dica:</strong> Valores devem ser números inteiros positivos. Use esse aplicativo para avaliações rápidas ou aprendizado!</p>
324
  </div>
325
 
326
  </div>
327
 
328
  <!-- Footer -->
329
+ <footer class="mt-16">
330
+ <p>© 2023 Matriz de Confusão | Feito com <i class="fas fa-heart text-red-500"></i> para cientistas de dados e estudantes</p>
331
  </footer>
332
 
333
  <script>
 
344
  document.getElementById('cell_tn').textContent = tn;
345
  document.getElementById('cell_fn').textContent = fn;
346
 
347
+ // Show matrix and metrics with fade-in effect
348
+ const matrixContainer = document.getElementById('matrixContainer');
349
+ const metricsContainer = document.getElementById('metricsContainer');
350
+ matrixContainer.classList.remove('hidden');
351
+ metricsContainer.classList.remove('hidden');
352
+ matrixContainer.classList.add('fade-in');
353
+ metricsContainer.classList.add('fade-in');
354
+
355
+ // Force reflow to restart animation
356
+ void matrixContainer.offsetWidth;
357
+ void metricsContainer.offsetWidth;
358
 
359
  // Calculate metrics
360
+ const total = tp + fp + tn + fn;
361
+ const accuracy = total > 0 ? (tp + tn) / total : 0;
362
+ const precision = (tp + fp) > 0 ? tp / (tp + fp) : 0;
363
+ const recall = (tp + fn) > 0 ? tp / (tp + fn) : 0; // also known as sensitivity
364
+ const specificity = (tn + fp) > 0 ? tn / (tn + fp) : 0;
365
 
366
  // Display metrics
367
  document.getElementById('accuracy').textContent = accuracy.toFixed(3);
prompts.txt CHANGED
@@ -1 +1,2 @@
1
- Em português. Use as cores branca, preta e azul escuro. Crie um Aplicativo de Matriz de Confusão. Gere instruções de uso. Considere parte do código: <!-- center --> <div id="center"> <h1 id="title">Confusion Matrix</h1> <div id="breadcrumps"><ol itemscope itemtype="http://schema.org/BreadcrumbList"><li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a itemprop="item" href="https://www.dcode.fr/tools-list#data_processing"><span itemprop="name">Data Processing</span></a><meta itemprop="position" content="1" /></li><li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a itemprop="item" href="https://www.dcode.fr/confusion-matrix"><span itemprop="name">Confusion Matrix</span></a><meta itemprop="position" content="2" /></li></ol></div> <!-- advert --> <div id='div-gpt-ad-1407836191040-0' style='min-width:320px;min-height:100px'></div> <!-- !advert --> <div id="forms"> <h2 class="h2_form" id="f0">Confusion Matrix</h2> <form id="confusion_matrix" method="post"> <p class="info">True Positive (TP) : item declared TRUE, and in reality TRUE</p> <label for="confusion_matrix_tp">Number of True Positive (TP)</label> <input type="text" id="confusion_matrix_tp" name="tp" value="70" size="8" spellcheck="false" class="" /><br/> <p class="info">False Positive (FP) or Type I error: item declared TRUE but in reality FALSE</p> <label for="confusion_matrix_fp">Number of False Positive (FP)</label> <input type="text" id="confusion_matrix_fp" name="fp" value="5" size="8" spellcheck="false" class="" /><br/> <p class="info">True Negative (TN): item declared FALSE, and in reality FALSE</p> <label for="confusion_matrix_tn">Number of True Negative (TN)</label> <input type="text" id="confusion_matrix_tn" name="tn" value="15" size="8" spellcheck="false" class="" /><br/> <p class="info">False Negative (FN) or Type II error: item declared FALSE but in reality TRUE</p> <label for="confusion_matrix_fn">Number of False Negative (FN)</label> <input type="text" id="confusion_matrix_fn" name="fn" value="10" size="8" spellcheck="false" class="" /><br/> <button data-post="tp,fp,tn,fn" post="tp,fp,tn,fn">Analyze</button> <div class="cf "><span>See also:</span> <a href="/precision-recall">Precision and Recall</a> — <a href="/sensibility-specificity">Sensitivity and Specificity</a></div> </form> </div> <!-- advert --> <div id='div-gpt-ad-1407836210596-0' style='min-width:336px;min-height:280px'></div>
 
 
1
+ Em português. Use as cores branca, preta e azul escuro. Crie um Aplicativo de Matriz de Confusão. Gere instruções de uso. Considere parte do código: <!-- center --> <div id="center"> <h1 id="title">Confusion Matrix</h1> <div id="breadcrumps"><ol itemscope itemtype="http://schema.org/BreadcrumbList"><li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a itemprop="item" href="https://www.dcode.fr/tools-list#data_processing"><span itemprop="name">Data Processing</span></a><meta itemprop="position" content="1" /></li><li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a itemprop="item" href="https://www.dcode.fr/confusion-matrix"><span itemprop="name">Confusion Matrix</span></a><meta itemprop="position" content="2" /></li></ol></div> <!-- advert --> <div id='div-gpt-ad-1407836191040-0' style='min-width:320px;min-height:100px'></div> <!-- !advert --> <div id="forms"> <h2 class="h2_form" id="f0">Confusion Matrix</h2> <form id="confusion_matrix" method="post"> <p class="info">True Positive (TP) : item declared TRUE, and in reality TRUE</p> <label for="confusion_matrix_tp">Number of True Positive (TP)</label> <input type="text" id="confusion_matrix_tp" name="tp" value="70" size="8" spellcheck="false" class="" /><br/> <p class="info">False Positive (FP) or Type I error: item declared TRUE but in reality FALSE</p> <label for="confusion_matrix_fp">Number of False Positive (FP)</label> <input type="text" id="confusion_matrix_fp" name="fp" value="5" size="8" spellcheck="false" class="" /><br/> <p class="info">True Negative (TN): item declared FALSE, and in reality FALSE</p> <label for="confusion_matrix_tn">Number of True Negative (TN)</label> <input type="text" id="confusion_matrix_tn" name="tn" value="15" size="8" spellcheck="false" class="" /><br/> <p class="info">False Negative (FN) or Type II error: item declared FALSE but in reality TRUE</p> <label for="confusion_matrix_fn">Number of False Negative (FN)</label> <input type="text" id="confusion_matrix_fn" name="fn" value="10" size="8" spellcheck="false" class="" /><br/> <button data-post="tp,fp,tn,fn" post="tp,fp,tn,fn">Analyze</button> <div class="cf "><span>See also:</span> <a href="/precision-recall">Precision and Recall</a> — <a href="/sensibility-specificity">Sensitivity and Specificity</a></div> </form> </div> <!-- advert --> <div id='div-gpt-ad-1407836210596-0' style='min-width:336px;min-height:280px'></div>
2
+ Melhore o UX, tornando mais agradável e visual. Pode alterar as cores