Beispiel #1
0
def parseData(strFileNameTrainFeatures, strFileNameTrainTimes):
    # print "---------------------------------------------------------------------"
    print 'Parsing Data'

    print ' -> Reading Train Features :', strFileNameTrainFeatures
    instIds, train_features = readfile_data(strFileNameTrainFeatures)
    train_dict_features, train_list_names_features = makeDict(instIds, train_features)
    train_array_features = train_features

    print ' -> Reading Train Times    :', strFileNameTrainTimes
    instIds, train_times = readfile_data(strFileNameTrainTimes)
    train_dict_times, train_list_names_times = makeDict(instIds, train_times)
    train_array_features_orig = np.array(train_array_features)

    nAlgs     = len(train_dict_times[train_list_names_times[0]])
    nFeatures = len(train_dict_features[train_list_names_features[1]])

    print
    print 'Basic Information on Data: '
    print ' --> Number of Algorithms            :', nAlgs
    print ' --> Number of Features              :', nFeatures
    print ' --> Number of Train-Feature-vectors :', len(train_dict_features)
    print ' --> Number of Train-Time-vectors    :', len(train_dict_times)

    # print "---------------------------------------------------------------------"

    X_train = []
    Y_train = []
    for idTrainInstance in train_list_names_features:
        X_train += [train_dict_features[idTrainInstance]]
        Y_train += [train_dict_times[idTrainInstance]]
    X_train = np.array(X_train)
    Y_train = np.array(Y_train)

    return X_train, Y_train
Beispiel #2
0
def parseData(strFileNameTestFeatures, strFileNameTestTimes):
    # print "---------------------------------------------------------------------"
    print 'Parsing Data'

    print ' -> Reading Test Features  :', strFileNameTestFeatures
    instIds, test_features = readfile_data(strFileNameTestFeatures)
    test_dict_features, test_list_names_features = makeDict(instIds, test_features)

    print ' -> Reading Test Times     :', strFileNameTestTimes

    instIds, test_times = readfile_data(strFileNameTestTimes)
    test_dict_times, test_list_names_times = makeDict(instIds, test_times)

    nAlgs     = len(test_dict_times[test_list_names_times[0]])
    nFeatures = len(test_dict_features[test_list_names_features[0]])

    print
    print ' Basic Information on Data: '
    print ' --> Number of Algorithms            :', nAlgs
    print ' --> Number of Features              :', nFeatures
    print ' --> Number of Test-Feature-vectors  :', len(test_dict_features)
    print ' --> Number of Test-Time-vectors     :', len(test_dict_times)

    # print "---------------------------------------------------------------------"
    X_test = []
    Y_test = []
    for idTestInstance in test_list_names_features:
        X_test += [test_dict_features[idTestInstance]]
        Y_test += [test_dict_times[idTestInstance]]
    X_test = np.array(X_test)
    Y_test = np.array(Y_test)
    return X_test, Y_test
def parseData(strFileNameTestFeatures, strFileNameTestTimes):
    # print "---------------------------------------------------------------------"
    print('Parsing Data')

    print(' -> Reading Test Features  :', strFileNameTestFeatures)
    instIds, test_features = readfile_data(strFileNameTestFeatures)
    test_dict_features, test_list_names_features = makeDict(
        instIds, test_features)

    print(' -> Reading Test Times     :', strFileNameTestTimes)

    instIds, test_times = readfile_data(strFileNameTestTimes)
    test_dict_times, test_list_names_times = makeDict(instIds, test_times)

    nAlgs = len(test_dict_times[test_list_names_times[0]])
    nFeatures = len(test_dict_features[test_list_names_features[0]])

    print()
    print(' Basic Information on Data: ')
    print(' --> Number of Algorithms            :', nAlgs)
    print(' --> Number of Features              :', nFeatures)
    print(' --> Number of Test-Feature-vectors  :', len(test_dict_features))
    print(' --> Number of Test-Time-vectors     :', len(test_dict_times))

    # print "---------------------------------------------------------------------"
    X_test = []
    Y_test = []
    for idTestInstance in test_list_names_features:
        X_test += [test_dict_features[idTestInstance]]
        Y_test += [test_dict_times[idTestInstance]]
    X_test = np.array(X_test)
    Y_test = np.array(Y_test)
    return X_test, Y_test
Beispiel #4
0
def parseData(strFileNameTrainFeatures, strFileNameTrainTimes):
    # print "---------------------------------------------------------------------"
    print ('Parsing Data')

    print (' -> Reading Train Features :', strFileNameTrainFeatures)
    instIds, train_features = readfile_data(strFileNameTrainFeatures)
    train_dict_features, train_list_names_features = makeDict(instIds, train_features)
    train_array_features = train_features

    print (' -> Reading Train Times    :', strFileNameTrainTimes)
    instIds, train_times = readfile_data(strFileNameTrainTimes)
    train_dict_times, train_list_names_times = makeDict(instIds, train_times)
    train_array_features_orig = np.array(train_array_features)

    nAlgs     = len(train_dict_times[train_list_names_times[0]])
    nFeatures = len(train_dict_features[train_list_names_features[1]])

    print()
    print ('Basic Information on Data: ')
    print (' --> Number of Algorithms            :', nAlgs)
    print (' --> Number of Features              :', nFeatures)
    print (' --> Number of Train-Feature-vectors :', len(train_dict_features))
    print (' --> Number of Train-Time-vectors    :', len(train_dict_times))

    # print "---------------------------------------------------------------------"

    X_train = []
    Y_train = []
    for idTrainInstance in train_list_names_features:
        X_train += [train_dict_features[idTrainInstance]]
        Y_train += [train_dict_times[idTrainInstance]]
    X_train = np.array(X_train)
    Y_train = np.array(Y_train)

    return X_train, Y_train