Misc Fixes for ADALINE

This commit is contained in:
2026-03-24 17:12:15 +01:00
parent 0876588550
commit ca9c0dc511
4 changed files with 9 additions and 7 deletions

View File

@@ -90,7 +90,7 @@ class ADALINEPerceptronTraining extends NetworkTraining
return $condition;
}
private function iterationFunction(array $inputs, int $correctOutput)
private function iterationFunction(array $inputs, float $correctOutput): float
{
$output = $this->perceptron->test($inputs);

View File

@@ -86,7 +86,7 @@ class GradientDescentPerceptronTraining extends NetworkTraining
return $condition;
}
private function iterationFunction(array $inputs, int $correctOutput)
private function iterationFunction(array $inputs, float $correctOutput): float
{
$output = $this->perceptron->test($inputs);

View File

@@ -33,9 +33,7 @@ const rowBgDark = computed(() => {
<th>Époch</th>
<th>Exemple</th>
<th
v-for="(weight, index) in allWeightPerIteration[
allWeightPerIteration.length - 1
]"
v-for="(weight, index) in allWeightPerIteration[0]"
v-bind:key="index"
>
X<sub>{{ index }}</sub>
@@ -60,7 +58,10 @@ const rowBgDark = computed(() => {
<td>{{ iteration.error.toFixed(2) }}</td>
</tr>
<tr v-if="props.trainingEnded" class="bg-red-400 dark:bg-red-900 text-center">
<tr
v-if="props.trainingEnded"
class="bg-red-400 text-center dark:bg-red-900"
>
<td colspan="100%">
<strong>Entraînement terminé :</strong>
{{ props.trainingEndReason }}

View File

@@ -75,7 +75,7 @@ function getPerceptronDecisionBoundaryDataset(
networkWeights[0][0].length <= 3
) {
// Unique, 3 weights perceptron
const perceptronWeights = networkWeights[0][0]; // We take the unique perceptron
const perceptronWeights = [...networkWeights[0][0]]; // Copy of the unique perceptron weights
function perceptronLine(x: number): number {
if (perceptronWeights.length < 3) {
@@ -167,6 +167,7 @@ function getPerceptronDecisionBoundaryDataset(
<Chart
v-if="props.cleanedDataset.length > 0 || props.iterations.length > 0"
class="flex bg-primary dark:bg-transparent!"
type="scatter"
:options="{
responsive: true,
maintainAspectRatio: true,