diff options
Diffstat (limited to 'frontend/src/app/_pages/add-model')
-rw-r--r-- | frontend/src/app/_pages/add-model/add-model.component.html | 32 | ||||
-rw-r--r-- | frontend/src/app/_pages/add-model/add-model.component.ts | 110 |
2 files changed, 58 insertions, 84 deletions
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 9d727236..179e9aea 100644 --- a/frontend/src/app/_pages/add-model/add-model.component.html +++ b/frontend/src/app/_pages/add-model/add-model.component.html @@ -1,11 +1,10 @@ -<div id="header"> +<!--<div id="header"> <h1>Napravite svoj model veštačke neuronske mreže</h1> </div> <div id="wrapper"> <div id="container" class="container p-5" style="background-color: white; min-height: 100%;"> <div class="form-group row mt-3 mb-2 d-flex justify-content-center"> - <!--justify-content-center--> <h2 class="col-2"> Nov model: </h2> <div class="col-3"> <label for="name" class="col-form-label">Naziv modela:</label> @@ -26,16 +25,12 @@ <div class="py-3 pr-5 justify-content-center"> - <!--Od naslova Izvor podataka pa sve do prikaza tabele (i to) premesteno u dataset-load.component--> <app-dataset-load (selectedDatasetChangeEvent)="datasetHasChanged($event)"></app-dataset-load> </div> - - <!-- ULAZNE/IZLAZNE KOLONE --> <span id="selectInAndOuts"></span> <div - *ngIf="selectedDataset && ((showMyDatasets) || (!showMyDatasets))"> - <!--postignuto da se kod newdataseta ucita tabela pa ulazi/izlazi. ostalo srediti to kod mydatasets(dopuna 2. uslova)--> + *ngIf="selectedDataset && ((showMyDatasets && selectedDatasetLoaded) || (!showMyDatasets && datasetLoaded))"> <div class="row"> <div class="col d-flex justify-content-center"> <h3>Izaberite ulazne kolone:</h3> @@ -88,7 +83,6 @@ <div> <label for="columnReplacers" class="form-label">Unesite zamenu za svaku kolonu:</label> <div id="columnReplacers"> - <!--Ulazne kolone - popunjavanje null vrednosti --> <div *ngFor="let column of selectedDataset.header; let i = index" class="my-3"> <div *ngIf="getInputById('cb_'+column).checked" class=""> <span class="w-20 mx-3"> @@ -165,9 +159,7 @@ </div> </div> </div> - <!--Izlazna kolona - popunjavanje null vrednosti --> <div *ngFor="let column of selectedDataset.header; let i = index" class="my-3"> - <!--moze bez for petlje (this.selectedOutputColumnVal je id), al ne moze ova fja array column onda--> <div class="input-group row" *ngIf="getInputById('rb_'+column).checked"> <span class="input-group-text col-2 text-center"> {{column}} <span class="small" @@ -179,7 +171,6 @@ <input *ngIf="calculateSumOfNullValuesInCol(column)!=0" type="radio" [id]="'fillCol_'+column" class="col-1 mt-2" [name]="'delOp_'+column"> - <!--OVDE SREDI IZGLED--> <select [id]="'replaceOptions'+i" class="form-control col-2" *ngIf="isNumber(datasetFile[1][i]) && calculateSumOfNullValuesInCol(column)!=0" (change)="replaceWithSelectedNumber($event);"> @@ -221,8 +212,6 @@ </div> <h2 class="mt-5 mb-4">Parametri treniranja:</h2> - - <!--**********************************************************TIP*********************************************************--> <div> <div class="row p-2"> <div class="col-1"> @@ -240,7 +229,6 @@ </option> </select> </div> - <!--******************************************************************************************************************--> <div class="col-1"> </div> <div class="col-3"> @@ -254,8 +242,6 @@ </div> <div class="row p-2"> - <!--***********************************ENKODER*********************************************--> - <div class="col-1"> </div> <div class="col-3"> @@ -270,8 +256,6 @@ </select> </div> - <!--***********************************BROJ NEURONA SKRIVENOG SLOJA*********************************************--> - <div class="col-1"> </div> <div class="col-3"> @@ -282,7 +266,6 @@ [(ngModel)]="newModel.hiddenLayerNeurons"> </div> </div> - <!--***********************************OPTIMIZACIJA*********************************************--> <div class="row p-2"> <div class="col-1"> @@ -331,7 +314,6 @@ type="checkbox" value="" checked> </div> </div> - <!--************************************************************************************************* --> <div class="border m-3"> <div class="row p-2 m-2"> <div class="col-4"> @@ -364,8 +346,6 @@ </div> </div> </div> - - <!--***********************************AKTIVACIONE FUNKCIJE*********************************************--> <h3>Aktivacione funkcije:</h3> <div class="row p-2 m-2" style="align-self: center;"> @@ -410,10 +390,7 @@ </div> </div> </div> - <br><br> - <!--**********************************************METRIKE ZA KOMPAJLER I GRAFIKE***********************************************--> - <hr> <div class="form-check form-check-inline overflow-auto " style="width: max-content;"> <h3>Izaberite metrike:</h3> @@ -430,7 +407,6 @@ </div> </div> </div> - <!--<app-annvisual [model]="newModel"></app-annvisual>--> <div class="form-group row mt-5 mb-3"> <div class="col"></div> <button class="btn btn-lg col-4" style="background-color:#003459; color:white;" @@ -449,6 +425,4 @@ </div> </div> </div> - -<!--<button - (click)="calculateSumOfNullValuesInCol('Embarked'); calculateMeanColValue('Age');calculateMedianColValue('Age'); getNullValuesReplacersArray();">DUGME</button>-->
\ 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 192fc6ff..ba8f7d01 100644 --- a/frontend/src/app/_pages/add-model/add-model.component.ts +++ b/frontend/src/app/_pages/add-model/add-model.component.ts @@ -108,55 +108,55 @@ export class AddModelComponent implements OnInit { } saveModelWithNewDataset(callback: ((arg0: any) => void)) { - - this.getCheckedInputCols(); - this.getCheckedOutputCol(); - this.getMetrics(); - - if (this.validationInputsOutput()) { - console.log('ADD MODEL: STEP 1 - UPLOAD FILE'); - if (this.selectedDataset) { - //console.log("this.datasetLoadComponent.files:", this.datasetLoadComponent.files); - /*this.models.uploadData(this.datasetLoadComponent.files[0]).subscribe((file) => { ZAKOMENTARISANO ZBOG KOMPAJLERSKE GRESKE TOKOM REORGANIZACIJE - console.log('ADD MODEL: STEP 2 - ADD DATASET WITH FILE ID ' + file._id); - if (this.selectedDataset) { - this.selectedDataset!.fileId = file._id; - this.selectedDataset!.username = shared.username; - - this.datasets.addDataset(this.selectedDataset!).subscribe((dataset) => { - console.log('ADD MODEL: STEP 3 - ADD MODEL WITH DATASET ID ', dataset._id); - this.newModel.datasetId = dataset._id; - - //da se doda taj dataset u listu postojecih, da bude izabran - this.refreshMyDatasetList(); MORA OVO - this.showMyDatasets = true; - this.selectThisDataset(dataset); - - this.newModel.randomTestSetDistribution = 1 - Math.round(this.tempTestSetDistribution / 100 * 10) / 10; - this.tempTestSetDistribution = 90; - this.newModel.username = shared.username; - - this.newModel.nullValuesReplacers = this.getNullValuesReplacersArray(); - - this.models.addModel(this.newModel).subscribe((response) => { - callback(response); - }, (error) => { - shared.openDialog("Neuspeo pokušaj!", "Model sa unetim nazivom već postoji u Vašoj kolekciji. Promenite naziv modela i nastavite sa kreiranim datasetom."); - }); //kraj addModel subscribe + /* + this.getCheckedInputCols(); + this.getCheckedOutputCol(); + this.getMetrics(); + + if (this.validationInputsOutput()) { + console.log('ADD MODEL: STEP 1 - UPLOAD FILE'); + if (this.datasetLoadComponent) { + console.log("this.datasetLoadComponent.files:", this.datasetLoadComponent.files); + this.models.uploadData(this.datasetLoadComponent.files[0]).subscribe((file) => { + console.log('ADD MODEL: STEP 2 - ADD DATASET WITH FILE ID ' + file._id); + if (this.datasetLoadComponent) { + this.datasetLoadComponent.dataset.fileId = file._id; + this.datasetLoadComponent.dataset.username = shared.username; + + this.datasets.addDataset(this.datasetLoadComponent.dataset).subscribe((dataset) => { + console.log('ADD MODEL: STEP 3 - ADD MODEL WITH DATASET ID ', dataset._id); + this.newModel.datasetId = dataset._id; + + //da se doda taj dataset u listu postojecih, da bude izabran + this.refreshMyDatasetList(); + this.showMyDatasets = true; + this.selectThisDataset(dataset); + + this.newModel.randomTestSetDistribution = 1 - Math.round(this.tempTestSetDistribution / 100 * 10) / 10; + this.tempTestSetDistribution = 90; + this.newModel.username = shared.username; + + this.newModel.nullValuesReplacers = this.getNullValuesReplacersArray(); + + this.models.addModel(this.newModel).subscribe((response) => { + callback(response); + }, (error) => { + alert("Model sa unetim nazivom već postoji u Vašoj kolekciji.\nPromenite naziv modela i nastavite sa kreiranim datasetom."); + }); //kraj addModel subscribe + }, (error) => { + alert("Dataset sa unetim nazivom već postoji u Vašoj kolekciji.\nIzmenite naziv ili iskoristite postojeći dataset."); + }); //kraj addDataset subscribe + } //kraj treceg ifa }, (error) => { - shared.openDialog("Neuspeo pokušaj!", "Dataset sa unetim nazivom već postoji u Vašoj kolekciji. Izmenite naziv ili iskoristite postojeći dataset."); - }); //kraj addDataset subscribe - } //kraj treceg ifa - }, (error) => { - - }); //kraj uploadData subscribe*/ - - } //kraj drugog ifa - } //kraj prvog ifa + //alert("greska uploadData"); + }); //kraj uploadData subscribe + + } //kraj drugog ifa + } //kraj prvog ifa*/ } saveModelWithExistingDataset(callback: ((arg0: any) => void)): any { - if (this.selectedDataset) { //dataset je izabran + /*if (this.selectedDataset) { //dataset je izabran this.getCheckedInputCols(); this.getCheckedOutputCol(); this.getMetrics(); @@ -177,12 +177,12 @@ export class AddModelComponent implements OnInit { } } else { - shared.openDialog("Obaveštenje", "Molimo Vas da izaberete neki dataset iz kolekcije."); - } + alert("Molimo Vas da izaberete neki dataset iz kolekcije."); + }*/ } getCheckedInputCols() { - this.newModel.inputColumns = []; + /*this.newModel.inputColumns = []; let checkboxes: any; checkboxes = document.getElementsByName("cbsNew"); @@ -191,11 +191,11 @@ export class AddModelComponent implements OnInit { let thatCb = <HTMLInputElement>checkboxes[i]; if (thatCb.checked == true) // && thatCb.disabled == false ne treba nam ovo vise this.newModel.inputColumns.push(thatCb.value); - } + }*/ //console.log(this.checkedInputCols); } getCheckedOutputCol() { - this.newModel.columnToPredict = ''; + /*this.newModel.columnToPredict = ''; let radiobuttons: any; radiobuttons = document.getElementsByName("rbsNew"); @@ -206,12 +206,12 @@ export class AddModelComponent implements OnInit { this.newModel.columnToPredict = thatRb.value; break; } - } + }*/ //console.log(this.checkedOutputCol); } - validationInputsOutput(): boolean { - if (this.newModel.inputColumns.length == 0 && this.newModel.columnToPredict == '') { - shared.openDialog("Neuspeo pokušaj!", "Molimo Vas da izaberete ulazne i izlazne kolone za mrežu."); + validationInputsOutput() { + /*if (this.newModel.inputColumns.length == 0 && this.newModel.columnToPredict == '') { + alert("Molimo Vas da izaberete ulazne i izlazne kolone za mrežu."); return false; } else if (this.newModel.inputColumns.length == 0) { @@ -229,7 +229,7 @@ export class AddModelComponent implements OnInit { return false; } } - return true; + return true;*/ } /*selectThisDataset(dataset: Dataset) { |