aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_elements/graph
diff options
context:
space:
mode:
authorSonja Galovic <galovicsonja@gmail.com>2022-04-26 21:15:24 +0200
committerSonja Galovic <galovicsonja@gmail.com>2022-04-26 21:15:24 +0200
commit2c22d31667a4a5be24224651a570b1086d2ded7b (patch)
tree4e30cc22d12d97816ac17a540a00df89fcb58b57 /frontend/src/app/_elements/graph
parent31e3b846eda94de86e249956d96c54aaa92eb0c6 (diff)
parent5857e1c71eda1ee6455d55ef9f8d1c10f75a8457 (diff)
Merge branch 'redesign' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into redesign
# Conflicts: # frontend/src/app/_elements/column-table/column-table.component.css # frontend/src/app/_elements/column-table/column-table.component.ts
Diffstat (limited to 'frontend/src/app/_elements/graph')
-rw-r--r--frontend/src/app/_elements/graph/graph.component.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/frontend/src/app/_elements/graph/graph.component.ts b/frontend/src/app/_elements/graph/graph.component.ts
index 8051acc3..c20d3dd7 100644
--- a/frontend/src/app/_elements/graph/graph.component.ts
+++ b/frontend/src/app/_elements/graph/graph.component.ts
@@ -1,6 +1,6 @@
import { AfterViewInit, Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
import Dataset from 'src/app/_data/Dataset';
-import Model from 'src/app/_data/Model';
+import Model,{Layer} from 'src/app/_data/Model';
@Component({
selector: 'app-graph',
@@ -26,6 +26,7 @@ export class GraphComponent implements AfterViewInit {
@Input() outputNodeColor: string = '#44ee22';
private ctx?: CanvasRenderingContext2D;
+ @Input() inputNeurons: number=1;
constructor() { }
@@ -50,7 +51,7 @@ export class GraphComponent implements AfterViewInit {
let inputNodeIndex = 0;
const inputLayer: Node[] = [];
while (inputNodeIndex < this.inputCols) {
- const x = 0.5 / (this.model!.hiddenLayers + 2);
+ const x = 0.5 / (this.inputNeurons + 2);
const y = (inputNodeIndex + 0.5) / this.inputCols;
const node = new Node(x, y, this.inputNodeColor);
inputLayer.push(node);
@@ -62,9 +63,9 @@ export class GraphComponent implements AfterViewInit {
while (layerIndex < this.model!.hiddenLayers + 1) {
const newLayer: Node[] = [];
let nodeIndex = 0;
- while (nodeIndex < this.model!.hiddenLayerNeurons) {
+ while (nodeIndex < this.model!.layers[layerIndex].neurons) {
const x = (layerIndex + 0.5) / (this.model!.hiddenLayers + 2);
- const y = (nodeIndex + 0.5) / this.model!.hiddenLayerNeurons;
+ const y = (nodeIndex + 0.5) / this.model!.layers[layerIndex].neurons;
const node = new Node(x, y, this.nodeColor);
newLayer.push(node);
nodeIndex += 1;