From b573b0069512f4444aefdac0a24eb99c8fcb6586 Mon Sep 17 00:00:00 2001 From: Danijel Andjelkovic Date: Thu, 31 Mar 2022 13:48:13 +0200 Subject: Malo sredio add-model stranicu, popravio bug sa prikazom javnih datasetova na naslovnoj strani. ML socket salje poruke za epohe backendu. --- .../app/_pages/add-model/add-model.component.html | 280 ++++++++++++--------- .../app/_pages/add-model/add-model.component.ts | 60 ++--- 2 files changed, 199 insertions(+), 141 deletions(-) (limited to 'frontend/src/app/_pages/add-model') diff --git a/frontend/src/app/_pages/add-model/add-model.component.html b/frontend/src/app/_pages/add-model/add-model.component.html index de024904..67427e8d 100644 --- a/frontend/src/app/_pages/add-model/add-model.component.html +++ b/frontend/src/app/_pages/add-model/add-model.component.html @@ -41,7 +41,8 @@
- +
@@ -65,7 +66,8 @@ -
+
+

Izaberite ulazne kolone:

@@ -120,52 +122,99 @@
-
- - {{column}} ({{calculateSumOfNullValuesInCol(column)}} null) +
+ + {{column}} ({{calculateSumOfNullValuesInCol(column)}} + null) - - - - - - - - + + +
+
+
+
+ +
+ + +
+ + +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
-
+
+
- {{column}} ({{calculateSumOfNullValuesInCol(column)}} null) + {{column}} ({{calculateSumOfNullValuesInCol(column)}} + null) - - - + + + + - - - + +
@@ -201,7 +254,7 @@

Parametri treniranja:

- +
@@ -210,9 +263,8 @@
-
- +
@@ -282,7 +334,7 @@
- +
@@ -302,7 +354,7 @@
- +
--> -
-
-
-
- -
-
-
-
- +
+
+
+ +
+
+ trening + + + test +
-
- + +
+
+ +
+
+ +
-
- trening - - - test -
- -

Aktivacione funkcije

- -
-
+ + +

Aktivacione funkcije:

+ +
-
- +
+
+ #{{i+1}} +
+ +
-
-
- -
-
-
-
-
+
-
-
- - -
+

+

@@ -429,7 +478,14 @@
+
+

Rezultati treniranja

+

+ {{trainingResult}} +

