aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/api/api/Controllers/ModelController.cs2
-rw-r--r--backend/api/api/Models/Model.cs2
-rw-r--r--backend/api/api/Services/IModelService.cs1
-rw-r--r--backend/api/api/Services/ModelService.cs12
-rw-r--r--frontend/src/app/_data/Model.ts48
5 files changed, 60 insertions, 5 deletions
diff --git a/backend/api/api/Controllers/ModelController.cs b/backend/api/api/Controllers/ModelController.cs
index 1d03d924..a4fa99c4 100644
--- a/backend/api/api/Controllers/ModelController.cs
+++ b/backend/api/api/Controllers/ModelController.cs
@@ -86,6 +86,8 @@ namespace api.Controllers
[Authorize(Roles = "User")]
public ActionResult<Model> Post([FromBody] Model model)
{
+ if (_modelService.CheckHyperparameters(model.inputNeurons, model.hiddenLayerNeurons, model.hiddenLayers, model.outputNeurons) == false)
+ return BadRequest("Bad parameters!");
var existingModel = _modelService.GetOneModel(model.username, model.name);
if (existingModel != null)
diff --git a/backend/api/api/Models/Model.cs b/backend/api/api/Models/Model.cs
index dfc4336a..52516cd9 100644
--- a/backend/api/api/Models/Model.cs
+++ b/backend/api/api/Models/Model.cs
@@ -36,6 +36,8 @@ namespace api.Models
public int hiddenLayerNeurons { get; set; }
public int hiddenLayers { get; set; }
public int batchSize { get; set; }
+ // na izlazu je moguce da bude vise neurona (klasifikacioni problem sa vise od 2 klase)
+ public int outputNeurons { get; set; }
public string inputLayerActivationFunction { get; set; }
public string hiddenLayerActivationFunction { get; set; }
public string outputLayerActivationFunction { get; set; }
diff --git a/backend/api/api/Services/IModelService.cs b/backend/api/api/Services/IModelService.cs
index c1931ffa..887be4ae 100644
--- a/backend/api/api/Services/IModelService.cs
+++ b/backend/api/api/Services/IModelService.cs
@@ -11,6 +11,7 @@ namespace api.Services
Model Create(Model model);
void Update(string username, string name, Model model);
void Delete(string username, string name);
+ bool CheckHyperparameters(int inputNeurons, int hiddenLayerNeurons, int hiddenLayers, int outputNeurons);
}
}
diff --git a/backend/api/api/Services/ModelService.cs b/backend/api/api/Services/ModelService.cs
index 2ba3c54d..3d5c3b3e 100644
--- a/backend/api/api/Services/ModelService.cs
+++ b/backend/api/api/Services/ModelService.cs
@@ -7,7 +7,6 @@ namespace api.Services
{
public class ModelService : IModelService
{
-
private readonly IMongoCollection<Model> _model;
public ModelService(IUserStoreDatabaseSettings settings, IMongoClient mongoClient)
@@ -46,6 +45,17 @@ namespace api.Services
{
_model.ReplaceOne(model => model.username == username && model.name == name, model);
}
+ //
+ public bool CheckHyperparameters(int inputNeurons, int hiddenLayerNeurons, int hiddenLayers, int outputNeurons)
+ {
+ if (hiddenLayers <= 0 || hiddenLayerNeurons <= 0)
+ return false;
+ if (hiddenLayers > inputNeurons)
+ return false;
+ if (hiddenLayerNeurons <= 2 * inputNeurons || hiddenLayerNeurons <= (2 / 3) * inputNeurons + outputNeurons || (hiddenLayerNeurons <= Math.Max(inputNeurons, outputNeurons) && hiddenLayerNeurons >= Math.Min(inputNeurons, outputNeurons)))
+ return true;
+ return false;
+ }
}
}
diff --git a/frontend/src/app/_data/Model.ts b/frontend/src/app/_data/Model.ts
index a038325e..8d6e0ad9 100644
--- a/frontend/src/app/_data/Model.ts
+++ b/frontend/src/app/_data/Model.ts
@@ -39,21 +39,61 @@ export enum ANNType {
// removeOutliers
export enum Encoding {
Label = 'label',
- OneHot = 'one hot'
+ 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',
- Linear = 'linear'
+ Softmax = 'softmax'
}
export enum LossFunction {
+ // binary classification loss functions
BinaryCrossEntropy = 'binary_crossentropy',
- MeanSquaredError = 'mean_squared_error'
+ 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'
+ Adam = 'Adam',
+ Adadelta = 'Adadelta',
+ Adagrad = 'Adagrad',
+ Ftrl = 'Ftrl',
+ Nadam = 'Nadam',
+ SGD = 'SGD',
+ SGDMomentum = 'SGDMomentum',
+ RMSprop = 'RMSprop'
} \ No newline at end of file