From 888640544de798c6df12f2b2e15ebe33d645340f Mon Sep 17 00:00:00 2001 From: dmt <> Date: Thu, 10 Oct 2019 17:50:06 +0200 Subject: [PATCH] Provide construction api endpoint. --- cml/__init__.py | 1 + cml/controller/api.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cml/__init__.py b/cml/__init__.py index 3b336da..2375600 100644 --- a/cml/__init__.py +++ b/cml/__init__.py @@ -1,4 +1,5 @@ from cml.controller import load_settings from cml.controller import get_data_source +from cml.controller import construction # TODO (dmt): Load default settings automatically. diff --git a/cml/controller/api.py b/cml/controller/api.py index 12b05b4..dba0c9c 100644 --- a/cml/controller/api.py +++ b/cml/controller/api.py @@ -9,6 +9,7 @@ from cml.usecases.query import ( CreateConstructorUsecase ) from cml.ports.source_adapters import PandasAdapter +from cml.ports.scikit_adapter import ConstructionClusteringMLModel from cml.shared.settings import Settings from cml.shared.settings import specific_settings_factory, read_settings from cml.shared.request import ( @@ -75,8 +76,13 @@ def get_data_source(): return preprocessing_usecase.execute(preprocessing_req) -def construction(): - pass +def construction(*args): + ml_models = [ConstructionClusteringMLModel(raw_model) for raw_model in args] + construction_settings = specific_settings_factory("construction") + create_constructor_req = CreateConstructorRequest(construction_settings, + ml_models) + create_construction_usecase = CreateConstructorUsecase() + return create_construction_usecase.execute(create_constructor_req) def reconstruction(): -- GitLab