From 2fc6a3d7c6e751e0bbf518eab3e2098cb0b80687 Mon Sep 17 00:00:00 2001
From: dmt <>
Date: Sun, 20 Oct 2019 23:07:46 +0200
Subject: [PATCH] Initialize recontr. request with either conceptual or
 procedural models.

---
 cml/controller/api.py | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/cml/controller/api.py b/cml/controller/api.py
index 0e940d3..6fcd5a3 100644
--- a/cml/controller/api.py
+++ b/cml/controller/api.py
@@ -28,7 +28,9 @@ from cml.shared.request import (
 from cml.ports.ml_adapter import (
     KernelDensityEstimator,
     find_relative_extrema,
-    Autoencoder
+    Autoencoder,
+    ReconstructionConceptualMLModel,
+    ReconstructionProceduralMLModel
 )
 
 
@@ -119,9 +121,19 @@ def feature_selection(filter_ml_model, embedded_ml_model):
     return feature_selection_usecase.execute(feature_selection_req)
 
 
-def reconstruction(*args, **kwargs):
+def reconstruction(reconstruction_type, *args, **kwargs):
+    # TODO (dmt): Create ReconstructionModels depending on the sklearn
+    # models.
+    if reconstruction_type == "conceptual":
+        ml_models = [ReconstructionConceptualMLModel(model) for model in args]
+    elif reconstruction_type == "procedural":
+        ml_models = [ReconstructionProceduralMLModel(model) for model in args]
+    else:
+        raise ValueError("reconstruction_type is wrong.")
     settings = specific_settings_factory("reconstruction")
-    reconstruction_req = ReconstructionRequest(settings)
+    reconstruction_req = ReconstructionRequest(settings,
+                                               ml_models,
+                                               reconstruction_type)
     reconstruction_usecase = ReconstructionUsecase()
     return reconstruction_usecase.execute(reconstruction_req)
 
-- 
GitLab