def reify_batchcentroid(self, resource_id): """ Extracts the REST API arguments from the batch centroid JSON structure: cluster, dataset and args """ child = self.get_resource(resource_id) # batch resources have 2 different origins as arguments [(_, parent1), (_, parent2)] = u.get_origin_info(child) parent1 = self.get_resource(parent1) parent2 = self.get_resource(parent2) opts = {"create": {}, "update": {}} # common create options for batch resources u.common_batch_options(child, parent1, parent2, opts) if child.get('header', True): opts['create'].update( u.default_setting(child, 'distance_name', [None, ''])) # name, exclude automatic naming alternatives u.non_automatic_name(child, opts) calls = u.build_calls(resource_id, [parent1['resource'], parent2['resource']], opts) self.add(resource_id, calls)
def reify_batchanomalyscore(self, resource_id): """ Extracts the REST API arguments from the batch anomaly score JSON structure: anomaly detector, dataset and args """ child = self.get_resource(resource_id) # batch resources have 2 different origins as arguments [(_, parent1), (_, parent2)] = u.get_origin_info(child) parent1 = self.get_resource(parent1) parent2 = self.get_resource(parent2) opts = {"create": {}, "update": {}} # common create options for batch resources u.common_batch_options(child, parent1, parent2, opts) # name, exclude automatic naming alternatives u.non_automatic_name( child, opts) calls = u.build_calls( resource_id, [parent1['resource'], parent2['resource']], opts) self.add(resource_id, calls)
def reify_batchcentroid(self, resource_id): """ Extracts the REST API arguments from the batch centroid JSON structure: cluster, dataset and args """ child = self.get_resource(resource_id) # batch resources have 2 different origins as arguments [(_, parent1), (_, parent2)] = u.get_origin_info(child) parent1 = self.get_resource(parent1) parent2 = self.get_resource(parent2) opts = {"create": {}, "update": {}} # common create options for batch resources u.common_batch_options(child, parent1, parent2, opts) if child.get('header', True): opts['create'].update( u.default_setting(child, 'distance_name', [None, ''])) # name, exclude automatic naming alternatives u.non_automatic_name( child, opts) calls = u.build_calls( resource_id, [parent1['resource'], parent2['resource']], opts) self.add(resource_id, calls)
def reify_batchprediction(self, resource_id): """ Extracts the REST API arguments from the batch prediction JSON structure: model/ensemble, dataset and args """ child = self.get_resource(resource_id) # evalutations have 2 different origins as arguments [(_, parent1), (_, parent2)] = u.get_origin_info(child) parent1 = self.get_resource(parent1) parent2 = self.get_resource(parent2) opts = {"create": {}, "update": {}} # common create options for batch resources u.common_batch_options(child, parent1, parent2, opts) if child.get('header', True): opts['create'].update( u.default_setting(child, 'prediction_name', [None, ''])) opts['create'].update( u.default_setting(child, 'centroid_name', [None, ''])) # name, exclude automatic naming alternatives u.non_automatic_name( child, opts, autoname=u'Batch Prediction of %s with %s' % \ (parent1.get('name', ''), parent2.get('name', ''))) calls = u.build_calls( resource_id, [parent1['resource'], parent2['resource']], opts) self.add(resource_id, calls)
def reify_batchanomalyscore(self, resource_id): """ Extracts the REST API arguments from the batch anomaly score JSON structure: anomaly detector, dataset and args """ child = self.get_resource(resource_id) # batch resources have 2 different origins as arguments [(_, parent1), (_, parent2)] = u.get_origin_info(child) parent1 = self.get_resource(parent1) parent2 = self.get_resource(parent2) opts = {"create": {}, "update": {}} # common create options for batch resources u.common_batch_options(child, parent1, parent2, opts) # name, exclude automatic naming alternatives u.non_automatic_name( child, opts, autoname=u'Batch Anomaly Score of %s with %s' % \ (parent1.get('name', ''), parent2.get('name', ''))) calls = u.build_calls( resource_id, [parent1['resource'], parent2['resource']], opts) self.add(resource_id, calls)