Some bugfixes and misc
linter / quality (push) Successful in 4m24s
tests / ci (8.4) (push) Successful in 4m47s
tests / ci (8.5) (push) Successful in 5m0s

This commit is contained in:
2026-09-08 20:01:52 +02:00
parent 0e177f8491
commit 69e683bcaf
13 changed files with 120 additions and 33 deletions
+7 -4
View File
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { computed, ComputedRef } from 'vue';
import { computed } from 'vue';
import type { ComputedRef } from 'vue';
import type { Iteration } from '@/types/perceptron';
const props = defineProps<{
@@ -13,7 +14,9 @@ const props = defineProps<{
const allWeightPerIteration: ComputedRef<number[][]> = computed(() => {
return props.iterations.map((iteration) => {
// We flatten the weights
return iteration.weights.flat(2);
return iteration.weights
.flat(2)
.filter((weight): weight is number => weight !== null && Number.isFinite(weight));
});
});
@@ -61,10 +64,10 @@ const rowBgDark = computed(() => {
v-for="(weight, weightIndex) in allWeightPerIteration[index]"
v-bind:key="weightIndex"
>
{{ weight.toFixed(2) }}
{{ Number.isFinite(weight) ? weight.toFixed(2) : 'N/A' }}
</td>
</template>
<td>{{ iteration.error.toFixed(2) }}</td>
<td>{{ iteration.error === null ? 'N/A' : iteration.error.toFixed(2) }}</td>
</tr>
<tr
@@ -28,6 +28,8 @@ const datasets = computed<ErrorDataset[]>(() => {
const exampleCountPerEpoch: Record<number, number> = {};
props.iterations.forEach((iteration) => {
const error = iteration.error ?? 0;
if (!epochErrorOnly.value) {
const exampleLabel = `Exemple ${iteration.exampleIndex}`;
let dataset = datasets.find((d) => d.label === exampleLabel);
@@ -45,8 +47,8 @@ const datasets = computed<ErrorDataset[]>(() => {
}
dataset.data.push(
props.isRegression
? Math.abs(iteration.error)
: iteration.error,
? Math.abs(error)
: error,
);
}
@@ -55,7 +57,7 @@ const datasets = computed<ErrorDataset[]>(() => {
// Epoch error
epochAverageError[iteration.epoch] =
(epochAverageError[iteration.epoch] || 0) +
iteration.error ** 2 / 2;
error ** 2 / 2;
});
// Sort dataset by label (Exemple 0, Exemple 1, ...)