Compare commits

..

2 Commits

Author SHA1 Message Date
f6620c2eca Fixed graph showing wrong decision border for regression
All checks were successful
linter / quality (push) Successful in 8m11s
tests / ci (8.4) (push) Successful in 10m8s
tests / ci (8.5) (push) Successful in 12m59s
2026-03-24 17:33:58 +01:00
ca9c0dc511 Misc Fixes for ADALINE 2026-03-24 17:12:15 +01:00
4 changed files with 10 additions and 8 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,12 +75,12 @@ 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) {
// If we have less than 3 weights, we assume missing weights are zero
perceptronWeights.push(getPerceptronOutput(networkWeights, [x])[0]);
return getPerceptronOutput(networkWeights, [x])[0];
}
// w0 + w1*x + w2*y = 0 => y = -(w1/w2)*x - w0/w2
@@ -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,