aboutsummaryrefslogtreecommitdiff
path: root/backend/api
diff options
context:
space:
mode:
Diffstat (limited to 'backend/api')
-rw-r--r--backend/api/api/Controllers/ModelController.cs8
-rw-r--r--backend/api/api/Models/Model.cs1
-rw-r--r--backend/api/api/Services/FillAnEmptyDb.cs3
-rw-r--r--backend/api/api/appsettings.json18
4 files changed, 17 insertions, 13 deletions
diff --git a/backend/api/api/Controllers/ModelController.cs b/backend/api/api/Controllers/ModelController.cs
index 3145a080..c9e36ca4 100644
--- a/backend/api/api/Controllers/ModelController.cs
+++ b/backend/api/api/Controllers/ModelController.cs
@@ -195,8 +195,8 @@ namespace api.Controllers
var existingModel = _modelService.GetOneModel(model.uploaderId, model.name);
- if (existingModel != null && !overwrite)
- return NotFound($"Model with name = {model.name} exisits");
+ if (existingModel != null && !overwrite && model.validationSize < 1 && model.validationSize > 0)
+ return NotFound($"Model with name = {model.name} exisits or validation size is not between 0-1");
else
{
//_modelService.Create(model);
@@ -225,8 +225,8 @@ namespace api.Controllers
var existingModel = _modelService.GetOneModel(userId, name);
- if (existingModel == null)
- return NotFound($"Model with name = {name} or user with ID = {userId} not found");
+ if (existingModel == null && model.validationSize < 1 && model.validationSize > 0)
+ return NotFound($"Model with name = {name} or validation size is not between 0-1");
_modelService.Update(userId, name, model);
return NoContent();
diff --git a/backend/api/api/Models/Model.cs b/backend/api/api/Models/Model.cs
index a2740ca9..f09940d0 100644
--- a/backend/api/api/Models/Model.cs
+++ b/backend/api/api/Models/Model.cs
@@ -43,6 +43,7 @@ namespace api.Models
public float randomTestSetDistribution { get; set; }
public bool isPublic { get; set; }
public bool accessibleByLink { get; set; }
+ public float validationSize { get; set; }//0-1 ne ukljucuje 0.1-0.9 ogranici
}
public class Layer
diff --git a/backend/api/api/Services/FillAnEmptyDb.cs b/backend/api/api/Services/FillAnEmptyDb.cs
index 69f534d8..32ce5c2e 100644
--- a/backend/api/api/Services/FillAnEmptyDb.cs
+++ b/backend/api/api/Services/FillAnEmptyDb.cs
@@ -106,6 +106,7 @@ namespace api.Services
model.epochs = 5;
model.isPublic = true;
model.accessibleByLink = true;
+ model.validationSize = 0.1f;//proveri
_modelService.Create(model);
@@ -220,6 +221,7 @@ namespace api.Services
model.epochs = 5;
model.isPublic = true;
model.accessibleByLink = true;
+ model.validationSize = 0.1f;//proveri
_modelService.Create(model);
@@ -333,6 +335,7 @@ namespace api.Services
model.epochs = 1;
model.isPublic = true;
model.accessibleByLink = true;
+ model.validationSize = 0.1f;//proveri
_modelService.Create(model);
diff --git a/backend/api/api/appsettings.json b/backend/api/api/appsettings.json
index 56d1861c..ec8f7dd8 100644
--- a/backend/api/api/appsettings.json
+++ b/backend/api/api/appsettings.json
@@ -24,14 +24,14 @@
"PredictorCollectionName": "Predictor",
"FilesCollectionName": "Files",
"ExperimentCollectionName": "Experiment"
- /*
- "ConnectionString": "mongodb+srv://si_user:si_user@sidatabase.twtfm.mongodb.net/myFirstDatabase?retryWrites=true&w=majority",
- "DatabaseName": "si_db",
- "CollectionName": "users",
- "DatasetCollectionName": "Dataset",
- "ModelCollectionName": "Model",
- "PredictorCollectionName": "Predictor",
- "FilesCollectionName": "Files",
- "ExperimentCollectionName": "Experiment" */
+
+ /*"ConnectionString": "mongodb+srv://si_user:si_user@sidatabase.twtfm.mongodb.net/myFirstDatabase?retryWrites=true&w=majority",
+ "DatabaseName": "si_db",
+ "CollectionName": "users",
+ "DatasetCollectionName": "Dataset",
+ "ModelCollectionName": "Model",
+ "PredictorCollectionName": "Predictor",
+ "FilesCollectionName": "Files",
+ "ExperimentCollectionName": "Experiment" */
}
} \ No newline at end of file