aboutsummaryrefslogtreecommitdiff
path: root/backend/api/api/Services/ModelService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'backend/api/api/Services/ModelService.cs')
-rw-r--r--backend/api/api/Services/ModelService.cs22
1 files changed, 21 insertions, 1 deletions
diff --git a/backend/api/api/Services/ModelService.cs b/backend/api/api/Services/ModelService.cs
index 2ba3c54d..f42219f5 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)
@@ -31,6 +30,15 @@ namespace api.Services
{
return _model.Find(model => model.username == username).ToList();
}
+ public List<Model> GetLatestModels(string username)
+ {
+ List<Model> list = _model.Find(model => model.username == username).ToList();
+
+ list = list.OrderByDescending(model => model.lastUpdated).ToList();
+
+ return list;
+ }
+
/*
public List<Model> GetPublicModels()
{
@@ -46,6 +54,18 @@ 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;
+ }
+
}
}