diff options
Diffstat (limited to 'frontend/src/app/_elements/form-model')
3 files changed, 46 insertions, 27 deletions
diff --git a/frontend/src/app/_elements/form-model/form-model.component.css b/frontend/src/app/_elements/form-model/form-model.component.css index 11b6ef5e..95ace1ef 100644 --- a/frontend/src/app/_elements/form-model/form-model.component.css +++ b/frontend/src/app/_elements/form-model/form-model.component.css @@ -101,4 +101,4 @@ mat-slider { padding-bottom: 15px; font-size: 20px !important; font-weight: 600; -}
\ No newline at end of file +} diff --git a/frontend/src/app/_elements/form-model/form-model.component.html b/frontend/src/app/_elements/form-model/form-model.component.html index 96a5e1b6..09e44a99 100644 --- a/frontend/src/app/_elements/form-model/form-model.component.html +++ b/frontend/src/app/_elements/form-model/form-model.component.html @@ -11,7 +11,12 @@ <div class="ns-col"> <mat-form-field appearance="fill" class="mat-fix"> <mat-label>Tip problema</mat-label> - <mat-select [(ngModel)]="newModel.type"> + <mat-select [(ngModel)]="newModel.type" (selectionChange)="filterLossFunction()" *ngIf="this.hideProblemType" disabled="true"> + <mat-option *ngFor="let option of Object.keys(ProblemType); let optionName of Object.values(ProblemType)" [value]="option"> + {{ optionName }} + </mat-option> + </mat-select> + <mat-select [(ngModel)]="newModel.type" (selectionChange)="filterLossFunction()" *ngIf="!this.hideProblemType" disabled="false"> <mat-option *ngFor="let option of Object.keys(ProblemType); let optionName of Object.values(ProblemType)" [value]="option"> {{ optionName }} </mat-option> @@ -36,7 +41,7 @@ <mat-form-field appearance="fill" class="mat-fix"> <mat-label>Funkcija troška</mat-label> <mat-select [(ngModel)]="newModel.lossFunction"> - <mat-option *ngFor="let option of Object.keys(LossFunction); let optionName of Object.values(LossFunction)" [value]="option"> + <mat-option *ngFor="let option of Object.keys(lossFunction); let optionName of Object.values(lossFunction)" [value]="option"> {{ optionName }} </mat-option> </mat-select> @@ -109,7 +114,7 @@ <div class="col-sm-9"> <!-- {{forExperiment._columnsSelected}} --> - <app-graph [model]="newModel" *ngIf="forExperiment._columnsSelected" [inputColumns]="forExperiment.inputColumns"></app-graph> + <app-graph [model]="newModel" *ngIf="forExperiment._columnsSelected" [inputColumns]="getInputColumns()"></app-graph> <app-graph [model]="newModel" *ngIf="!forExperiment._columnsSelected" [inputColumns]="['Nisu odabrane ulazne kolone']"></app-graph> </div> </div> @@ -121,14 +126,15 @@ <div class="ns-col" id="layers-control"> <div>Broj Skrivenih Slojeva</div> - <button class="btn-clear btn-icon bubble" (click)="addLayer()"> - <mat-icon>add</mat-icon> - </button> - <div>{{newModel.hiddenLayers}}</div> <button class="btn-clear btn-icon bubble" (click)="removeLayer()"> - <mat-icon>remove</mat-icon> - </button> + <mat-icon>remove</mat-icon> + </button> + <div>{{newModel.hiddenLayers}}</div> + + <button class="btn-clear btn-icon bubble" (click)="addLayer()"> + <mat-icon>add</mat-icon> + </button> </div> <div class="break-1"></div> <div class="ns-col"> @@ -196,13 +202,13 @@ <div class="d-flex flex-row align-items-center justify-content-center tm"> <div class="col-6" style="font-size: 13px;">Broj čvorova</div> - <button class="btn-clear btn-icon bubble" (click)="addNeuron(i)"> - <mat-icon>add</mat-icon> - </button> - <div class="col-2 text-center">{{newModel.layers[i].neurons}}</div> <button class="btn-clear btn-icon bubble" (click)="removeNeuron(i)"> - <mat-icon>remove</mat-icon> - </button> + <mat-icon>remove</mat-icon> + </button> + <div class="col-2 text-center">{{newModel.layers[i].neurons}}</div> + <button class="btn-clear btn-icon bubble" (click)="addNeuron(i)"> + <mat-icon>add</mat-icon> + </button> </div> <mat-form-field appearance="fill" class="mat-fix"> 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 71b374b0..e01c2339 100644 --- a/frontend/src/app/_elements/form-model/form-model.component.ts +++ b/frontend/src/app/_elements/form-model/form-model.component.ts @@ -15,8 +15,13 @@ export class FormModelComponent implements AfterViewInit { @ViewChild(GraphComponent) graph!: GraphComponent; @Input() forExperiment!: Experiment; @Output() selectedModelChangeEvent = new EventEmitter<Model>(); + @Input() hideProblemType:boolean; + @Input() forProblemType:ProblemType; testSetDistribution: number = 70; - constructor() { } + constructor() { + this.hideProblemType=false; + this.forProblemType=ProblemType.BinaryClassification; + } ngAfterViewInit(): void { } @@ -80,13 +85,6 @@ export class FormModelComponent implements AfterViewInit { } } - /* - setNeurons() - { - for(let i=0;i<this.newModel.hiddenLayers;i++){ - this.newModel.hiddenLayerNeurons[i]=1; - } - }*/ numSequence(n: number): Array<number> { return Array(n); } @@ -111,9 +109,7 @@ export class FormModelComponent implements AfterViewInit { changeAllActivation() { for (let i = 0; i < this.newModel.layers.length; i++) { this.newModel.layers[i].activationFunction = this.selectedActivation; - } - } changeAllRegularisation() { for (let i = 0; i < this.newModel.layers.length; i++) { @@ -131,8 +127,25 @@ export class FormModelComponent implements AfterViewInit { this.updateGraph(); } } - updateTestSet(event: MatSliderChange) { this.testSetDistribution = event.value!; } + filterLossFunction() { + if(this.newModel.type==ProblemType.Regression){ + this.lossFunction = LossFunctionRegression; + this.newModel.lossFunction=LossFunction.MeanSquaredError; + } + else if(this.newModel.type==ProblemType.BinaryClassification){ + this.lossFunction= LossFunctionBinaryClassification; + this.newModel.lossFunction=LossFunction.BinaryCrossEntropy; + } + else if(this.newModel.type==ProblemType.MultiClassification){ + this.lossFunction = LossFunctionMultiClassification; + this.newModel.lossFunction=LossFunction.SparseCategoricalCrossEntropy; + } + +} +getInputColumns() { + return this.forExperiment.inputColumns.filter(x => x != this.forExperiment.outputColumn); +} } |