aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/src/app/_data/Model.ts13
-rw-r--r--frontend/src/app/_elements/folder/folder.component.html2
-rw-r--r--frontend/src/app/_elements/form-model/form-model.component.html8
-rw-r--r--frontend/src/app/_elements/form-model/form-model.component.ts23
-rw-r--r--frontend/src/styles/helper.css3
5 files changed, 31 insertions, 18 deletions
diff --git a/frontend/src/app/_data/Model.ts b/frontend/src/app/_data/Model.ts
index f527dc7f..898805d3 100644
--- a/frontend/src/app/_data/Model.ts
+++ b/frontend/src/app/_data/Model.ts
@@ -2,6 +2,7 @@ import { NgIf } from "@angular/common";
import { FolderFile } from "./FolderFile";
export default class Model extends FolderFile {
+ public lossFunction: LossFunction;
constructor(
name: string = 'Novi model',
public description: string = '',
@@ -12,7 +13,6 @@ export default class Model extends FolderFile {
// Neural net training settings
public type: ProblemType = ProblemType.Regression,
public optimizer: Optimizer = Optimizer.Adam,
- public lossFunction: LossFunction = LossFunctionRegression[0],
public inputNeurons: number = 1,
public hiddenLayers: number = 1,
public batchSize: BatchSize = BatchSize.O3,
@@ -28,11 +28,12 @@ export default class Model extends FolderFile {
public randomOrder: boolean = true,
public randomTestSet: boolean = true,
public randomTestSetDistribution: number = 0.1, //0.1-0.9 (10% - 90%) JESTE OVDE ZAKUCANO 10, AL POSLATO JE KAO 0.1 BACK-U
- public validationSize:number=0.1,
+ public validationSize: number = 0.1,
public isPublic: boolean = false,
public accessibleByLink: boolean = false
) {
super(name, dateCreated, lastUpdated);
+ this.lossFunction = (this.type == ProblemType.Regression ? LossFunctionRegression[0] : (this.type == ProblemType.BinaryClassification ? LossFunctionBinaryClassification[0] : LossFunctionMultiClassification[0]));
}
}
export class Layer {
@@ -45,8 +46,8 @@ export class Layer {
) { }
}
export enum LearningRate {
- LR1 = '0.00001',
- LR2 = '0.0001',
+ // LR1 = '0.00001',
+ // LR2 = '0.0001',
LR3 = '0.001',
LR4 = '0.003',
LR5 = '0.01',
@@ -120,7 +121,7 @@ export enum LossFunction {
SquaredHingeLoss = 'squared_hinge',
HingeLoss = 'hinge',
// multi-class classification loss functions
- CategoricalCrossEntropy = 'categorical_crossentropy',
+ // CategoricalCrossEntropy = 'categorical_crossentropy',
SparseCategoricalCrossEntropy = 'sparse_categorical_crossentropy',
KLDivergence = 'kullback_leibler_divergence',
@@ -134,7 +135,7 @@ export enum LossFunction {
export const LossFunctionRegression = [LossFunction.MeanAbsoluteError, LossFunction.MeanSquaredError, LossFunction.MeanSquaredLogarithmicError]
export const LossFunctionBinaryClassification = [LossFunction.BinaryCrossEntropy, LossFunction.SquaredHingeLoss, LossFunction.HingeLoss]
-export const LossFunctionMultiClassification = [LossFunction.CategoricalCrossEntropy, LossFunction.SparseCategoricalCrossEntropy, LossFunction.KLDivergence]
+export const LossFunctionMultiClassification = [/*LossFunction.CategoricalCrossEntropy,*/ LossFunction.SparseCategoricalCrossEntropy, LossFunction.KLDivergence]
export enum Optimizer {
Adam = 'Adam',
diff --git a/frontend/src/app/_elements/folder/folder.component.html b/frontend/src/app/_elements/folder/folder.component.html
index da182945..7c42b1db 100644
--- a/frontend/src/app/_elements/folder/folder.component.html
+++ b/frontend/src/app/_elements/folder/folder.component.html
@@ -134,7 +134,7 @@
</div>
</button>
<ng-container *ngSwitchCase="false">
- <button mat-button (click)="ok()" class="bottom-button text-offwhite rounded-bottom" *ngIf="!selectedFileHasChanges">
+ <button mat-button (click)="ok()" class="bottom-button text-offwhite rounded-bottom" *ngIf="!selectedFileHasChanges && !archive">
<div class="f-row">
<div>Ok</div>
<div class="p-1 w-100" *ngIf="loadingAction">
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 bed69998..b986e154 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,7 @@
<div class="ns-col">
<mat-form-field appearance="fill" class="mat-fix">
<mat-label>Tip problema</mat-label>
- <mat-select [(ngModel)]="forProblemType" [disabled]="this.hideProblemType" (valueChange)="editEvent.emit()">
+ <mat-select [(ngModel)]="forProblemType" [disabled]="this.hideProblemType" (valueChange)="editEvent.emit(); newModel.type = forProblemType;">
<mat-option *ngFor="let option of Object.keys(ProblemType); let optionName of Object.values(ProblemType)" [value]="option">
{{ optionName }}
</mat-option>
@@ -35,7 +35,7 @@
<div class="ns-col">
<mat-form-field appearance="fill" class="mat-fix">
<mat-label>Funkcija troška</mat-label>
- <mat-select [(ngModel)]="newModel.lossFunction" (valueChange)="editEvent.emit()">
+ <mat-select [(ngModel)]="lossFunction" (valueChange)="newModel.lossFunction = lossFunction!; editEvent.emit();">
<mat-option *ngFor="let option of Object.keys(lossFunctions[forProblemType]); let optionName of Object.values(lossFunctions[forProblemType])" [value]="option">
{{ optionName }}
</mat-option>
@@ -48,7 +48,7 @@
<div class="ns-col">
<mat-form-field appearance="fill" class="mat-fix">
<mat-label>Funkcija aktivacije izlaznog sloja</mat-label>
- <mat-select name="outputLayerActivationFunction" [(ngModel)]="newModel.outputLayerActivationFunction" (valueChange)="editEvent.emit()">
+ <mat-select name="outputLayerActivationFunction" [(ngModel)]="outputLayerActivationFunction" (valueChange)="newModel.outputLayerActivationFunction = outputLayerActivationFunction!; editEvent.emit();">
<mat-option *ngFor="let option of Object.keys(ActivationFunction); let optionName of Object.values(ActivationFunction)" [value]="option">
{{ optionName }}
</mat-option>
@@ -229,7 +229,7 @@
<mat-form-field appearance="fill" class="mat-fix">
<mat-label>Stopa regularizacije</mat-label>
- <mat-select [(ngModel)]="newModel.layers[i].regularisationRate" (valueChange)="editEvent.emit()">
+ <mat-select [(ngModel)]="newModel.layers[i].regularisationRate">
<mat-option *ngFor="let option of Object.keys(RegularisationRate); let optionName of Object.values(RegularisationRate)" [value]="option">
{{ optionName }}
</mat-option>
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 196d575b..646af08c 100644
--- a/frontend/src/app/_elements/form-model/form-model.component.ts
+++ b/frontend/src/app/_elements/form-model/form-model.component.ts
@@ -15,18 +15,22 @@ export class FormModelComponent implements AfterViewInit {
@ViewChild(GraphComponent) graph!: GraphComponent;
@Input() forExperiment!: Experiment;
@Output() selectedModelChangeEvent = new EventEmitter<Model>();
- @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;
}
@Output() editEvent = new EventEmitter();
- ngAfterViewInit(): void { }
+ ngAfterViewInit(): void {
+ this.lossFunction = this.lossFunctions[this.forProblemType][0];
+ this.outputLayerActivationFunction = this.outputLayerActivationFunctions[this.forProblemType][0];
+
+ this.newModel.lossFunction = this.lossFunction;
+ this.newModel.outputLayerActivationFunction = this.outputLayerActivationFunction;
+ }
selectFormControl = new FormControl('', Validators.required);
nameFormControl = new FormControl('', [Validators.required, Validators.email]);
@@ -67,6 +71,12 @@ export class FormModelComponent implements AfterViewInit {
[ProblemType.MultiClassification]: LossFunctionMultiClassification
};
+ outputLayerActivationFunctions: { [index: string]: ActivationFunction[] } = {
+ [ProblemType.Regression]: [ActivationFunction.Linear],
+ [ProblemType.BinaryClassification]: [ActivationFunction.Sigmoid],
+ [ProblemType.MultiClassification]: [ActivationFunction.Softmax]
+ };
+
loadModel(model: Model) {
this.newModel = model;
this.forProblemType = model.type;
@@ -121,6 +131,9 @@ export class FormModelComponent implements AfterViewInit {
selectedRegularisation: Regularisation = Regularisation.L1;
selectedNumberOfNeurons: number = 3;
+ lossFunction: LossFunction = LossFunction.MeanAbsoluteError;
+ outputLayerActivationFunction: ActivationFunction = ActivationFunction.Linear;
+
changeAllActivation() {
for (let i = 0; i < this.newModel.layers.length; i++) {
this.newModel.layers[i].activationFunction = this.selectedActivation;
diff --git a/frontend/src/styles/helper.css b/frontend/src/styles/helper.css
index 155fc3e1..b6a58243 100644
--- a/frontend/src/styles/helper.css
+++ b/frontend/src/styles/helper.css
@@ -17,8 +17,7 @@
.bg-controls {
position: fixed;
bottom: 10px;
- left: 50%;
- right: 50%;
+ left: 5rem;
}
.center-horizontal {