aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_elements
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/app/_elements')
-rw-r--r--frontend/src/app/_elements/line-chart/line-chart.component.css0
-rw-r--r--frontend/src/app/_elements/line-chart/line-chart.component.html9
-rw-r--r--frontend/src/app/_elements/line-chart/line-chart.component.spec.ts25
-rw-r--r--frontend/src/app/_elements/line-chart/line-chart.component.ts57
-rw-r--r--frontend/src/app/_elements/model-load/model-load.component.html62
-rw-r--r--frontend/src/app/_elements/model-load/model-load.component.ts23
6 files changed, 129 insertions, 47 deletions
diff --git a/frontend/src/app/_elements/line-chart/line-chart.component.css b/frontend/src/app/_elements/line-chart/line-chart.component.css
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/frontend/src/app/_elements/line-chart/line-chart.component.css
diff --git a/frontend/src/app/_elements/line-chart/line-chart.component.html b/frontend/src/app/_elements/line-chart/line-chart.component.html
new file mode 100644
index 00000000..8607aac5
--- /dev/null
+++ b/frontend/src/app/_elements/line-chart/line-chart.component.html
@@ -0,0 +1,9 @@
+<div class="chart-wrapper">
+ <canvas baseChart
+ [datasets]="lineChartData"
+ [labels]="lineChartLabels"
+ [options]="lineChartOptions"
+ [legend]="lineChartLegend"
+ [plugins]="lineChartPlugins">
+ </canvas>
+</div> \ No newline at end of file
diff --git a/frontend/src/app/_elements/line-chart/line-chart.component.spec.ts b/frontend/src/app/_elements/line-chart/line-chart.component.spec.ts
new file mode 100644
index 00000000..0c5e7ef5
--- /dev/null
+++ b/frontend/src/app/_elements/line-chart/line-chart.component.spec.ts
@@ -0,0 +1,25 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { LineChartComponent } from './line-chart.component';
+
+describe('LineChartComponent', () => {
+ let component: LineChartComponent;
+ let fixture: ComponentFixture<LineChartComponent>;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ LineChartComponent ]
+ })
+ .compileComponents();
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(LineChartComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/frontend/src/app/_elements/line-chart/line-chart.component.ts b/frontend/src/app/_elements/line-chart/line-chart.component.ts
new file mode 100644
index 00000000..7a06ecf5
--- /dev/null
+++ b/frontend/src/app/_elements/line-chart/line-chart.component.ts
@@ -0,0 +1,57 @@
+import { Component, OnInit } from '@angular/core';
+import { ChartOptions } from 'chart.js';
+import { BaseChartDirective } from 'ng2-charts';
+
+@Component({
+ selector: 'app-line-chart',
+ templateUrl: './line-chart.component.html',
+ styleUrls: ['./line-chart.component.css']
+})
+export class LineChartComponent implements OnInit {
+
+ constructor() { }
+
+ ngOnInit(): void {
+ }
+ lineChartData:Array<any> = [
+ {data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A'},
+ {data: [28, 48, 40, 19, 86, 27, 90], label: 'Series B'},
+ {data: [18, 48, 77, 9, 100, 27, 40], label: 'Series C'}
+ ];
+ lineChartLabels: BaseChartDirective["labels"] = ['January', 'February', 'March', 'April', 'May', 'June'];
+ lineChartOptions = {
+ responsive: true,
+ };
+ lineChartColors:Array<any> = [
+ { // grey
+ backgroundColor: 'rgba(148,159,177,0.2)',
+ borderColor: 'rgba(148,159,177,1)',
+ pointBackgroundColor: 'rgba(148,159,177,1)',
+ pointBorderColor: '#fff',
+ pointHoverBackgroundColor: '#fff',
+ pointHoverBorderColor: 'rgba(148,159,177,0.8)'
+ },
+ { // dark grey
+ backgroundColor: 'rgba(77,83,96,0.2)',
+ borderColor: 'rgba(77,83,96,1)',
+ pointBackgroundColor: 'rgba(77,83,96,1)',
+ pointBorderColor: '#fff',
+ pointHoverBackgroundColor: '#fff',
+ pointHoverBorderColor: 'rgba(77,83,96,1)'
+ },
+ { // grey
+ backgroundColor: 'rgba(148,159,177,0.2)',
+ borderColor: 'rgba(148,159,177,1)',
+ pointBackgroundColor: 'rgba(148,159,177,1)',
+ pointBorderColor: '#fff',
+ pointHoverBackgroundColor: '#fff',
+ pointHoverBorderColor: 'rgba(148,159,177,0.8)'
+ }
+ ];
+ lineChartLegend = true;
+ lineChartPlugins = [];
+ lineChartType = 'line';
+
+}
+
+
diff --git a/frontend/src/app/_elements/model-load/model-load.component.html b/frontend/src/app/_elements/model-load/model-load.component.html
index dcb35c21..a1e6abd6 100644
--- a/frontend/src/app/_elements/model-load/model-load.component.html
+++ b/frontend/src/app/_elements/model-load/model-load.component.html
@@ -1,12 +1,10 @@
<div>
<div class="d-flex flex-row justify-content-center align-items-center mt-3 mb-5">
- <button type="button" id="btnMyModel" class="btn" (click)="viewMyModelsForm()"
- [ngClass]="{'btnType1': showMyModels, 'btnType2': !showMyModels}">
+ <button type="button" id="btnMyModel" class="btn" (click)="viewMyModelsForm()" [ngClass]="{'btnType1': showMyModels, 'btnType2': !showMyModels}">
Izaberite model iz kolekcije
</button>
<h3 class="mt-3 mx-3">ili</h3>
- <button type="button" id="btnNewModel" class="btn" (click)="viewNewModelForm()"
- [ngClass]="{'btnType1': !showMyModels, 'btnType2': showMyModels}">
+ <button type="button" id="btnNewModel" class="btn" (click)="viewNewModelForm()" [ngClass]="{'btnType1': !showMyModels, 'btnType2': showMyModels}">
Dodajte novi model
</button>
</div>
@@ -17,8 +15,7 @@
<div *ngIf="showMyModels" class="px-5">
<div class="overflow-auto" style="max-height: 500px;">
<ul class="list-group">
- <li class="list-group-item p-3" *ngFor="let model of myModels|filter:term|filter:(forExperiment ? forExperiment.type : '')"
- [ngClass]="{'selectedModelClass': this.selectedModel == model}">
+ <li class="list-group-item p-3" *ngFor="let model of myModels|filter:((forExperiment != undefined) ? forExperiment.type : '')" [ngClass]="{'selectedModelClass': this.selectedModel == model}">
<app-item-model name="usersModel" [model]="model" (click)="selectThisModel(model);">
</app-item-model>
</li>
@@ -43,7 +40,7 @@
<textarea class="form-control" name="desc" rows="3" [(ngModel)]="newModel.description"></textarea>
</div>
</div>
-
+
</div>
<h2 class="mt-5 mb-4 mx-5">Parametri treniranja modela:</h2>
<div>
@@ -54,8 +51,7 @@
<label for="type" class="col-form-label">Tip problema: </label>
</div>
<div class="col-2">
- <select id=typeOptions class="form-select" name="type" [(ngModel)]="newModel.type"
- (change)="filterOptions()">
+ <select id=typeOptions class="form-select" name="type" [(ngModel)]="newModel.type" (change)="filterOptions()">
<option
*ngFor="let option of Object.keys(ProblemType); let optionName of Object.values(ProblemType)"
[value]="option">
@@ -68,10 +64,7 @@
<label for="hiddenLayers" class="col-form-label">Broj skrivenih slojeva: </label>
</div>
<div class="col-1">
- <input type="number" min="1" class="form-control" name="hiddenLayers"
- [(ngModel)]="newModel.hiddenLayers"
- (change)="newModel.hiddenLayerActivationFunctions = [].constructor(newModel.hiddenLayers).fill(newModel.hiddenLayerActivationFunctions[0])"
- (ngModelChange)="updateGraph()">
+ <input type="number" min="1" class="form-control" name="hiddenLayers" [(ngModel)]="newModel.hiddenLayers" (change)="newModel.hiddenLayerActivationFunctions = [].constructor(newModel.hiddenLayers).fill(newModel.hiddenLayerActivationFunctions[0])" (ngModelChange)="updateGraph()">
</div>
</div>
@@ -96,8 +89,7 @@
<label for="hiddenLayerNeurons" class="col-form-label">Broj neurona skrivenih slojeva: </label>
</div>
<div class="col-1">
- <input type="number" min="1" class="form-control" name="hiddenLayerNeurons"
- [(ngModel)]="newModel.hiddenLayerNeurons" (ngModelChange)="updateGraph()">
+ <input type="number" min="1" class="form-control" name="hiddenLayerNeurons" [(ngModel)]="newModel.hiddenLayerNeurons" (ngModelChange)="updateGraph()">
</div>
</div>
@@ -107,8 +99,7 @@
<label for="lossFunction" class="col-form-label">Funkcija troška: </label>
</div>
<div class="col-2">
- <select id=lossFunctionOptions class="form-select" name="lossFunction"
- [(ngModel)]="newModel.lossFunction" aria-checked="true">
+ <select id=lossFunctionOptions class="form-select" name="lossFunction" [(ngModel)]="newModel.lossFunction" aria-checked="true">
<option
*ngFor="let option of Object.keys(lossFunction); let optionName of Object.values(lossFunction)"
[value]="option">
@@ -118,23 +109,21 @@
</div>
<div class="col-1"></div>
<div class="col-3">
- <label for="batchSize" class="col-form-label">Broj uzorka po iteraciji: </label>
+ <label for="batchSize" class="col-form-label">Broj uzorka po iteraciji:&nbsp;<b>{{newModel.batchSize}}</b><br>(izaberite stepen dvojke)</label>
</div>
<div class="col-1">
-
- <input type="number" min="0" step="1" max="7" class="form-control" name="batchSizePower" [(ngModel)]="batchSizePower" (click)="updateBatchSize()" >
- {{newModel.batchSize}}
-
+
+ <input type="number" min="0" step="1" max="7" class="form-control" name="batchSizePower" [(ngModel)]="batchSizePower" (click)="updateBatchSize()">
+
</div>
-
+
<div class="row p-2">
<div class="col-1"></div>
<div class="col-3 m-1">
<label for="epochs" class="col-form-label">Broj epoha: </label>
</div>
<div class="col-1">
- <input type="number" min="1" max="1000" class="form-control" name="epochs"
- [(ngModel)]="newModel.epochs">
+ <input type="number" min="1" max="1000" class="form-control" name="epochs" [(ngModel)]="newModel.epochs">
</div>
</div>
</div>
@@ -148,8 +137,7 @@
<div class="row p-2" style="align-self: center;">
<div class="col-1"></div>
<div class="col-3">
- <label for="hiddenLayerActivationFunction" class="col-form-label"
- style="text-align: center;">Funkcija aktivacije<br>skrivenih slojeva:</label>
+ <label for="hiddenLayerActivationFunction" class="col-form-label" style="text-align: center;">Funkcija aktivacije<br>skrivenih slojeva:</label>
</div>
<div class="col-2 mt-2">
<div *ngFor="let item of [].constructor(newModel.hiddenLayers); let i = index">
@@ -157,8 +145,7 @@
<div class="input-group-prepend">
<span class="input-group-text">#{{i+1}}</span>
</div>
- <select [id]="'hiddenLayerActivationFunctionOption_'+i" class="form-select"
- [(ngModel)]="newModel.hiddenLayerActivationFunctions[i]" >
+ <select [id]="'hiddenLayerActivationFunctionOption_'+i" class="form-select" [(ngModel)]="newModel.hiddenLayerActivationFunctions[i]">
<option
*ngFor="let option of Object.keys(ActivationFunction); let optionName of Object.values(ActivationFunction)"
[value]="option">
@@ -170,12 +157,10 @@
</div>
<div class="col-1"></div>
<div class="col-2">
- <label for="outputLayerActivationFunction" class="col-form-label"
- style="text-align: center;">Funkcija aktivacije<br>izlaznog sloja:</label>
+ <label for="outputLayerActivationFunction" class="col-form-label" style="text-align: center;">Funkcija aktivacije<br>izlaznog sloja:</label>
</div>
<div class="col-2 mt-2">
- <select id=outputLayerActivationFunctionOptions class="form-select"
- name="outputLayerActivationFunction" [(ngModel)]="newModel.outputLayerActivationFunction">
+ <select id=outputLayerActivationFunctionOptions class="form-select" name="outputLayerActivationFunction" [(ngModel)]="newModel.outputLayerActivationFunction">
<option
*ngFor="let option of Object.keys(ActivationFunction); let optionName of Object.values(ActivationFunction)"
[value]="option">
@@ -192,22 +177,19 @@
<h3>Izaberite metrike:</h3>
<div id="divMetricsinput" class="mt-2 mx-5">
- <div *ngFor="let option of Object.keys(metrics); let optionName of Object.values(metrics) "
- class="form-check form-check-inline">
+ <div *ngFor="let option of Object.keys(metrics); let optionName of Object.values(metrics) " class="form-check form-check-inline">
- <input name="cbmetrics" class="form-check-input" type="checkbox" value="{{option}}"
- id="metrics_{{option}}" style="float: left;" checked>
+ <input name="cbmetrics" class="form-check-input" type="checkbox" value="{{option}}" id="metrics_{{option}}" style="float: left;" checked>
<label class="form-check-label" for="metrics_{{option}}" for="inlineCheckbox2">
{{optionName}}
</label>
</div>
</div>
</div>
-
+
<div class="form-group row mt-3 mb-3">
<div class="col"></div>
- <button class="btn btn-lg col-4" style="background-color:#003459; color:white;"
- (click)="uploadModel();">Sačuvaj
+ <button class="btn btn-lg col-4" style="background-color:#003459; color:white;" (click)="uploadModel();">Sačuvaj
model</button>
<div class="col"></div>
</div>
diff --git a/frontend/src/app/_elements/model-load/model-load.component.ts b/frontend/src/app/_elements/model-load/model-load.component.ts
index dbca3d17..5f9caf9d 100644
--- a/frontend/src/app/_elements/model-load/model-load.component.ts
+++ b/frontend/src/app/_elements/model-load/model-load.component.ts
@@ -31,21 +31,32 @@ export class ModelLoadComponent implements OnInit {
shared = Shared;
term: string = "";
- selectedProblemType: string = '';
selectedMetrics = [];
lossFunction: any = LossFunction;
showMyModels: boolean = true;
+ batchSizePower: number = 2;
+
constructor(private modelsService: ModelsService) {
- this.modelsService.getMyModels().subscribe((models) => {
- this.myModels = models;
- });
+ //console.log("forExperiment = ", this.forExperiment);
+
+ //if (this.forExperiment == undefined) {
+ this.modelsService.getMyModels().subscribe((models) => {
+ this.myModels = models;
+ });
+ /*}
+ else {
+ this.modelsService.getMyModelsByType(ProblemType.Regression).subscribe((models) => {
+ this.myModels = models;
+ console.log("modeli po tipu: ", this.myModels);
+ });
+ }*/
}
ngOnInit(): void {
}
- batchSizePower:number=1;
+
updateBatchSize()
{
this.newModel.batchSize=2**this.batchSizePower;
@@ -73,8 +84,6 @@ export class ModelLoadComponent implements OnInit {
this.modelsService.addModel(this.newModel).subscribe((response) => {
Shared.openDialog('Model dodat', 'Model je uspešno dodat u bazu.');
- // treba da se selektuje nov model u listi modela
- //this.selectedModel =
}, (error) => {
Shared.openDialog('Greška', 'Model sa unetim nazivom već postoji u Vašoj kolekciji. Promenite naziv modela i nastavite sa kreiranim datasetom.');
});