Tensorboard: Embedding Projector: "Color by" drop-down not showing up on multi-column .tsv

Created on 16 Jun 2017  路  5Comments  路  Source: tensorflow/tensorboard

Migrated from https://github.com/tensorflow/tensorflow/issues/9688

Describe the problem

Tensorboard does not display the Color By dropdown menu on multi-columnar data. Label by and search by displaying columns normally.

tensorboard dropdown issue

Source code / logs

Sample of metadata.tsv file:

Name  Genre
(Sandy) Alex G    Alternative/Indie Rock  
*NSYNC    Pop/Rock    
Acollective   Pop/Rock    
Ahmet 脰zhan   International   
Ahu   Club/Dance  
Alex Ferreira Pop/Rock    
Alex Winston  Pop/Rock    
Ali Azimi Pop/Rock    
Alphamama Pop/Rock    
Amaryllis International   
...
Yomo Toro Latin
Youssou N'Dour    International
Zafra Negra   Latin
Zany  Electronic  
Zeki M眉ren    International
iSHi  Electronic  

Code to generate embeddings and metadata:

def list_to_tsv(filenames, metadata_dir):
    with open(os.path.join(metadata_dir,'metadata.tsv'), 'w') as tsvfile:
        writer = csv.writer(tsvfile, delimiter = "\t")
        for record in filenames:
            writer.writerow(record)

def save_down_tensors(tensor_dir, name_and_embedding):
    embeddings = [i[2] for i in name_and_embedding] 
    names = [[i[0],i[1]] for i in name_and_embedding]
    names.insert(0,['Name','Genre'])
    with tf.Session() as sess:
        embeddings_tf = tf.Variable(np.array(embeddings), name = "embeddings")
        tf.global_variables_initializer().run()
        # save the tensor down
        saver = tf.train.Saver(tf.global_variables())
        saver.save(sess, tensor_dir, 0)
        # associate metadata with the embedding
        summary_writer = tf.summary.FileWriter(tensor_dir)
        config = projector.ProjectorConfig()
        embedding = config.embeddings.add()
        embedding.tensor_name = embeddings_tf.name
        #save filenames to tsv
        list_to_tsv(names, metadata_dir)
        embedding.metadata_path = os.path.join(metadata_dir, "metadata.tsv")
        # save a configuration file that TensorBoard will read during startup.
        projector.visualize_embeddings(summary_writer, config)
projector bug

Most helpful comment

All 5 comments

I ran into the same issue.
After taking a look at the code, it seems that the maximum number of unique values for a column to be used in color-by is 50.
I tried to increase the threshold and run the projector on my data with ~100 unique values (10000 points non-evenly distributed with respect to the color-by filter) and did not run in any performance issue on an average laptop.
What would need to be done to be able to increase this threshold?

@tuvistavie cool! can you share where you found the threshold? looking through the code and it's not immediately obvious.

Don鈥檛 know how i missed that, thank you.

I got stuck without knowing the limit of number of colors. This helped me a lot. Thanks, Guys !

Was this page helpful?
0 / 5 - 0 ratings