Visualization of the Spatiotemporal clusters.

Here we present a visualization of how the clusters look in the frame of reference of the letters.


In [2]:
import numpy as np
import h5py
import matplotlib.pyplot as plt
%matplotlib inline

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

First we load all the files


In [3]:
# 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)

Nexa parameters and the name of the run


In [4]:
# Nexa parameters
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]

Now we call the function for plotting and plot


In [5]:
fig = visualize_clusters_text_to_image(nexa, f, run_name)
plt.show(fig)



In [ ]: