Skip to content

Commit aeda4cd

Browse files
committed
add ensembling
1 parent 28f0ec6 commit aeda4cd

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

dataikuapi/dss/ml.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,26 @@ def start_train(self, session_name=None, session_description=None):
518518
return self.client._perform_json(
519519
"POST", "/projects/%s/models/lab/%s/%s/train" % (self.project_key, self.analysis_id, self.mltask_id), body=session_info)
520520

521+
def start_ensembling(self, model_ids=[], method=None):
522+
"""
523+
Creates asynchronously a new ensemble models of a set of models.
524+
525+
:param list model_ids: A list of model identifiers
526+
:param str method: the ensembling method (AVERAGE, PROBA_AVERAGE, MEDIAN, VOTE, LINEAR_MODEL, LOGISTIC_MODEL)
527+
528+
This returns immediately, before train is complete. To wait for train to complete, use ``wait_train_complete()``
529+
530+
:return: the model identifier of the ensemble
531+
:rtype: string
532+
"""
533+
ensembling_request = {
534+
"method" : method,
535+
"modelsIds" : model_ids
536+
}
537+
538+
return self.client._perform_json(
539+
"POST", "/projects/%s/models/lab/%s/%s/ensemble" % (self.project_key, self.analysis_id, self.mltask_id), body=ensembling_request)['id']
540+
521541
def wait_train_complete(self):
522542
"""
523543
Waits for train to be complete.

0 commit comments

Comments
 (0)