Example #1
0
def from_bson_to_model(bson):
    model_id = bson['model_id']
    processed = bson['processed']
    w_vector = bson['w_vector']
    d = bson['d']
    if processed:
        score = bson['score']
    else:
        score = None
    generation = bson['generation']

    model = LearningModel(w_vector, d, model_id)
    model.generation = generation
    model.processed = processed
    model.score = score
    return model
Example #2
0
def create_model(w_array, d):
    w_array_mut = [i for i in w_array.ravel()]
    model = LearningModel(w_array_mut, d)
    model.processed = False
    return model