From 480bd1db98f08266fcc3c8f499eaea0365bde6b5 Mon Sep 17 00:00:00 2001 From: Danijel Andjelkovic Date: Tue, 22 Mar 2022 22:48:58 +0100 Subject: Dodao unos zamene nedostajucih vrednosti. --- frontend/src/app/_data/Model.ts | 16 +++- .../app/_pages/add-model/add-model.component.html | 102 +++++++++++++++------ .../app/_pages/add-model/add-model.component.ts | 51 +++++++---- 3 files changed, 123 insertions(+), 46 deletions(-) (limited to 'frontend/src/app') diff --git a/frontend/src/app/_data/Model.ts b/frontend/src/app/_data/Model.ts index 0768a374..07364564 100644 --- a/frontend/src/app/_data/Model.ts +++ b/frontend/src/app/_data/Model.ts @@ -26,7 +26,9 @@ export default class Model { public inputLayerActivationFunction: ActivationFunction = ActivationFunction.Sigmoid, public hiddenLayerActivationFunction: ActivationFunction = ActivationFunction.Sigmoid, public outputLayerActivationFunction: ActivationFunction = ActivationFunction.Sigmoid, - public username: string = '' + public username: string = '', + public nullValues: NullValueOptions = NullValueOptions.DeleteRows, + public nullValuesReplacers = [] ) { } } @@ -96,4 +98,16 @@ export enum Optimizer { SGD = 'SGD', SGDMomentum = 'SGDMomentum', RMSprop = 'RMSprop' +} + +export enum NullValueOptions { + DeleteRows = 'delete_rows', + DeleteColumns = 'delete_columns', + Replace = 'replace' +} + +export enum ReplaceWith { + None = '...', + Mean = 'Srednja vrednost', + Median = 'Medijana' } \ No newline at end of file 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 33066f80..e87d1431 100644 --- a/frontend/src/app/_pages/add-model/add-model.component.html +++ b/frontend/src/app/_pages/add-model/add-model.component.html @@ -38,33 +38,36 @@

ili

- + - -
-
-
    -
  • - -
  • -
-
+ +
+
+
    +
  • + +
  • +
- - - +
+ + +

- Izabrali ste dataset: {{this.selectedDataset.name}} + Izabrali ste dataset: {{this.selectedDataset.name}}

@@ -72,8 +75,8 @@

-   +   @@ -85,8 +88,8 @@

-   +   @@ -105,8 +108,8 @@

-   +   @@ -118,14 +121,60 @@

-   +  
+ + +
+

Popunjavanje nedostajućih vrednosti:

+
+ +
+ +
+ +

