From d6b8cd90f225bb4b390ef16603da9f5f0739899f Mon Sep 17 00:00:00 2001 From: Danijel Anđelković Date: Wed, 18 May 2022 17:07:43 +0200 Subject: Promenio dodavanje fajla u folderu da ne menja naslov tab-a. Podesio form-model komponentu da setuje tip problema modela na tip problema eksperimenta i ispravio da se uvak prikazuju korektne funkcije gubitka za taj tip problema. Popravio forme za dodavanje/pregled fajlova u arhivi. --- .../_elements/form-model/form-model.component.html | 12 ++--- .../_elements/form-model/form-model.component.ts | 55 +++++++++++----------- 2 files changed, 30 insertions(+), 37 deletions(-) (limited to 'frontend/src/app/_elements/form-model') 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 97e38cf1..1b4eb834 100644 --- a/frontend/src/app/_elements/form-model/form-model.component.html +++ b/frontend/src/app/_elements/form-model/form-model.component.html @@ -11,12 +11,7 @@
Tip problema - - - {{ optionName }} - - - + {{ optionName }} @@ -41,7 +36,7 @@ Funkcija troška - + {{ optionName }} @@ -118,8 +113,7 @@
- - +
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 c8822992..c9e2fc8e 100644 --- a/frontend/src/app/_elements/form-model/form-model.component.ts +++ b/frontend/src/app/_elements/form-model/form-model.component.ts @@ -15,13 +15,13 @@ export class FormModelComponent implements AfterViewInit { @ViewChild(GraphComponent) graph!: GraphComponent; @Input() forExperiment!: Experiment; @Output() selectedModelChangeEvent = new EventEmitter(); - @Input() hideProblemType:boolean; - @Input() forProblemType:ProblemType; + @Input() hideProblemType: boolean; + @Input() forProblemType: ProblemType; testSetDistribution: number = 70; - validationSize:number=15; - constructor() { - this.hideProblemType=false; - this.forProblemType=ProblemType.BinaryClassification; + validationSize: number = 15; + constructor() { + this.hideProblemType = false; + this.forProblemType = ProblemType.BinaryClassification; } ngAfterViewInit(): void { } @@ -59,10 +59,15 @@ export class FormModelComponent implements AfterViewInit { term: string = ""; selectedMetrics = []; - lossFunction: any = LossFunction; + lossFunctions: { [index: string]: LossFunction[] } = { + [ProblemType.Regression]: LossFunctionRegression, + [ProblemType.BinaryClassification]: LossFunctionBinaryClassification, + [ProblemType.MultiClassification]: LossFunctionMultiClassification + }; loadModel(model: Model) { this.newModel = model; + this.forProblemType = model.type; } updateGraph() { @@ -77,6 +82,7 @@ export class FormModelComponent implements AfterViewInit { this.updateGraph(); } } + addLayer() { if (this.newModel.hiddenLayers < 128) { this.newModel.layers.push(new Layer(this.newModel.layers.length, this.selectedActivation, this.selectedNumberOfNeurons, this.selectedRegularisation, this.selectedRegularisationRate)); @@ -84,8 +90,8 @@ export class FormModelComponent implements AfterViewInit { this.newModel.hiddenLayers += 1; this.updateGraph(); } - } + numSequence(n: number): Array { return Array(n); } @@ -96,12 +102,14 @@ export class FormModelComponent implements AfterViewInit { this.updateGraph(); } } + addNeuron(index: number) { if (this.newModel.layers[index].neurons < 18) { this.newModel.layers[index].neurons += 1; this.updateGraph(); } } + selectedActivation: ActivationFunction = ActivationFunction.Sigmoid; selectedRegularisationRate: RegularisationRate = RegularisationRate.RR1; selectedRegularisation: Regularisation = Regularisation.L1; @@ -131,24 +139,15 @@ export class FormModelComponent implements AfterViewInit { 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); + + getInputColumns() { + if (this.forExperiment) + return this.forExperiment.inputColumns.filter(x => x != this.forExperiment.outputColumn); + else + return ['Nisu odabrane ulazne kolone.'] + } + + updateValidation(event: MatSliderChange) { + this.validationSize = event.value!; + } } -updateValidation(event: MatSliderChange) { - this.validationSize = event.value!; -}} -- cgit v1.2.3