How to use the esper.plot_util.plot_heatmap_with_images function in esper

To help you get started, we’ve selected a few esper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scanner-research / esper-tv / app / esper / identity_clusters.py View on Github external
if x <= 1e-4:
            return '0{}'.format(duration_label_unit)
        elif x < 1:
            return '<1{}'.format(duration_label_unit)
        else:
            return '{:d}{}'.format(int(x), duration_label_unit)
    
    cluster_images = _get_cluster_images(clusters, False, n=10, c=10)
    plot_heatmap_with_images(
        raw_heatmap, channels, cluster_images,
        'Images of {} and Their Corresponding Screen Time As Distributed within a Channel'.format(name) if show_titles else '',
        heatmap_label_fn=heatmap_raw_label_fn,
        save_path=save_paths[0] if save_paths else None
    )
    plot_heatmap_with_images(
        raw_heatmap / raw_heatmap.sum(axis=0)[np.newaxis, :],
        channels, cluster_images,
        'Images of {} and Screen Time Distributed Within a Channel (Column Normalized)'.format(name) if show_titles else '',
        save_path=save_paths[2] if save_paths else None
    )
    plot_heatmap_with_images(
        raw_heatmap / raw_heatmap.sum(axis=1)[:, np.newaxis],
        channels, cluster_images,
        'Images of {} and Screen Time As Distributed Across Channels (Row Normalized)'.format(name) if show_titles else '',
        save_path=save_paths[1] if save_paths else None
    )
    
    raw_bar_chart = defaultdict(lambda: {}) # {CNN: [{Anderson Cooper: 360 mins}, ...], MSNBC:[{...},...,{...}]}
    cnndict = defaultdict(lambda: 0)
    msnbcdict = defaultdict(lambda: 0)
    foxdict = defaultdict(lambda: 0)
github scanner-research / esper-tv / app / esper / identity_clusters.py View on Github external
elif duration_label_unit == 'h':
            x /= 3600
        elif duration_label_unit == 's':
            pass
        else:
            raise Exception('Unknown unit: {}'.format(duration_label_unit))

        if x <= 1e-4:
            return '0{}'.format(duration_label_unit)
        elif x < 1:
            return '<1{}'.format(duration_label_unit)
        else:
            return '{:d}{}'.format(int(x), duration_label_unit)
    
    cluster_images = _get_cluster_images(clusters, False, n=10, c=10)
    plot_heatmap_with_images(
        raw_heatmap, channels, cluster_images,
        'Images of {} and Their Corresponding Screen Time As Distributed within a Channel'.format(name) if show_titles else '',
        heatmap_label_fn=heatmap_raw_label_fn,
        save_path=save_paths[0] if save_paths else None
    )
    plot_heatmap_with_images(
        raw_heatmap / raw_heatmap.sum(axis=0)[np.newaxis, :],
        channels, cluster_images,
        'Images of {} and Screen Time Distributed Within a Channel (Column Normalized)'.format(name) if show_titles else '',
        save_path=save_paths[2] if save_paths else None
    )
    plot_heatmap_with_images(
        raw_heatmap / raw_heatmap.sum(axis=1)[:, np.newaxis],
        channels, cluster_images,
        'Images of {} and Screen Time As Distributed Across Channels (Row Normalized)'.format(name) if show_titles else '',
        save_path=save_paths[1] if save_paths else None