Migrated from https://github.com/tensorflow/tensorflow/issues/9688
Describe the problem
Tensorboard does not display the
Color Bydropdown menu on multi-columnar data.Label byandsearch bydisplaying columns normally.
Source code / logs
Sample of
metadata.tsvfile: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 ElectronicCode 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)
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.
The threshold is hard coded here:
https://github.com/tensorflow/tensorboard/blob/master/tensorboard/plugins/projector/vz_projector/data-provider.ts#L21
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 !
Most helpful comment
The threshold is hard coded here:
https://github.com/tensorflow/tensorboard/blob/master/tensorboard/plugins/projector/vz_projector/data-provider.ts#L21