Wal Street Letters Visualization of Data Clusters

In this notebook we visualize the data clusters for the Wall Street


In [7]:
import numpy as np
import h5py

import matplotlib.pyplot as plt
%matplotlib inline

# Now nexa modules|
import sys
sys.path.append("../")
from visualization.data_clustering import visualize_data_cluster_text_to_image

Load the files


In [8]:
# First we load the file 
file_location = '../results_database/text_wall_street_big.hdf5'
run_name = '/low-resolution'
f = h5py.File(file_location, 'r')

# Now we need to get the letters and align them
text_directory = '../data/wall_street_letters.npy'
letters_sequence = np.load(text_directory)
Nletters = len(letters_sequence)
symbols = set(letters_sequence)

# Load the particular example
Nspatial_clusters = 3
Ntime_clusters = 15
Nembedding = 3

parameters_string = '/' + str(Nspatial_clusters)
parameters_string += '-' + str(Ntime_clusters)
parameters_string += '-' + str(Nembedding)

nexa = f[run_name +parameters_string]

First visualize the cluster


In [9]:
cluster = 2
data_centers = np.arange(1, 15, 1)
for data_center in data_centers:
    fig = visualize_data_cluster_text_to_image(nexa, f, run_name,
                                               cluster, data_center)



In [ ]: