Ejemplo n.º 1
0
def ext():
    # Read the pairs
    print "Read Pairs"
    print "Read Train"
    train = d.read_train_pairs()
    print "Read Valid"
    valid = d.read_valid_pairs()
    print "Read Sup1"
    sup1 = d.read_sup1_train_pairs()
    print "Read Sup2"
    sup2 = d.read_sup2_train_pairs()
    print "Read Sup3"
    sup3 = d.read_sup3_train_pairs()

    # Get the feature extractor
    combined = feat.feature_extractor()

    # Extract the features
    print 'Extract the features'
    print "Extract Train"
    train_att = combined.fit_transform(train)
    print "Extract Valid"
    valid_att = combined.fit_transform(valid)
    print "Extract Sup1"
    sup1_att = combined.fit_transform(sup1)
    print "Extract Sup2"
    sup2_att = combined.fit_transform(sup2)
    print "Extract Sup3"
    sup3_att = combined.fit_transform(sup3)

    print "Join"
    total_new_att = np.vstack((train_att, valid_att, sup1_att, sup2_att, sup3_att))

    # Save extracted data
    np.save('total_new_att.npy', total_new_att)
Ejemplo n.º 2
0
def extrair_tudo():
    combined = new_features1()

    print "Train"
    train = d.read_train_pairs()
    train_att = combined.fit_transform(train)
    np.save(train_att, open("train_att.npy", "wb"))


    print "Train1"
    valid = d.read_valid_pairs()
    valid_att = combined.fit_transform(valid)
    np.save(valid_att, open("valid_att.npy", "wb"))

    print "Train2"
    sup1 = d.read_sup1_train_pairs()
    sup1_att = combined.fit_transform(sup1)
    np.save(sup1_att, open("sup1_att.npy", "wb"))

    print "Train3"
    sup2 = d.read_sup2_train_pairs()
    sup2_att = combined.fit_transform(sup2)
    np.save(sup1_att, open("sup2_att.npy", "wb"))

    print "Train4"
    sup3 = d.read_sup3_train_pairs()
    sup3_att = combined.fit_transform(sup3)
    np.save(sup1_att, open("sup3_att.npy", "wb"))