Пример #1
0
def retrieve_sv_features():
    '''

    This router function retrieves the generalized features properties that can
    be expected for any given observation within the supplied dataset.

    @label_list, this value will be a json object, since it was originally
        cached into redis using 'json.dumps'.

    '''

    # get model type
    selected_collection = request.get_json()['selected-collection']
    model_type = ModelType().get_model_type(selected_collection)['result']

    # return all feature labels
    if request.method == 'POST':
        label_list = Hset().uncache(
            model_type + '_feature_labels',
            selected_collection
        )

        if label_list['result']:
            return json.dumps(label_list['result'])
        else:
            return json.dumps({'error': label_list['error']})
Пример #2
0
    def predict(self):
        '''

        This method generates a prediction with respect to the implemented
        model, using the provided prediction feature input(s), and the stored
        corresponding model, within the NoSQL datastore.

        '''

        # get model type
        model_type = ModelType().get_model_type(self.model_id)['result']
        return predict(model_type, self.model_id, self.predictors)