+
- \ No newline at end of file + \ No newline at end of file diff --git a/frontend/src/app/_pages/add-model/add-model.component.ts b/frontend/src/app/_pages/add-model/add-model.component.ts index ead9049b..95e5fe5f 100644 --- a/frontend/src/app/_pages/add-model/add-model.component.ts +++ b/frontend/src/app/_pages/add-model/add-model.component.ts @@ -26,9 +26,9 @@ export class AddModelComponent implements OnInit { ProblemType = ProblemType; Encoding = Encoding; ActivationFunction = ActivationFunction; - activationFunction:any=ActivationFunction + activationFunction: any = ActivationFunction LossFunction = LossFunction; - lossFunction : any = LossFunction; + lossFunction: any = LossFunction; Optimizer = Optimizer; NullValueOptions = NullValueOptions; ReplaceWith = ReplaceWith; @@ -52,8 +52,10 @@ export class AddModelComponent implements OnInit { //accepted: Boolean; term: string = ""; - selectedProblemType:string=''; - + selectedProblemType: string = ''; + + trainingResult: string | undefined; + constructor(private models: ModelsService, private datasets: DatasetsService, private csv: CsvParseService) { this.newModel = new Model(); @@ -89,6 +91,7 @@ export class AddModelComponent implements OnInit { trainModel() { let saveFunc; + this.trainingResult = undefined; if (!this.showMyDatasets) saveFunc = (x: (arg0: any) => void) => { this.saveModelWithNewDataset(x) }; @@ -99,6 +102,7 @@ export class AddModelComponent implements OnInit { console.log('Saved, training model...', model); this.models.trainModel(model).subscribe(response => { console.log('Train model complete!', response); + this.trainingResult = response; }); })); //privremeno cuvanje modela => vraca id sacuvanog modela koji cemo da treniramo sad } @@ -304,9 +308,9 @@ export class AddModelComponent implements OnInit { refreshThreeNullValueRadioOptions() { //console.log((document.getElementById("delRows")).checked); const input = document.getElementById('delRows'); - console.log(input); // 👉️ input#subscribe + console.log(input); // 👉️ input#subscribe -// ✅ Works + // ✅ Works //input.checked = true; (document.getElementById("delRows")).checked = true; (document.getElementById("delCols")).checked = false; @@ -325,15 +329,15 @@ export class AddModelComponent implements OnInit { !isNaN(Number(value.toString()))); } - findColIndexByName(colName: string) : number { - if (this.datasetFile) - for (let i = 0; i < this.datasetFile[0].length; i++) - if (colName === this.datasetFile[0][i]) + findColIndexByName(colName: string): number { + if (this.datasetFile) + for (let i = 0; i < this.datasetFile[0].length; i++) + if (colName === this.datasetFile[0][i]) return i; return -1; } - findColNameByIndex(index: number) : string { - if (this.datasetFile) + findColNameByIndex(index: number): string { + if (this.datasetFile) if (this.datasetHasHeader && index < this.datasetFile[0].length) return this.datasetFile[0][index]; return ''; @@ -347,7 +351,7 @@ export class AddModelComponent implements OnInit { } calculateSumOfNullValuesInCol(colName: string): number { //console.log(this.datasetFile); - if (this.datasetFile) { + if (this.datasetFile) { let colIndex = this.findColIndexByName(colName); let sumOfNulls = 0; @@ -372,8 +376,8 @@ export class AddModelComponent implements OnInit { sum += Number(this.datasetFile[i][colIndex]); ++n; } - console.log(sum / n); - return (sum != 0)? (sum / n) : 0; + console.log(sum / n); + return (sum != 0) ? (sum / n) : 0; } return 0; } @@ -386,7 +390,7 @@ export class AddModelComponent implements OnInit { for (let i = startValue; i < this.datasetFile.length; i++) if (this.datasetFile[i][colIndex] != '') array.push(Number(this.datasetFile[i][colIndex])); - + array.sort(); if (array.length % 2 == 0) return array[array.length / 2 - 1] / 2; @@ -407,7 +411,7 @@ export class AddModelComponent implements OnInit { else { if (value == colName) (document.getElementById("fillText_" + colName)).value = ""; - else + else (document.getElementById("fillText_" + colName)).value = value; } } @@ -426,8 +430,8 @@ export class AddModelComponent implements OnInit { (document.getElementById("fillText_" + colName)).value = ""; } - - getNullValuesReplacersArray() : NullValReplacer[] { + + getNullValuesReplacersArray(): NullValReplacer[] { let array: NullValReplacer[] = []; if (this.datasetFile) { @@ -459,7 +463,7 @@ export class AddModelComponent implements OnInit { value: (document.getElementById("fillText_" + column)).value }); } - } + } } } } @@ -473,23 +477,21 @@ export class AddModelComponent implements OnInit { arrayColumn = (arr: any[][], n: number) => [...new Set(arr.map(x => x[n]))]; - problemtype:string=''; - - filterOptions(){ - switch(this.problemtype){ + filterOptions() { + switch (this.newModel.type) { case 'regresioni': - this.lossFunction=LossFunctionRegression; + this.lossFunction = LossFunctionRegression; break; case 'binarni-klasifikacioni': - this.lossFunction=LossFunctionBinaryClassification; + this.lossFunction = LossFunctionBinaryClassification; break; case 'multi-klasifikacioni': - this.lossFunction=LossFunctionMultiClassification; - break; + this.lossFunction = LossFunctionMultiClassification; + break; default: break; } } - + } -- cgit v1.2.3