aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_data/Model.ts
blob: dd3cb7604ec4a115a6e22523feb56cfd5f70916b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
export default class Model {
    _id: string = '';
    constructor(
        public name: string = 'Novi model',
        public description: string = '',
        public dateCreated: Date = new Date(),
        public lastUpdated: Date = new Date(),
        public datasetId: string = '',

        // Test set settings
        public inputColumns: string[] = [],
        public columnToPredict: string = '',
        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

        // Neural net training settings
        public type: ProblemType = ProblemType.Regression,
        public encoding: Encoding = Encoding.Label,
        public optimizer: Optimizer = Optimizer.Adam,
        public lossFunction: LossFunction = LossFunction.MeanSquaredError,
        public inputNeurons: number = 1,
        public hiddenLayerNeurons: number = 1,
        public hiddenLayers: number = 1,
        public batchSize: number = 5,
        public hiddenLayerActivationFunctions: string[] = ['sigmoid'],
        //public inputLayerActivationFunction: ActivationFunction = ActivationFunction.Sigmoid,
        public outputLayerActivationFunction: ActivationFunction = ActivationFunction.Sigmoid,
        public username: string = '',
        public nullValues: NullValueOptions = NullValueOptions.DeleteRows,
        public nullValuesReplacers: NullValReplacer[] = [],
        public metrics: Metric[] = [], // TODO add to add-model form
        public epochs: number = 5 // TODO add to add-model form
    ) { }
}

export enum ProblemType {
    Regression = 'regresioni',
    BinaryClassification = 'binarni-klasifikacioni',
    MultiClassification = 'multi-klasifikacioni'
}

// replaceMissing srednja vrednost mean, median, najcesca vrednost (mode)
// removeOutliers
export enum Encoding {
    Label = 'label',
    OneHot = 'one hot',
    BackwardDifference = 'backward difference',
    BaseN = 'baseN',
    Binary = 'binary',
    CatBoost = 'cat boost',
    Count = 'count',
    GLMM = 'glmm',
    Hashing = 'hashing',
    Helmert = 'helmert',
    JamesStein = 'james stein',
    LeaveOneOut = 'leave one out',
    MEstimate = 'MEstimate',
    Ordinal = 'ordinal',
    Sum = 'sum',
    Polynomial = 'polynomial',
    Target = 'target',
    WOE = 'woe',
    Quantile = 'quantile'
}

export enum ActivationFunction {
    // linear
    Binary_Step = 'binaryStep',
    Linear = 'linear',
    // non-linear
    Relu = 'relu',
    Leaky_Relu = 'leakyRelu',
    Parameterised_Relu = 'parameterisedRelu',
    Exponential_Linear_Unit = 'exponentialLinearUnit',
    Swish = 'swish',
    Sigmoid = 'sigmoid',
    Tanh = 'tanh',
    Softmax = 'softmax'
}

export enum LossFunction {
    // binary classification loss functions
    BinaryCrossEntropy = 'binary_crossentropy',
    HingeLoss = 'hinge_loss',
    // multi-class classiication loss functions
    CategoricalCrossEntropy = 'categorical_crossentropy',
    KLDivergence = 'kullback_leibler_divergence',
    // regression loss functions
    MeanSquaredError = 'mean_squared_error',
    MeanAbsoluteError = 'mean_absolute_error',
    HuberLoss = 'Huber',
}

export enum Optimizer {
    Adam = 'Adam',
    Adadelta = 'Adadelta',
    Adagrad = 'Adagrad',
    Ftrl = 'Ftrl',
    Nadam = 'Nadam',
    SGD = 'SGD',
    SGDMomentum = 'SGDMomentum',
    RMSprop = 'RMSprop'
}

export enum NullValueOptions {
    DeleteRows = 'delete_rows',
    DeleteColumns = 'delete_columns',
    Replace = 'replace'
}

export enum ReplaceWith {
    None = 'Popuni...',
    Mean = 'Srednja vrednost',
    Median = 'Medijana'
}

export class NullValReplacer {
    "column": string;
    "option": NullValueOptions;
    "value" : string;
}

export enum Metric {
    MSE = 'mse',
    MAE = 'mae',
    RMSE = 'rmse'
    //...
}