Beispiel #1
0
def make_empty_classifier(id="", data_id=None, component_id=None):
    message = fcm.Classifier()
    message.id = id  # id is mandatory
    if component_id is not None:
        message.component_id = component_id
    if data_id is not None:
        message.data_id = data_id
    return message
Beispiel #2
0
def make_merger(id, merged_ids, merge_type=None):
    message = fcm.Merger()
    message.id = id
    for c in merged_ids:
        message.merged_ids.append(c)
    if merge_type is not None:
        message.merge_type = merge_type
    return message
Beispiel #3
0
def make_trigger(id, classifier, component_ids, model=None):
    message = fcm.Trigger()
    message.id = id
    if model is not None:
        message.model = model
    message.classifier.CopyFrom(classifier)  # Classifier has to be trained
    for component_id in component_ids:
        message.component_ids.append(component_id)
    return message
Beispiel #4
0
def make_classifier(id, classifier_file, component_id=None, data_id=None):
    message = fcm.Classifier()
    message.id = id
    message.classifier_file = classifier_file
    if data_id is not None:
        message.data_id = data_id
    if component_id is not None:
        message.component_id = component_id
    return message
Beispiel #5
0
def make_data(id, num_train, num_test, label_name=None, source=None):
    message = fcm.Data()
    message.id = id
    message.num_train = num_train
    message.num_test = num_test
    if source is not None:
        message.source.CopyFrom(source)
    if label_name is not None:
        message.label_name.extend(label_name)
    return message
 def __init__(self, verbose=True):
     self.system_serialized = fcm.System().SerializeToString()
     self.verbose = verbose
     self.metrics = {}
     self.start = ""  # Indicates the beginning of the graph/ensemble
 def __deserialize(self):
     system = fcm.System()
     system.ParseFromString(self.system_serialized)
     return system
Beispiel #8
0
def make_empty_trigger(id, component_ids):
    message = fcm.Trigger()
    message.id = id
    for component_id in component_ids:
        message.component_ids.append(component_id)
    return message
import numpy as np
import Source.protobuf.make_util as make_util
import Source.io_util as io_util
import Source.protobuf.FastComposedModels_pb2 as fcm

if __name__ == '__main__':
    # Load RAW(!) classifier
    # OLD AND NEW.
    name = "/dataT/eid/GIT/tpml/ml_experiments/001interns/demo_classifier"
    # name = "/dataT/eid/GIT/tpml/ml_experiments/001interns/demo_classifier_v001"

    msg = fcm.ClassifierRawData()
    io_util.read_message(name, msg)
    print(msg)