aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_elements/form-model/form-model.component.ts
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/form-model/form-model.component.ts
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/form-model/form-model.component.ts')
-rw-r--r--frontend/src/app/_elements/form-model/form-model.component.ts39
1 files changed, 12 insertions, 27 deletions
diff --git a/frontend/src/app/_elements/form-model/form-model.component.ts b/frontend/src/app/_elements/form-model/form-model.component.ts
index b1d0a2a9..40bc30ea 100644
--- a/frontend/src/app/_elements/form-model/form-model.component.ts
+++ b/frontend/src/app/_elements/form-model/form-model.component.ts
@@ -2,7 +2,7 @@ import { Component, OnInit ,Input, ViewChild, Output, EventEmitter} from '@angul
import {FormControl, Validators} from '@angular/forms';
import Shared from 'src/app/Shared';
import Experiment from 'src/app/_data/Experiment';
-import Model, { ActivationFunction, LossFunction, LossFunctionBinaryClassification, LossFunctionMultiClassification, LossFunctionRegression, Metrics, MetricsBinaryClassification, MetricsMultiClassification, MetricsRegression, NullValueOptions, Optimizer, ProblemType } from 'src/app/_data/Model';
+import Model, {Layer, ActivationFunction, LossFunction, LossFunctionBinaryClassification, LossFunctionMultiClassification, LossFunctionRegression, Metrics, MetricsBinaryClassification, MetricsMultiClassification, MetricsRegression, NullValueOptions, Optimizer, ProblemType } from 'src/app/_data/Model';
import { GraphComponent } from '../graph/graph.component';
import {FormGroupDirective, NgForm} from '@angular/forms';
import {ErrorStateMatcher} from '@angular/material/core';
@@ -65,26 +65,20 @@ export class FormModelComponent implements OnInit {
removeLayer(){
if(this.newModel.hiddenLayers>1)
{
+ this.newModel.layers.splice(this.newModel.layers.length-1,1);
this.newModel.hiddenLayers-=1;
this.updateGraph();
}
- else
- {
- this.newModel.hiddenLayers=this.newModel.hiddenLayers;
- }
-
}
addLayer(){
if(this.newModel.hiddenLayers<12)
{
+ this.newModel.layers.push(new Layer(this.newModel.layers.length));
+
this.newModel.hiddenLayers+=1;
this.updateGraph();
}
- else
- {
- this.newModel.hiddenLayers=this.newModel.hiddenLayers;
-
- }
+
}
removeBatch(){
if(this.newModel.batchSize>1)
@@ -140,28 +134,19 @@ export class FormModelComponent implements OnInit {
numSequence(n: number): Array<number> {
return Array(n);
}
- removeNeuron(){
- if(this.newModel.hiddenLayerNeurons>1)
+
+ removeNeuron(index:number){
+ if(this.newModel.layers[index].neurons>1)
{
- this.newModel.hiddenLayerNeurons=this.newModel.hiddenLayerNeurons-1;
+ this.newModel.layers[index].neurons-=1;
this.updateGraph();
}
- else
- {
- this.newModel.hiddenLayerNeurons=this.newModel.hiddenLayerNeurons;
- }
-
}
- addNeuron(){
- if(this.newModel.hiddenLayerNeurons<100)
+ addNeuron(index:number){
+ if(this.newModel.layers[index].neurons<100)
{
- this.newModel.hiddenLayerNeurons=this.newModel.hiddenLayerNeurons+1;
+ this.newModel.layers[index].neurons+=1;
this.updateGraph();
}
- else
- {
- this.newModel.hiddenLayerNeurons=this.newModel.hiddenLayerNeurons;
-
- }
}
}