From 0e945bd6f428edb13718aed247209f215b93e735 Mon Sep 17 00:00:00 2001 From: Ivan Ljubisavljevic Date: Wed, 4 May 2022 20:27:55 +0200 Subject: Update, delete - Dataset, Model, Experiment. Public models... --- frontend/src/app/_data/Model.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'frontend/src/app/_data') diff --git a/frontend/src/app/_data/Model.ts b/frontend/src/app/_data/Model.ts index 185e2257..526a8290 100644 --- a/frontend/src/app/_data/Model.ts +++ b/frontend/src/app/_data/Model.ts @@ -28,8 +28,10 @@ export default class Model extends FolderFile { // Test set settings public randomOrder: boolean = true, public randomTestSet: boolean = true, - public randomTestSetDistribution: number = 0.1 //0.1-0.9 (10% - 90%) JESTE OVDE ZAKUCANO 10, AL POSLATO JE KAO 0.1 BACK-U + public randomTestSetDistribution: number = 0.1, //0.1-0.9 (10% - 90%) JESTE OVDE ZAKUCANO 10, AL POSLATO JE KAO 0.1 BACK-U + public isPublic: boolean = false, + public accessibleByLink: boolean = false ) { super(name, dateCreated, lastUpdated); } -- cgit v1.2.3 From a5365ef62bc89130b4240e124b3a361edfb34391 Mon Sep 17 00:00:00 2001 From: Danijel Anđelković Date: Wed, 4 May 2022 21:06:06 +0200 Subject: Dodao dugmad za brisanje kada korisnik pregleda liste ssvojih podataka, ispravio neke bagove oko grafa kada nema ulaznih kolona. Dodao kor. matricu u dataset. --- backend/api/api/Models/Dataset.cs | 1 + backend/api/api/Models/Model.cs | 3 ++- backend/api/api/Services/FillAnEmptyDb.cs | 6 +++--- frontend/src/app/_data/Dataset.ts | 6 +++--- frontend/src/app/_data/Experiment.ts | 9 ++++---- .../src/app/_elements/folder/folder.component.css | 8 +++++++ .../src/app/_elements/folder/folder.component.html | 12 ++++++++--- .../src/app/_elements/folder/folder.component.ts | 25 +++++++++++++++------- .../_elements/form-model/form-model.component.html | 4 +++- .../src/app/_elements/graph/graph.component.html | 2 +- .../src/app/_elements/graph/graph.component.ts | 2 +- .../_pages/experiment/experiment.component.html | 2 +- 12 files changed, 54 insertions(+), 26 deletions(-) (limited to 'frontend/src/app/_data') diff --git a/backend/api/api/Models/Dataset.cs b/backend/api/api/Models/Dataset.cs index 7acd4382..beb66de9 100644 --- a/backend/api/api/Models/Dataset.cs +++ b/backend/api/api/Models/Dataset.cs @@ -28,6 +28,7 @@ namespace api.Models public int nullRows { get; set; } public bool isPreProcess { get; set; } + public float[][] cMatrix { get; set; } } } diff --git a/backend/api/api/Models/Model.cs b/backend/api/api/Models/Model.cs index d8921713..494ae9e9 100644 --- a/backend/api/api/Models/Model.cs +++ b/backend/api/api/Models/Model.cs @@ -27,7 +27,8 @@ namespace api.Models public string lossFunction { get; set; } //public int inputNeurons { get; set; } public int hiddenLayers { get; set; } - public int batchSize { get; set; } + public string batchSize { get; set; } + public string learningRate { get; set; } // na izlazu je moguce da bude vise neurona (klasifikacioni problem sa vise od 2 klase) public int outputNeurons { get; set; } public Layer[] layers { get; set; } diff --git a/backend/api/api/Services/FillAnEmptyDb.cs b/backend/api/api/Services/FillAnEmptyDb.cs index 99bbb91f..f05d8cd8 100644 --- a/backend/api/api/Services/FillAnEmptyDb.cs +++ b/backend/api/api/Services/FillAnEmptyDb.cs @@ -99,7 +99,7 @@ namespace api.Services model.optimizer = "Adam"; model.lossFunction = "mean_squared_error"; model.hiddenLayers = 5; - model.batchSize = 8; + model.batchSize = "8"; model.outputNeurons = 0; model.outputLayerActivationFunction = "sigmoid"; model.metrics = new string[] { }; @@ -210,7 +210,7 @@ namespace api.Services model.optimizer = "Adam"; model.lossFunction = "mean_absolute_error"; model.hiddenLayers = 4; - model.batchSize = 5; + model.batchSize = "8"; model.outputNeurons = 0; model.outputLayerActivationFunction = "relu"; model.metrics = new string[] { }; @@ -316,7 +316,7 @@ namespace api.Services model.optimizer = "Adam"; model.lossFunction = "sparse_categorical_crossentropy"; model.hiddenLayers = 3; - model.batchSize = 4; + model.batchSize = "64"; model.outputNeurons = 0; model.outputLayerActivationFunction = "softmax"; model.metrics = new string[] { }; diff --git a/frontend/src/app/_data/Dataset.ts b/frontend/src/app/_data/Dataset.ts index 7ae5c4ab..9efb9f9b 100644 --- a/frontend/src/app/_data/Dataset.ts +++ b/frontend/src/app/_data/Dataset.ts @@ -18,7 +18,7 @@ export default class Dataset extends FolderFile { public rowCount: number = 0, public nullRows: number = 0, public nullCols: number = 0, - public preview: string[][] = [[]] + public cMatrix: string[][] = [[]] ) { super(name, dateCreated, lastUpdated); } @@ -39,13 +39,13 @@ export class ColumnInfo { public max?: number, public q1?: number, public q3?: number, - ) { + ) { /*if (isNumber) this.columnType = ColumnType.numerical; else this.columnType = ColumnType.categorical;*/ } - + } export enum ColumnType { diff --git a/frontend/src/app/_data/Experiment.ts b/frontend/src/app/_data/Experiment.ts index 9ad57fc3..05336495 100644 --- a/frontend/src/app/_data/Experiment.ts +++ b/frontend/src/app/_data/Experiment.ts @@ -16,10 +16,12 @@ export default class Experiment { public lastUpdated: Date = new Date(), public modelIds: string[] = [], - + public encodings: ColumnEncoding[] = []//[{columnName: "", columnEncoding: Encoding.Label}] ) { } + + _columnsSelected: boolean = false; } export enum NullValueOptions { @@ -67,9 +69,8 @@ export enum Encoding { } export class ColumnEncoding { - constructor ( + constructor( public columnName: string, public encoding: Encoding - ) - {} + ) { } } \ No newline at end of file diff --git a/frontend/src/app/_elements/folder/folder.component.css b/frontend/src/app/_elements/folder/folder.component.css index 2340ee8a..62324d62 100644 --- a/frontend/src/app/_elements/folder/folder.component.css +++ b/frontend/src/app/_elements/folder/folder.component.css @@ -152,6 +152,14 @@ display: none; } +.hover-show { + display: none; +} + +.list-item:hover>.hover-show { + display: initial; +} + .list-add { display: flex; flex-direction: row; diff --git a/frontend/src/app/_elements/folder/folder.component.html b/frontend/src/app/_elements/folder/folder.component.html index 48b59dc8..bff066be 100644 --- a/frontend/src/app/_elements/folder/folder.component.html +++ b/frontend/src/app/_elements/folder/folder.component.html @@ -56,15 +56,15 @@
-
- - + +
diff --git a/frontend/src/app/_elements/folder/folder.component.ts b/frontend/src/app/_elements/folder/folder.component.ts index 20ca1121..ffce3fb1 100644 --- a/frontend/src/app/_elements/folder/folder.component.ts +++ b/frontend/src/app/_elements/folder/folder.component.ts @@ -98,8 +98,8 @@ export class FolderComponent implements AfterViewInit { this.newFileSelected = false; this.listView = false; this.selectedFileChanged.emit(this.selectedFile); - this.displayFile(); this.selectTab(TabType.File); + this.displayFile(); } createNewFile() { @@ -117,9 +117,13 @@ export class FolderComponent implements AfterViewInit { _initialized: boolean = false; refreshFiles(selectedDatasetId: string | null) { + this.files = [] + this.filteredFiles.length = 0; + this.folders[TabType.NewFile] = []; + this.folders[TabType.File] = []; this.tabsToShow.forEach(tab => { this.folders[tab] = []; - }) + }); this.datasetsService.getMyDatasets().subscribe((datasets) => { this.folders[TabType.MyDatasets] = datasets; @@ -137,7 +141,6 @@ export class FolderComponent implements AfterViewInit { }); this.modelsService.getMyModels().subscribe((models) => { - console.log(models); this.folders[TabType.MyModels] = models; }); @@ -164,6 +167,7 @@ export class FolderComponent implements AfterViewInit { switch (this.type) { case FolderType.Dataset: this.formDataset!.uploadDataset((dataset: Dataset) => { + this.newFile = undefined; Shared.openDialog("Obaveštenje", "Uspešno ste dodali novi izvor podataka u kolekciju. Molimo sačekajte par trenutaka da se procesira."); this.refreshFiles(dataset._id); }, @@ -173,7 +177,7 @@ export class FolderComponent implements AfterViewInit { break; case FolderType.Model: this.modelsService.addModel(this.formModel.newModel).subscribe(model => { - this.formModel.newModel = model; + this.newFile = undefined; Shared.openDialog("Obaveštenje", "Uspešno ste dodali novu konfiguraciju neuronske mreže u kolekciju."); this.refreshFiles(null); // todo select model }, (err) => { @@ -205,8 +209,8 @@ export class FolderComponent implements AfterViewInit { filteredFiles: FolderFile[] = []; searchTermsChanged() { - if (!this.files) return; this.filteredFiles.length = 0; + if (!this.files) return; this.filteredFiles.push(...this.files.filter((file) => file.name.toLowerCase().includes(this.searchTerm.toLowerCase()))); /*if (this.selectedFile) { if (!this.filteredFiles.includes(this.selectedFile)) { @@ -226,17 +230,22 @@ export class FolderComponent implements AfterViewInit { this.listView = !this.listView; } - deleteFile(file: FolderFile) { + deleteFile(file: FolderFile, event: Event) { + event.stopPropagation(); console.log('delete'); switch (this.type) { case FolderType.Dataset: this.datasetsService.deleteDataset(file).subscribe((response) => { - console.log(response); + console.log(this.files, this.filteredFiles) + this.filteredFiles.splice(this.filteredFiles.indexOf(file), 1); + console.log(this.files, this.filteredFiles) + this.refreshFiles(null); + console.log(this.files, this.filteredFiles) }); break; case FolderType.Model: this.modelsService.deleteModel(file).subscribe((response) => { - console.log(response); + this.refreshFiles(null); }); break; case FolderType.Experiment: diff --git a/frontend/src/app/_elements/form-model/form-model.component.html b/frontend/src/app/_elements/form-model/form-model.component.html index c0318012..bf4aa0e3 100644 --- a/frontend/src/app/_elements/form-model/form-model.component.html +++ b/frontend/src/app/_elements/form-model/form-model.component.html @@ -108,7 +108,9 @@
- + + +
diff --git a/frontend/src/app/_elements/graph/graph.component.html b/frontend/src/app/_elements/graph/graph.component.html index 3c01bc5e..a021431d 100644 --- a/frontend/src/app/_elements/graph/graph.component.html +++ b/frontend/src/app/_elements/graph/graph.component.html @@ -1,7 +1,7 @@
- {{ i == 0 ? (inputColumns ? inputColumns[j] : 'nepoznato') : (i > 0 && i + {{ i == 0 ? (inputColumns && inputColumns.length >= j ? inputColumns[j] : 'nepoznato') : (i > 0 && i < layers.length - 1 ? model!.layers[i-1].activationFunction : (i==layers.length - 1 ? 'out' : '')) }}
diff --git a/frontend/src/app/_elements/graph/graph.component.ts b/frontend/src/app/_elements/graph/graph.component.ts index c7f8d964..73c3b1ab 100644 --- a/frontend/src/app/_elements/graph/graph.component.ts +++ b/frontend/src/app/_elements/graph/graph.component.ts @@ -28,7 +28,7 @@ export class GraphComponent implements AfterViewInit { @Input() outputNodeColor: string = '#dfd7d7'; private ctx!: CanvasRenderingContext2D; - @Input() inputColumns?: string[] = ['Nije odabran eksperiment']; + @Input() inputColumns?: string[]; constructor() { } diff --git a/frontend/src/app/_pages/experiment/experiment.component.html b/frontend/src/app/_pages/experiment/experiment.component.html index baae864e..83c45405 100644 --- a/frontend/src/app/_pages/experiment/experiment.component.html +++ b/frontend/src/app/_pages/experiment/experiment.component.html @@ -32,7 +32,7 @@
- +
-- cgit v1.2.3 From f5b097930797f49a97d12c9885def67a22edf02e Mon Sep 17 00:00:00 2001 From: Danijel Anđelković Date: Wed, 4 May 2022 21:38:53 +0200 Subject: Promenio ispis korelacione matrice na prave vrednosti. --- backend/microservice/api/newmlservice.py | 4 +++- frontend/src/app/_data/Dataset.ts | 2 +- .../_elements/column-table/column-table.component.html | 8 ++++---- .../app/_elements/column-table/column-table.component.ts | 16 ++++++++-------- frontend/src/app/_elements/folder/folder.component.ts | 2 +- .../app/_elements/form-model/form-model.component.html | 2 +- frontend/src/app/_elements/graph/graph.component.html | 6 +++--- 7 files changed, 21 insertions(+), 19 deletions(-) (limited to 'frontend/src/app/_data') diff --git a/backend/microservice/api/newmlservice.py b/backend/microservice/api/newmlservice.py index f5e5abcc..ad848fd9 100644 --- a/backend/microservice/api/newmlservice.py +++ b/backend/microservice/api/newmlservice.py @@ -130,7 +130,9 @@ def returnColumnsInfo(dataset): #print(NullRows) #print(len(NullRows)) allNullRows=len(NullRows) - return {'columnInfo':dict,'allNullColl':int(allNullCols),'allNullRows':int(allNullRows),'rowCount':int(rowCount),'colCount':int(colCount),'cMatrix':str(np.matrix(cMatrix))} + print(cMatrix.to_json(orient='index')) + #json.loads()['data'] + return {'columnInfo':dict,'allNullColl':int(allNullCols),'allNullRows':int(allNullRows),'rowCount':int(rowCount),'colCount':int(colCount),'cMatrix':json.loads(cMatrix.to_json(orient='split'))['data']} @dataclass class TrainingResultClassification: diff --git a/frontend/src/app/_data/Dataset.ts b/frontend/src/app/_data/Dataset.ts index 9efb9f9b..ca1a2a5e 100644 --- a/frontend/src/app/_data/Dataset.ts +++ b/frontend/src/app/_data/Dataset.ts @@ -18,7 +18,7 @@ export default class Dataset extends FolderFile { public rowCount: number = 0, public nullRows: number = 0, public nullCols: number = 0, - public cMatrix: string[][] = [[]] + public cMatrix: number[][] = [] ) { super(name, dateCreated, lastUpdated); } diff --git a/frontend/src/app/_elements/column-table/column-table.component.html b/frontend/src/app/_elements/column-table/column-table.component.html index 43895863..09ddffc6 100644 --- a/frontend/src/app/_elements/column-table/column-table.component.html +++ b/frontend/src/app/_elements/column-table/column-table.component.html @@ -64,15 +64,15 @@ - +
- {{colInfo.columnName}} + {{dataset.columnInfo[i].columnName}}
- +
- 0.1 + {{corrVal}}
diff --git a/frontend/src/app/_elements/column-table/column-table.component.ts b/frontend/src/app/_elements/column-table/column-table.component.ts index 7cac3b27..da451d55 100644 --- a/frontend/src/app/_elements/column-table/column-table.component.ts +++ b/frontend/src/app/_elements/column-table/column-table.component.ts @@ -36,7 +36,7 @@ export class ColumnTableComponent implements AfterViewInit { columnsChecked: boolean[] = []; //niz svih kolona loaded: boolean = false; - + constructor(private datasetService: DatasetsService, private experimentService: ExperimentsService, public csvParseService: CsvParseService, public dialog: MatDialog) { //ovo mi nece trebati jer primam dataset iz druge komponente } @@ -45,11 +45,11 @@ export class ColumnTableComponent implements AfterViewInit { this.dataset = dataset; this.setColumnTypeInitial(); - + this.dataset.columnInfo.forEach(column => { this.columnsChecked.push(true); }); - + this.resetInputColumns(); this.resetOutputColumn(); this.resetColumnEncodings(Encoding.Label); @@ -69,7 +69,7 @@ export class ColumnTableComponent implements AfterViewInit { } ngAfterViewInit(): void { - + } setColumnTypeInitial() { @@ -113,7 +113,7 @@ export class ColumnTableComponent implements AfterViewInit { columnTypeChanged(columnName: string) { if (this.experiment.outputColumn == columnName) this.changeOutputColumn(columnName); - else + else this.columnTableChangeDetected(); } @@ -147,7 +147,7 @@ export class ColumnTableComponent implements AfterViewInit { else { if (column.uniqueValues!.length == 2) this.experiment.type = ProblemType.BinaryClassification; - else + else this.experiment.type = ProblemType.MultiClassification; } this.columnTableChangeDetected(); @@ -199,7 +199,7 @@ export class ColumnTableComponent implements AfterViewInit { value: "" }); let numOfRowsToDelete = (this.dataset.columnInfo.filter(x => x.columnName == this.experiment!.inputColumns[i])[0]).numNulls; - this.nullValOption[i] = "Obriši redove (" + numOfRowsToDelete + ")"; + this.nullValOption[i] = "Obriši redove (" + numOfRowsToDelete + ")"; } } this.columnTableChangeDetected(); @@ -228,7 +228,7 @@ export class ColumnTableComponent implements AfterViewInit { }); }); } - + openUpdateExperimentDialog() { this.experimentService.updateExperiment(this.experiment).subscribe((response) => { Shared.openDialog("Izmena eksperimenta", "Uspešno ste izmenili podatke o eksperimentu."); diff --git a/frontend/src/app/_elements/folder/folder.component.ts b/frontend/src/app/_elements/folder/folder.component.ts index ffce3fb1..a99c6a9d 100644 --- a/frontend/src/app/_elements/folder/folder.component.ts +++ b/frontend/src/app/_elements/folder/folder.component.ts @@ -169,7 +169,7 @@ export class FolderComponent implements AfterViewInit { this.formDataset!.uploadDataset((dataset: Dataset) => { this.newFile = undefined; Shared.openDialog("Obaveštenje", "Uspešno ste dodali novi izvor podataka u kolekciju. Molimo sačekajte par trenutaka da se procesira."); - this.refreshFiles(dataset._id); + this.refreshFiles(null); }, () => { Shared.openDialog("Neuspeo pokušaj!", "Izvor podataka sa unetim nazivom već postoji u Vašoj kolekciji. Izmenite naziv ili iskoristite postojeći dataset."); diff --git a/frontend/src/app/_elements/form-model/form-model.component.html b/frontend/src/app/_elements/form-model/form-model.component.html index bf4aa0e3..96a5e1b6 100644 --- a/frontend/src/app/_elements/form-model/form-model.component.html +++ b/frontend/src/app/_elements/form-model/form-model.component.html @@ -109,7 +109,7 @@
- +
diff --git a/frontend/src/app/_elements/graph/graph.component.html b/frontend/src/app/_elements/graph/graph.component.html index a021431d..35753d40 100644 --- a/frontend/src/app/_elements/graph/graph.component.html +++ b/frontend/src/app/_elements/graph/graph.component.html @@ -1,8 +1,8 @@
- + -
\ No newline at end of file + \ No newline at end of file -- cgit v1.2.3 From 2fcd4358c32ea8d62343f137651ef80b15e3d433 Mon Sep 17 00:00:00 2001 From: Sonja Galovic Date: Thu, 5 May 2022 00:03:26 +0200 Subject: ColumnTypes pomeren iz Dataset klase u Experiment klasu. --- backend/api/api/Models/ColumnInfo.cs | 4 +- backend/api/api/Models/Experiment.cs | 2 +- backend/api/api/Services/FillAnEmptyDb.cs | 66 ++++++++++++---------- frontend/src/app/_data/Dataset.ts | 5 -- frontend/src/app/_data/Experiment.ts | 13 +++-- .../column-table/column-table.component.html | 10 ++-- .../column-table/column-table.component.ts | 12 ++-- 7 files changed, 56 insertions(+), 56 deletions(-) (limited to 'frontend/src/app/_data') diff --git a/backend/api/api/Models/ColumnInfo.cs b/backend/api/api/Models/ColumnInfo.cs index dcf5171c..46aeadb6 100644 --- a/backend/api/api/Models/ColumnInfo.cs +++ b/backend/api/api/Models/ColumnInfo.cs @@ -4,10 +4,9 @@ { public ColumnInfo() { } - public ColumnInfo(string columnName, string columnType, bool isNumber, int numNulls, float mean, float min, float max, float median, string[] uniqueValues, int[]uniqueValuesCount, float[] uniqueValuesPercent, float q1, float q3) + public ColumnInfo(string columnName, bool isNumber, int numNulls, float mean, float min, float max, float median, string[] uniqueValues, int[]uniqueValuesCount, float[] uniqueValuesPercent, float q1, float q3) { this.columnName = columnName; - this.columnType = columnType; this.isNumber = isNumber; this.numNulls = numNulls; this.mean = mean; @@ -22,7 +21,6 @@ } public string columnName { get; set; } - public string columnType { get; set; } public bool isNumber { get; set; } public int numNulls { get; set; } public float mean { get; set; } diff --git a/backend/api/api/Models/Experiment.cs b/backend/api/api/Models/Experiment.cs index 3af063be..d98e6cfc 100644 --- a/backend/api/api/Models/Experiment.cs +++ b/backend/api/api/Models/Experiment.cs @@ -21,6 +21,6 @@ namespace api.Models public DateTime lastUpdated { get; set; } public NullValues[] nullValuesReplacers { get; set; } public ColumnEncoding[] encodings { get; set; } - + public string[] columnTypes { get; set; } } } diff --git a/backend/api/api/Services/FillAnEmptyDb.cs b/backend/api/api/Services/FillAnEmptyDb.cs index d8c53bab..520f3461 100644 --- a/backend/api/api/Services/FillAnEmptyDb.cs +++ b/backend/api/api/Services/FillAnEmptyDb.cs @@ -66,18 +66,18 @@ namespace api.Services dataset.columnInfo = new[] { - new ColumnInfo( "PassengerId", "columnType", true, 0, 446, 1, 891, 446, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "Survived", "columnType", true, 0, 0.38383838534355164f, 0, 1, 0, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "Pclass", "columnType", true, 0, 2.3086419105529785f, 1, 3, 3, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "Name", "columnType", false, 0, 0, 0, 0, 0, new string[]{"Braund, Mr. Owen Harris", "Boulos, Mr. Hanna", "Frolicher-Stehli, Mr. Maxmillian", "Gilinski, Mr. Eliezer", "Murdlin, Mr. Joseph", "Rintamaki, Mr. Matti", "Stephenson, Mrs. Walter Bertram (Martha Eustis)", "Elsbury, Mr. William James", "Bourke, Miss. Mary", "Chapman, Mr. John Henry"}, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "Sex", "columnType", false, 0, 0, 0, 0, 0, new string[]{ "male", "female" }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "Age", "columnType", true, 177, 29.69911766052246f, 0.41999998688697815f, 80, 28, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "SibSp", "columnType", true, 0, 0.523007869720459f, 0, 8, 0, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "Parch", "columnType", true, 0, 0.3815937042236328f, 0, 6, 0, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "Ticket", "columnType", false, 0, 0, 0, 0, 0, new string[]{ "347082", "CA. 2343", "1601", "3101295", "CA 2144", "347088", "S.O.C. 14879", "382652", "LINE", "PC 17757" }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "Fare", "columnType", true, 0, 32.20420837402344f, 0, 512.3292236328125f, 14.45419979095459f, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "Cabin", "columnType", false, 687, 0, 0, 0, 0, new string[]{ "B96 B98", "G6", "C23 C25 C27", "C22 C26", "F33", "F2", "E101", "D", "C78", "C93" }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "Embarked", "columnType", false, 2, 0.3815937042236328f, 0, 6, 0, new string[]{ "S", "C", "Q" }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "PassengerId", true, 0, 446, 1, 891, 446, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "Survived", true, 0, 0.38383838534355164f, 0, 1, 0, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "Pclass", true, 0, 2.3086419105529785f, 1, 3, 3, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "Name", false, 0, 0, 0, 0, 0, new string[]{"Braund, Mr. Owen Harris", "Boulos, Mr. Hanna", "Frolicher-Stehli, Mr. Maxmillian", "Gilinski, Mr. Eliezer", "Murdlin, Mr. Joseph", "Rintamaki, Mr. Matti", "Stephenson, Mrs. Walter Bertram (Martha Eustis)", "Elsbury, Mr. William James", "Bourke, Miss. Mary", "Chapman, Mr. John Henry"}, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "Sex", false, 0, 0, 0, 0, 0, new string[]{ "male", "female" }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "Age", true, 177, 29.69911766052246f, 0.41999998688697815f, 80, 28, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "SibSp", true, 0, 0.523007869720459f, 0, 8, 0, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "Parch", true, 0, 0.3815937042236328f, 0, 6, 0, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "Ticket", false, 0, 0, 0, 0, 0, new string[]{ "347082", "CA. 2343", "1601", "3101295", "CA 2144", "347088", "S.O.C. 14879", "382652", "LINE", "PC 17757" }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "Fare", true, 0, 32.20420837402344f, 0, 512.3292236328125f, 14.45419979095459f, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "Cabin", false, 687, 0, 0, 0, 0, new string[]{ "B96 B98", "G6", "C23 C25 C27", "C22 C26", "F33", "F2", "E101", "D", "C78", "C93" }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "Embarked", false, 2, 0.3815937042236328f, 0, 6, 0, new string[]{ "S", "C", "Q" }, new int[] {}, new float[] {}, 0.01f,0.1f ), }; dataset.rowCount = 891; dataset.nullCols = 3; @@ -118,7 +118,7 @@ namespace api.Services experiment.ModelIds = new string[] { }.ToList(); experiment.datasetId = _datasetService.GetDatasetId(dataset.fileId); experiment.uploaderId = "000000000000000000000000"; - experiment.inputColumns = new string[] { "Embarked" }; + experiment.inputColumns = new string[] { "Embarked", "Survived" }; experiment.outputColumn = "Survived"; experiment.dateCreated = DateTime.Now; experiment.lastUpdated = DateTime.Now; @@ -129,6 +129,7 @@ namespace api.Services new ColumnEncoding( "Survived", "label" ), new ColumnEncoding("Embarked", "label" ) }; + experiment.columnTypes = new string[] {"categorical"}; _experimentService.Create(experiment); @@ -179,17 +180,17 @@ namespace api.Services dataset.delimiter = ""; dataset.columnInfo = new[] { - new ColumnInfo( "Unnamed: 0", "columnType", true, 0, 26969.5f, 0, 53939, 26969.5f, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "carat", "columnType", true, 0, 0.7979397773742676f, 0.20000000298023224f, 5.010000228881836f, 0.699999988079071f, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "cut", "columnType", false, 0, 0, 0, 0, 0, new string[]{ "Ideal", "Premium", "Very Good", "Good", "Fair" }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "color", "columnType", false, 0, 0, 0, 0, 0, new string[]{"G", "E", "F", "H", "D", "I", "I", "J"}, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "clarity", "columnType", false, 0, 0, 0, 0, 0, new string[]{ "SI1", "VS2","SI2", "VS1", "VVS2", "VVS1", "IF", "I1" }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "depth", "columnType", true, 0, 61.74940490722656f, 43, 79, 61.79999923706055f, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "table", "columnType", true, 0, 57.457183837890625f, 43, 95, 57, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "price", "columnType", true, 0, 3932.7998046875f, 326, 18823, 2401, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "x", "columnType", true, 0, 5.731157302856445f, 0, 10.739999771118164f, 5.699999809265137f, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "y", "columnType", true, 0, 5.73452615737915f, 0, 58.900001525878906f, 5.710000038146973f, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "z", "columnType", true, 0, 3.538733720779419f, 0, 31.799999237060547f, 3.5299999713897705f, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ) + new ColumnInfo( "Unnamed: 0", true, 0, 26969.5f, 0, 53939, 26969.5f, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "carat", true, 0, 0.7979397773742676f, 0.20000000298023224f, 5.010000228881836f, 0.699999988079071f, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "cut", false, 0, 0, 0, 0, 0, new string[]{ "Ideal", "Premium", "Very Good", "Good", "Fair" }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "color", false, 0, 0, 0, 0, 0, new string[]{"G", "E", "F", "H", "D", "I", "I", "J"}, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "clarity", false, 0, 0, 0, 0, 0, new string[]{ "SI1", "VS2","SI2", "VS1", "VVS2", "VVS1", "IF", "I1" }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "depth", true, 0, 61.74940490722656f, 43, 79, 61.79999923706055f, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "table", true, 0, 57.457183837890625f, 43, 95, 57, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "price", true, 0, 3932.7998046875f, 326, 18823, 2401, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "x", true, 0, 5.731157302856445f, 0, 10.739999771118164f, 5.699999809265137f, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "y", true, 0, 5.73452615737915f, 0, 58.900001525878906f, 5.710000038146973f, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "z", true, 0, 3.538733720779419f, 0, 31.799999237060547f, 3.5299999713897705f, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ) }; dataset.rowCount = 53940; dataset.nullCols = 0; @@ -231,7 +232,7 @@ namespace api.Services experiment.ModelIds = new string[] { }.ToList(); experiment.datasetId = _datasetService.GetDatasetId(dataset.fileId); experiment.uploaderId = "000000000000000000000000"; - experiment.inputColumns = new string[] { "Unnamed: 0", "carat", "cut", "color", "clarity", "depth", "table", "x", "y", "z" }; + experiment.inputColumns = new string[] { "Unnamed: 0", "carat", "cut", "color", "clarity", "depth", "table", "x", "y", "z", "price" }; experiment.outputColumn = "price"; experiment.dateCreated = DateTime.Now; experiment.lastUpdated = DateTime.Now; @@ -251,6 +252,7 @@ namespace api.Services new ColumnEncoding( "y", "label" ), new ColumnEncoding( "z", "label" ) }; + experiment.columnTypes = new string[] { "categorical", "numerical", "numerical", "categorical", "categorical", "categorical", "numerical", "numerical", "numerical", "numerical", "numerical" }; _experimentService.Create(experiment); /* @@ -295,11 +297,11 @@ namespace api.Services dataset.delimiter = ""; dataset.columnInfo = new[] { - new ColumnInfo( "sepal_length", "columnType", true, 0, 5.8433332443237305f, 4.300000190734863f, 7.900000095367432f, 5.800000190734863f, new string[]{ }, new int[] {}, new float[] {}, 0.01f, 0.1f ), - new ColumnInfo( "sepal_width", "columnType", true, 0, 3.053999900817871f, 2, 4.400000095367432f, 3, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "petal_length", "columnType", true, 0, 3.758666753768921f, 1, 6.900000095367432f, 4.349999904632568f, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "petal_width", "columnType", true, 0, 1.1986666917800903f, 0.10000000149011612f, 2.5f, 1.2999999523162842f, new string[]{}, new int[] {}, new float[] {}, 0.01f,0.1f ), - new ColumnInfo( "class", "columnType", false, 0, 0, 0, 0, 0, new string[]{ "Iris-setosa", "Iris-versicolor", "Iris-virginica" }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "sepal_length", true, 0, 5.8433332443237305f, 4.300000190734863f, 7.900000095367432f, 5.800000190734863f, new string[]{ }, new int[] {}, new float[] {}, 0.01f, 0.1f ), + new ColumnInfo( "sepal_width", true, 0, 3.053999900817871f, 2, 4.400000095367432f, 3, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "petal_length", true, 0, 3.758666753768921f, 1, 6.900000095367432f, 4.349999904632568f, new string[]{ }, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "petal_width", true, 0, 1.1986666917800903f, 0.10000000149011612f, 2.5f, 1.2999999523162842f, new string[]{}, new int[] {}, new float[] {}, 0.01f,0.1f ), + new ColumnInfo( "class", false, 0, 0, 0, 0, 0, new string[]{ "Iris-setosa", "Iris-versicolor", "Iris-virginica" }, new int[] {}, new float[] {}, 0.01f,0.1f ), }; dataset.nullCols = 150; dataset.nullRows = 0; @@ -339,7 +341,7 @@ namespace api.Services experiment.ModelIds = new string[] { }.ToList(); experiment.datasetId = _datasetService.GetDatasetId(dataset.fileId); experiment.uploaderId = "000000000000000000000000"; - experiment.inputColumns = new string[] { "sepal_length", "sepal_width", "petal_length", "petal_width" }; + experiment.inputColumns = new string[] { "sepal_length", "sepal_width", "petal_length", "petal_width", "class" }; experiment.outputColumn = "class"; experiment.dateCreated = DateTime.Now; experiment.lastUpdated = DateTime.Now; @@ -353,6 +355,8 @@ namespace api.Services new ColumnEncoding( "petal_width", "label" ), new ColumnEncoding( "class", "label" ) }; + experiment.columnTypes = new string[] { "categorical", "numerical", "numerical", "numerical", "categorical" }; + _experimentService.Create(experiment); /* diff --git a/frontend/src/app/_data/Dataset.ts b/frontend/src/app/_data/Dataset.ts index ca1a2a5e..4ff0a471 100644 --- a/frontend/src/app/_data/Dataset.ts +++ b/frontend/src/app/_data/Dataset.ts @@ -27,7 +27,6 @@ export default class Dataset extends FolderFile { export class ColumnInfo { constructor( public columnName: string = '', - public columnType: ColumnType, public isNumber: boolean = false, public numNulls: number = 0, public uniqueValues?: string[], @@ -48,7 +47,3 @@ export class ColumnInfo { } -export enum ColumnType { - categorical = "Kategorijski", - numerical = "Numerički" -} \ No newline at end of file diff --git a/frontend/src/app/_data/Experiment.ts b/frontend/src/app/_data/Experiment.ts index 05336495..828431cc 100644 --- a/frontend/src/app/_data/Experiment.ts +++ b/frontend/src/app/_data/Experiment.ts @@ -15,9 +15,7 @@ export default class Experiment { public dateCreated: Date = new Date(), public lastUpdated: Date = new Date(), public modelIds: string[] = [], - - - + public columnTypes: ColumnType[] = [], public encodings: ColumnEncoding[] = []//[{columnName: "", columnEncoding: Encoding.Label}] ) { } @@ -47,11 +45,11 @@ export class NullValReplacer { export enum Encoding { Label = 'label', OneHot = 'onehot', - Ordinal = 'ordinal', + /*Ordinal = 'ordinal', Hashing = 'hashing', Binary = 'binary', BaseN = 'baseN' - /* + BackwardDifference = 'backward difference', CatBoost = 'cat boost', Count = 'count', @@ -73,4 +71,9 @@ export class ColumnEncoding { public columnName: string, public encoding: Encoding ) { } +} + +export enum ColumnType { + categorical = "categorical", + numerical = "numerical" } \ No newline at end of file diff --git a/frontend/src/app/_elements/column-table/column-table.component.html b/frontend/src/app/_elements/column-table/column-table.component.html index 09ddffc6..efc093d2 100644 --- a/frontend/src/app/_elements/column-table/column-table.component.html +++ b/frontend/src/app/_elements/column-table/column-table.component.html @@ -103,7 +103,7 @@

Kategorijski

- + Kategorijski Numerički @@ -113,14 +113,14 @@ Grafik - - + + Statistika - + Mean: {{colInfo.mean}}
Median: {{colInfo.median}}
Min: {{colInfo.min}}
@@ -128,7 +128,7 @@ Q1: {{colInfo.q1}}
Q3: {{colInfo.q3}}
-
+
({{(colInfo.uniqueValuesPercent[i] * 100).toFixed(2)}}%) {{uniqueValue}}
diff --git a/frontend/src/app/_elements/column-table/column-table.component.ts b/frontend/src/app/_elements/column-table/column-table.component.ts index b99a3be0..c200e674 100644 --- a/frontend/src/app/_elements/column-table/column-table.component.ts +++ b/frontend/src/app/_elements/column-table/column-table.component.ts @@ -1,6 +1,6 @@ import { AfterViewInit, Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChildren } from '@angular/core'; -import Dataset, { ColumnType } from 'src/app/_data/Dataset'; -import Experiment, { ColumnEncoding, Encoding, NullValReplacer, NullValueOptions } from 'src/app/_data/Experiment'; +import Dataset from 'src/app/_data/Dataset'; +import Experiment, { ColumnEncoding, Encoding, ColumnType, NullValueOptions } from 'src/app/_data/Experiment'; import { DatasetsService } from 'src/app/_services/datasets.service'; import { EncodingDialogComponent } from 'src/app/_modals/encoding-dialog/encoding-dialog.component'; import { MatDialog } from '@angular/material/dialog'; @@ -75,7 +75,7 @@ export class ColumnTableComponent implements AfterViewInit { setColumnTypeInitial() { if (this.dataset != undefined) { for (let i = 0; i < this.dataset.columnInfo.length; i++) { - this.dataset.columnInfo[i].columnType = (this.dataset.columnInfo[i].isNumber) ? ColumnType.numerical : ColumnType.categorical; + this.experiment.columnTypes[i] = (this.dataset.columnInfo[i].isNumber) ? ColumnType.numerical : ColumnType.categorical; } } } @@ -140,12 +140,12 @@ export class ColumnTableComponent implements AfterViewInit { changeOutputColumn(columnName: string) { if (this.experiment != undefined && this.dataset != undefined) { - let column = this.dataset.columnInfo.filter(x => x.columnName == this.experiment!.outputColumn)[0]; - if (column.columnType == ColumnType.numerical) { + let i = this.dataset.columnInfo.findIndex(x => x.columnName == this.experiment!.outputColumn); + if (this.experiment.columnTypes[i] == ColumnType.numerical) { this.experiment.type = ProblemType.Regression; } else { - if (column.uniqueValues!.length == 2) + if (this.dataset.columnInfo[i].uniqueValues!.length == 2) this.experiment.type = ProblemType.BinaryClassification; else this.experiment.type = ProblemType.MultiClassification; -- cgit v1.2.3