diff options
Diffstat (limited to 'frontend/src/app/_pages/add-model')
-rw-r--r-- | frontend/src/app/_pages/add-model/add-model.component.html | 29 | ||||
-rw-r--r-- | frontend/src/app/_pages/add-model/add-model.component.ts | 104 |
2 files changed, 54 insertions, 79 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 97b35b7a..3d5fd7b1 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> @@ -63,12 +62,9 @@ <app-datatable [data]="datasetFile" [hasHeader]="datasetHasHeader"></app-datatable> </div> </div> - - <!-- ULAZNE/IZLAZNE KOLONE --> <span id="selectInAndOuts"></span> <div *ngIf="selectedDataset && ((showMyDatasets && selectedDatasetLoaded) || (!showMyDatasets && datasetLoaded))"> - <!--postignuto da se kod newdataseta ucita tabela pa ulazi/izlazi. ostalo srediti to kod mydatasets(dopuna 2. uslova)--> <div class="row"> <div class="col d-flex justify-content-center"> <h3>Izaberite ulazne kolone:</h3> @@ -121,7 +117,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"> @@ -198,9 +193,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" @@ -212,7 +205,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);"> @@ -254,8 +246,6 @@ </div> <h2 class="mt-5 mb-4">Parametri treniranja:</h2> - - <!--**********************************************************TIP*********************************************************--> <div> <div class="row p-2"> <div class="col-1"> @@ -273,7 +263,6 @@ </option> </select> </div> - <!--******************************************************************************************************************--> <div class="col-1"> </div> <div class="col-3"> @@ -287,8 +276,6 @@ </div> <div class="row p-2"> - <!--***********************************ENKODER*********************************************--> - <div class="col-1"> </div> <div class="col-3"> @@ -303,8 +290,6 @@ </select> </div> - <!--***********************************BROJ NEURONA SKRIVENOG SLOJA*********************************************--> - <div class="col-1"> </div> <div class="col-3"> @@ -315,7 +300,6 @@ [(ngModel)]="newModel.hiddenLayerNeurons"> </div> </div> - <!--***********************************OPTIMIZACIJA*********************************************--> <div class="row p-2"> <div class="col-1"> @@ -364,7 +348,6 @@ type="checkbox" value="" checked> </div> </div> - <!--************************************************************************************************* --> <div class="border m-3"> <div class="row p-2 m-2"> <div class="col-4"> @@ -397,8 +380,6 @@ </div> </div> </div> - - <!--***********************************AKTIVACIONE FUNKCIJE*********************************************--> <h3>Aktivacione funkcije:</h3> <div class="row p-2 m-2" style="align-self: center;"> @@ -443,10 +424,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> @@ -463,7 +441,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;" @@ -482,6 +459,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 b35b9fa4..d47b24e6 100644 --- a/frontend/src/app/_pages/add-model/add-model.component.ts +++ b/frontend/src/app/_pages/add-model/add-model.component.ts @@ -110,55 +110,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.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); + /* + this.getCheckedInputCols(); + this.getCheckedOutputCol(); + this.getMetrics(); + + if (this.validationInputsOutput()) { + console.log('ADD MODEL: STEP 1 - UPLOAD FILE'); 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 + 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) => { - 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) => { - //alert("greska uploadData"); - }); //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(); @@ -180,11 +180,11 @@ export class AddModelComponent implements OnInit { } else { alert("Molimo Vas da izaberete neki dataset iz kolekcije."); - } + }*/ } getCheckedInputCols() { - this.newModel.inputColumns = []; + /*this.newModel.inputColumns = []; let checkboxes: any; checkboxes = document.getElementsByName("cbsNew"); @@ -193,11 +193,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"); @@ -208,11 +208,11 @@ 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 == '') { + validationInputsOutput() { + /*if (this.newModel.inputColumns.length == 0 && this.newModel.columnToPredict == '') { alert("Molimo Vas da izaberete ulazne i izlazne kolone za mrežu."); return false; } @@ -231,7 +231,7 @@ export class AddModelComponent implements OnInit { return false; } } - return true; + return true;*/ } selectThisDataset(dataset: Dataset) { |