aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/experiment/experiment.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/app/experiment/experiment.component.ts')
-rw-r--r--frontend/src/app/experiment/experiment.component.ts57
1 files changed, 21 insertions, 36 deletions
diff --git a/frontend/src/app/experiment/experiment.component.ts b/frontend/src/app/experiment/experiment.component.ts
index 7ccca528..8a1b7d70 100644
--- a/frontend/src/app/experiment/experiment.component.ts
+++ b/frontend/src/app/experiment/experiment.component.ts
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
-import Experiment, { NullValReplacer, NullValueOptions, ReplaceWith } from '../_data/Experiment';
+import Experiment, { NullValReplacer, NullValueOptions, ReplaceWith, Encoding } from '../_data/Experiment';
import Model from '../_data/Model';
import Dataset, { ColumnInfo } from '../_data/Dataset';
import { ModelsService } from '../_services/models.service';
@@ -20,12 +20,15 @@ export class ExperimentComponent implements OnInit {
NullValueOptions = NullValueOptions;
ReplaceWith = ReplaceWith;
+ Encoding = Encoding;
Object = Object;
selectedColumnsInfoArray: ColumnInfo[] = [];
- selectedOutputColumnVal: string = '';
+ //selectedOutputColumnVal: string = '';
selectedNullColumnsArray: string[] = [];
+ tempTestSetDistribution = 90;
+
constructor(private modelsService: ModelsService, private experimentsService: ExperimentsService) { }
ngOnInit(): void {
@@ -36,12 +39,7 @@ export class ExperimentComponent implements OnInit {
this.selectedDataset = dataset;
this.selectedColumnsInfoArray = this.selectedDataset.columnInfo;
this.selectedNullColumnsArray = [];
- console.log("array:", this.selectedColumnsInfoArray);
- }
-
- updateModel(model: Model) {
- //console.log(model);
- this.selectedModel = model;
+ //console.log("array:", this.selectedColumnsInfoArray);
}
getInputById(id: string): HTMLInputElement {
@@ -71,9 +69,9 @@ export class ExperimentComponent implements OnInit {
checkedColumnsChanged(checkedColumnInfo: ColumnInfo, buttonType: number) { //0-input,1-output
let col = this.selectedColumnsInfoArray.find(x => x.columnName == checkedColumnInfo.columnName);
if (buttonType == 0) { //inputCol
- if (col == undefined)
+ if (col == undefined)
this.selectedColumnsInfoArray.push(checkedColumnInfo);
- else
+ else
this.selectedColumnsInfoArray = this.selectedColumnsInfoArray.filter(x => x.columnName != checkedColumnInfo.columnName);
}
else { //outputCol
@@ -81,7 +79,7 @@ export class ExperimentComponent implements OnInit {
this.selectedColumnsInfoArray.push(checkedColumnInfo);
}
//console.log(this.selectedColumnsInfoArray);
- }
+ }
replace(event: Event, column: ColumnInfo) {
let option = (<HTMLInputElement>event.target).value;
@@ -170,21 +168,24 @@ export class ExperimentComponent implements OnInit {
Shared.openDialog("Greška", "Molimo Vas da izaberete ulazne kolone.");
return;
}
-
+
this.experiment._id = '';
this.experiment.uploaderId = '';
this.experiment.datasetId = this.selectedDataset._id;
-
+
let pom = this.selectedColumnsInfoArray.filter(x => x.columnName != this.experiment.outputColumn);
for (let i = 0; i < pom.length; i++)
this.experiment.inputColumns.push(pom[i].columnName);
- this.selectedColumnsInfoArray = this.selectedColumnsInfoArray.filter(x => x.numNulls > 0);
- //TREBAJU MI NULLVALUESREPLACERI
+ //this.experiment.outputColumn = this.selectedOutputColumnVal;
+
+ this.selectedColumnsInfoArray = this.selectedColumnsInfoArray.filter(x => x.numNulls > 0); //obavezno
this.experiment.nullValuesReplacers = this.getNullValuesReplacersArray();
- console.log("Eksperiment:", this.experiment);
-
+ this.experiment.randomTestSetDistribution = 1 - Math.round(this.tempTestSetDistribution / 100 * 10) / 10;
+
+ //console.log("Eksperiment:", this.experiment);
+
this.experimentsService.addExperiment(this.experiment).subscribe((response) => {
this.experiment = response;
@@ -193,25 +194,9 @@ export class ExperimentComponent implements OnInit {
Shared.openDialog("Obaveštenje", "Eksperiment je uspešno kreiran.");
}, (error) => {
-
- });
- }
-
- trainModel() {
- this.trainingResult = undefined;
- //console.log('Training model...', this.selectedModel);
- if (!this.selectedDataset) {
- Shared.openDialog('Greška', 'Izvor podataka nije izabran!');
- return;
- }
- // TODO proveri nullValues
- if (!this.selectedModel) {
- Shared.openDialog('Greška', 'Model nije izabran!');
- return;
- }
- this.modelsService.trainModel(this.selectedModel).subscribe((response: any) => {
- console.log('Train model complete!', response);
- this.trainingResult = response;
+ if (error.error == "Experiment with this name exists") {
+ Shared.openDialog("Greška", "Eksperiment sa unetim nazivom već postoji u Vašoj kolekciji. Unesite neki drugi naziv.");
+ }
});
}
}