Switched To point for datasets
This commit is contained in:
@@ -5,10 +5,10 @@ import type {
|
||||
BubbleDataPoint,
|
||||
Point,
|
||||
} from 'chart.js';
|
||||
import { Chart } from 'vue-chartjs';
|
||||
import type { Iteration } from '@/types/perceptron';
|
||||
import { colors } from '@/types/graphs';
|
||||
import { computed } from 'vue';
|
||||
import { Chart } from 'vue-chartjs';
|
||||
import { colors } from '@/types/graphs';
|
||||
import type { Iteration } from '@/types/perceptron';
|
||||
|
||||
const props = defineProps<{
|
||||
cleanedDataset: { label: number; data: { x: number; y: number }[] }[];
|
||||
@@ -45,13 +45,13 @@ function getPerceptronDecisionBoundaryDataset(
|
||||
networkWeights.length == 1 &&
|
||||
networkWeights[0].length == 1 &&
|
||||
networkWeights[0][0].length == 3
|
||||
) {
|
||||
// Unique, 3 weights perceptron
|
||||
) { // Unique, 3 weights perceptron
|
||||
const perceptronWeights = networkWeights[0][0]; // We take the unique
|
||||
|
||||
function perceptronLine(x: number): number {
|
||||
// w0 + w1*x + w2*y = 0 => y = -(w1/w2)*x - w0/w2
|
||||
return -(perceptronWeights[1] / perceptronWeights[2]) * x - perceptronWeights[0] / perceptronWeights[2];
|
||||
const w2 = perceptronWeights[2] == 0 ? 1e-6 : perceptronWeights[2]; // Avoid division by zero
|
||||
return -(perceptronWeights[1] / w2) * x - perceptronWeights[0] / w2;
|
||||
}
|
||||
|
||||
// Simple line
|
||||
|
||||
Reference in New Issue
Block a user