Пример #1
0
# In[14]:

lpl.ScreePlotter(DM, mode="savediv", base_path=out_base).plot()
lpl.ScreePlotter(EEG_Embedded, mode="savediv", base_path=out_emb_base).plot()

# In[15]:

lpl.HGMMClusterMeansDendrogram(DM, mode="savediv",
                               base_path=out_base).plot(level=2)
lpl.HGMMClusterMeansDendrogram(EEG_Embedded,
                               mode="savediv",
                               base_path=out_emb_base).plot(level=2)

# In[16]:

lpl.HGMMStackedClusterMeansHeatmap(DM, mode="savediv",
                                   base_path=out_base).plot(level=2)
lpl.HGMMStackedClusterMeansHeatmap(EEG_Embedded,
                                   mode="savediv",
                                   base_path=out_emb_base).plot(level=2)

# In[17]:

lpl.HGMMClusterMeansLevelLines(DM, mode="savediv",
                               base_path=out_base).plot(level=2)
lpl.HGMMClusterMeansLevelLines(EEG_Embedded,
                               mode="savediv",
                               base_path=out_emb_base).plot(level=2)

# In[18]:

lpl.ScreePlotter(DM, mode="savediv", base_path=out_base).plot()
Пример #2
0
def make_plots(csv_file, index_col=None, title=None, cluster_levels=2):
    """
    Function for making series of plots.

    Parameters
    ----------
    csv_file : str
        Path to the csv_file to plot
    index_col : str, optional
        Name of the index column in csv_file
    title : str, optional
        Title of the dataset.
    cluster_levels : int (default=1)
        Number of levels for hierarchial clustering
    
    Returns
    -------
    out : dict
        Dictionary containing html div for each plot
    """
    ds = lds.CSVDataSet(csv_file, name=title, index_column=index_col)

    #Make plots and save as div
    location_heatmap = lpl.LocationHeatmap(
        ds, mode='div').plot(showticklabels=True)
    location_lines = lpl.LocationLines(ds,
                                       mode='div').plot(showticklabels=True)

    #Z-transform the data
    ds.D = ds.D.apply(zscore)

    #Make plots on transformed data
    histogram_heatmap = lpl.HistogramHeatmap(
        ds, mode='div').plot(showticklabels=True)
    scree_plot = lpl.ScreePlotter(ds, mode='div').plot()
    corr_matrix = lpl.CorrelationMatrix(ds,
                                        mode='div').plot(showticklabels=True)

    #HGMM plots
    cluster_ds = lcl.HGMMClustering(ds, levels=cluster_levels)
    hgmm_dendogram = lpl.HGMMClusterMeansDendrogram(cluster_ds,
                                                    mode='div').plot()
    hgmm_pair_plot = lpl.HGMMPairsPlot(cluster_ds, mode='div').plot()
    hgmm_stacked_mean = lpl.HGMMStackedClusterMeansHeatmap(
        cluster_ds, mode='div').plot(showticklabels=True)
    hgmm_cluster_mean = lpl.HGMMClusterMeansLevelHeatmap(
        cluster_ds, mode='div').plot(showticklabels=True)
    hgmm_cluster_means = lpl.HGMMClusterMeansLevelLines(
        cluster_ds, mode='div').plot(showticklabels=True)

    out = {
        "Histogram Heatmap": histogram_heatmap,
        "Location Heatmap": location_heatmap,
        "Location Lines": location_lines,
        "Scree Plot": scree_plot,
        "Correlation Matrix": corr_matrix,
        "Hierarchical GMM Dendogram": hgmm_dendogram,
        "Pair Plot": hgmm_pair_plot,
        "Cluster Stacked Means": hgmm_stacked_mean,
        "Cluster Mean Heatmap": hgmm_cluster_mean,
        "Cluster Mean Lines": hgmm_cluster_means
    }

    return out