aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSonja Galovic <galovicsonja@gmail.com>2022-05-05 00:03:26 +0200
committerSonja Galovic <galovicsonja@gmail.com>2022-05-05 00:03:26 +0200
commit2fcd4358c32ea8d62343f137651ef80b15e3d433 (patch)
treed8c2a51372b665ff85077318f0531f5c2ed5dd5a
parent75f0fca5f9e7e74979f63d73741512ea2e58e9e6 (diff)
ColumnTypes pomeren iz Dataset klase u Experiment klasu.
-rw-r--r--backend/api/api/Models/ColumnInfo.cs4
-rw-r--r--backend/api/api/Models/Experiment.cs2
-rw-r--r--backend/api/api/Services/FillAnEmptyDb.cs66
-rw-r--r--frontend/src/app/_data/Dataset.ts5
-rw-r--r--frontend/src/app/_data/Experiment.ts13
-rw-r--r--frontend/src/app/_elements/column-table/column-table.component.html10
-rw-r--r--frontend/src/app/_elements/column-table/column-table.component.ts12
7 files changed, 56 insertions, 56 deletions
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 @@
<td *ngFor="let colInfo of dataset.columnInfo; let i = index" class="pad-fix" [ngClass]="{'text-disabled' : !columnsChecked[i]}">
<p class="verticalAlign text-left" style="font-size:13px;" *ngIf="!colInfo.isNumber">Kategorijski</p>
<mat-form-field *ngIf="colInfo.isNumber">
- <mat-select matNativeControl [(value)]="colInfo.columnType" [disabled]="!columnsChecked[i]" (selectionChange)="columnTypeChanged(colInfo.columnName);">
+ <mat-select matNativeControl [(value)]="this.experiment.columnTypes[i]" [disabled]="!columnsChecked[i]" (selectionChange)="columnTypeChanged(colInfo.columnName);">
<mat-option [value]="ColumnType.categorical">Kategorijski</mat-option>
<mat-option [value]="ColumnType.numerical">Numerički</mat-option>
</mat-select>
@@ -113,14 +113,14 @@
<tr class="graphics-row">
<th class="no-pad">Grafik</th>
<td class="no-pad" *ngFor="let colInfo of dataset.columnInfo; let i = index" [ngClass]="{'graphic-class' : !columnsChecked[i]}">
- <app-box-plot *ngIf="colInfo.columnType == ColumnType.numerical" [width]="150" [height]="150"></app-box-plot>
- <app-pie-chart *ngIf="colInfo.columnType == ColumnType.categorical" [width]="150" [height]="150"></app-pie-chart>
+ <app-box-plot *ngIf="this.experiment.columnTypes[i] == ColumnType.numerical" [width]="150" [height]="150"></app-box-plot>
+ <app-pie-chart *ngIf="this.experiment.columnTypes[i] == ColumnType.categorical" [width]="150" [height]="150"></app-pie-chart>
</td>
</tr>
<tr>
<th class="border-bottom">Statistika</th>
<td *ngFor="let colInfo of dataset.columnInfo; let i = index" [ngClass]="{'text-disabled' : !columnsChecked[i]}" class="text-left">
- <span *ngIf="colInfo.columnType == ColumnType.numerical">
+ <span *ngIf="this.experiment.columnTypes[i] == ColumnType.numerical">
Mean: {{colInfo.mean}}<br>
Median: {{colInfo.median}}<br>
Min: {{colInfo.min}}<br>
@@ -128,7 +128,7 @@
Q1: {{colInfo.q1}}<br>
Q3: {{colInfo.q3}}<br>
</span>
- <div class="text-overflow" *ngIf="colInfo.columnType == ColumnType.categorical && colInfo.uniqueValuesPercent">
+ <div class="text-overflow" *ngIf="this.experiment.columnTypes[i] == ColumnType.categorical && colInfo.uniqueValuesPercent">
<span *ngFor="let uniqueValue of colInfo.uniqueValues | slice:0:6; let i = index">
({{(colInfo.uniqueValuesPercent[i] * 100).toFixed(2)}}%) {{uniqueValue}}<br>
</span>
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;