コード例 #1
0
def TSNE_Gist(name, csvfilename):
    idsT = imagesHandler.get_all_img_ids()
    ids = []
    for id in idsT:
        ids.append(str(id[0]))
    print ids
    gistVals = util.loadCSV(csvfilename)
    X = np.array(gistVals)
    model = TSNE(n_components=2, random_state=0)
    tsne_vals = model.fit_transform(X)
    tsneHandler.storeTsneValsWIds(name, tsne_vals, ids)
    return tsne_vals, ids
コード例 #2
0
def TSNE_Gist(name, csvfilename):
    idsT = imagesHandler.get_all_img_ids()
    ids = []
    for id in idsT:
        ids.append(str(id[0]))
    print ids
    gistVals = util.loadCSV(csvfilename)
    X = np.array(gistVals)
    model = TSNE(n_components=2, random_state=0)
    tsne_vals = model.fit_transform(X)
    tsneHandler.storeTsneValsWIds(name, tsne_vals, ids)
    return tsne_vals, ids
コード例 #3
0
def TSNE_sift(name):
    conn = sqlite3.connect(dirm.sqlite_file)
    c = conn.cursor()
    dist = sift_cb_handler.get_distributions()
    X_Ids = []
    X_data = []
    for d in dist:
        x_id = d[0]
        x_data = d[1:]
        X_Ids.append(x_id)
        X_data.append(x_data)
    X_data = np.array(X_data)
    model = TSNE(n_components=2)
    tsne_x = model.fit_transform(X_data)
    tsneHandler.storeTsneValsWIds(name, tsne_x, X_Ids)
    return tsne_x, X_Ids
コード例 #4
0
def TSNE_General(tablename):
    conn = sqlite3.connect(dirm.sqlite_file)
    c = conn.cursor()
    cmd = "SELECT * FROM {tn}".format(tn=tablename)
    c.execute(cmd)
    all_rows = c.fetchall()
    ids = []
    data = []
    for row in all_rows:
        ids.append(str(row[0]))
        data.append(row[1:])
    X = np.array(data)
    model = TSNE(n_components=2, random_state=0)
    tsne_vals = model.fit_transform(X)
    tsneHandler.storeTsneValsWIds(tablename, tsne_vals, ids)
    return tsne_vals, ids
コード例 #5
0
def TSNE_sift(name):
    conn = sqlite3.connect(dirm.sqlite_file)
    c = conn.cursor()
    dist = sift_cb_handler.get_distributions()
    X_Ids = []
    X_data = []
    for d in dist:
        x_id = d[0]
        x_data = d[1:]
        X_Ids.append(x_id)
        X_data.append(x_data)
    X_data = np.array(X_data)
    model = TSNE(n_components=2)
    tsne_x = model.fit_transform(X_data)
    tsneHandler.storeTsneValsWIds(name, tsne_x, X_Ids)
    return tsne_x, X_Ids
コード例 #6
0
def TSNE_General(tablename):
    conn = sqlite3.connect(dirm.sqlite_file)
    c = conn.cursor()
    cmd = 'SELECT * FROM {tn}'.format(tn=tablename)
    c.execute(cmd)
    all_rows = c.fetchall()
    ids = []
    data = []
    for row in all_rows:
        ids.append(str(row[0]))
        data.append(row[1:])
    X = np.array(data)
    model = TSNE(n_components=2, random_state=0)
    tsne_vals = model.fit_transform(X)
    tsneHandler.storeTsneValsWIds(tablename, tsne_vals, ids)
    return tsne_vals, ids