+
+
+ +
+
+
+ + {{column}} + + + +
+
+
+
+
+
+
@@ -257,7 +306,8 @@
@@ -288,8 +338,8 @@
- +
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 7bfb7204..a29f92d3 100644 --- a/frontend/src/app/_pages/add-model/add-model.component.ts +++ b/frontend/src/app/_pages/add-model/add-model.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, ViewChild } from '@angular/core'; -import Model from 'src/app/_data/Model'; -import { ANNType, Encoding, ActivationFunction, LossFunction, Optimizer } from 'src/app/_data/Model'; +import Model, { ReplaceWith } from 'src/app/_data/Model'; +import { ANNType, Encoding, ActivationFunction, LossFunction, Optimizer, NullValueOptions } from 'src/app/_data/Model'; import { DatasetLoadComponent } from 'src/app/_elements/dataset-load/dataset-load.component'; import { ModelsService } from 'src/app/_services/models.service'; import shared from 'src/app/Shared'; @@ -24,7 +24,10 @@ export class AddModelComponent implements OnInit { ActivationFunction = ActivationFunction; LossFunction = LossFunction; Optimizer = Optimizer; + NullValueOptions = NullValueOptions; + ReplaceWith = ReplaceWith; Object = Object; + document = document; shared = shared; selectedOutputColumnVal: string = ''; @@ -62,9 +65,9 @@ export class AddModelComponent implements OnInit { addModel() { if (!this.showMyDatasets) - this.saveModelWithNewDataset(); + this.saveModelWithNewDataset(); else - this.saveModelWithExistingDataset(); + this.saveModelWithExistingDataset(); } trainModel() { @@ -124,14 +127,14 @@ export class AddModelComponent implements OnInit { if (this.selectedDataset) { //dataset je izabran this.getCheckedInputCols(); this.getCheckedOutputCol(); - - if (this.validationInputsOutput()) { + + if (this.validationInputsOutput()) { this.newModel.datasetId = this.selectedDataset._id; - + this.newModel.randomTestSetDistribution = 1 - Math.round(this.tempTestSetDistribution / 100 * 10) / 10; this.tempTestSetDistribution = 90; this.newModel.username = shared.username; - + this.models.addModel(this.newModel).subscribe((response) => { console.log('ADD MODEL: DONE! REPLY:\n', response); }, (error) => { @@ -150,8 +153,8 @@ export class AddModelComponent implements OnInit { if (this.showMyDatasets) checkboxes = document.getElementsByName("cbsExisting"); else - checkboxes = document.getElementsByName("cbsNew"); - + checkboxes = document.getElementsByName("cbsNew"); + for (let i = 0; i < checkboxes.length; i++) { let thatCb = checkboxes[i]; if (thatCb.checked == true && thatCb.disabled == false) @@ -165,7 +168,7 @@ export class AddModelComponent implements OnInit { if (this.showMyDatasets) radiobuttons = document.getElementsByName("rbsExisting"); else - radiobuttons = document.getElementsByName("rbsNew"); + radiobuttons = document.getElementsByName("rbsNew"); for (let i = 0; i < radiobuttons.length; i++) { let thatRb = radiobuttons[i]; @@ -224,16 +227,16 @@ export class AddModelComponent implements OnInit { checkAllCbs() { let checkboxes: any; //if (this.showMyDatasets) - checkboxes = document.getElementsByName("cbsExisting"); + checkboxes = document.getElementsByName("cbsExisting"); //else - //checkboxes = document.getElementsByName("cbsNew"); - + //checkboxes = document.getElementsByName("cbsNew"); + for (let i = 0; i < checkboxes.length; i++) { (checkboxes[i]).checked = true; (checkboxes[i]).disabled = false; } - checkboxes = document.getElementsByName("cbsNew"); + checkboxes = document.getElementsByName("cbsNew"); for (let i = 0; i < checkboxes.length; i++) { (checkboxes[i]).checked = true; (checkboxes[i]).disabled = false; @@ -243,14 +246,14 @@ export class AddModelComponent implements OnInit { this.selectedOutputColumnVal = ''; let radiobuttons: any; //if (this.showMyDatasets) - radiobuttons = document.getElementsByName("rbsExisting"); + radiobuttons = document.getElementsByName("rbsExisting"); //else - //radiobuttons = document.getElementsByName("rbsNew"); + //radiobuttons = document.getElementsByName("rbsNew"); for (let i = 0; i < radiobuttons.length; i++) (radiobuttons[i]).checked = false; - radiobuttons = document.getElementsByName("rbsNew"); - for (let i = 0; i < radiobuttons.length; i++) + radiobuttons = document.getElementsByName("rbsNew"); + for (let i = 0; i < radiobuttons.length; i++) (radiobuttons[i]).checked = false; } @@ -260,4 +263,14 @@ export class AddModelComponent implements OnInit { }); } + isNumber(value: string | number): boolean { + return ((value != null) && + (value !== '') && + !isNaN(Number(value.toString()))); + } + + + getInputById(id: string): HTMLInputElement { + return document.getElementById(id) as HTMLInputElement; + } } -- cgit v1.2.3