Esempio n. 1
0
def plot_showcase_with_clusters():
    ds = Table('showcase')
    X, = ds.to_numpy("a")
    w, means, covars, priors = em(X, 3, 100)
    stdevs = np.sqrt(covars)

    m, M = X.min(axis=0), X.max(axis=0)
    X = (X - m) / (M - m)
    means = (means - m) / (M - m)
    stdevs /= M - m

    parallel_coordinates_plot("showcase-clusters.pdf", X, means, stdevs)
Esempio n. 2
0
def plot_wine_with_km():
    ds = Table('wine')
    X, = ds.to_numpy("a")
    X = X[:, (3,4,5,6,9)]
    w, means, covars, priors = em(X, 3, 0)
    stdevs = np.sqrt(covars)

    m, M = X.min(axis=0), X.max(axis=0)
    X = (X - m) / (M - m)
    means = (means - m) / (M - m)
    stdevs /= M - m

    parallel_coordinates_plot("wine-km.pdf", X, means, stdevs)
Esempio n. 3
0
def plot_yeast_with_km():
    ds = Table('yeast-class-RPR')
    from Orange.feature.imputation import AverageConstructor
    ds = AverageConstructor()(ds)(ds)

    X, = ds.to_numpy("a")
    X = X[:, (72, 73, 74, 75, 76, 77, 78)]
    w, means, covars, priors = em(X, 4, 0)
    stdevs = np.sqrt(covars)

    m, M = X.min(axis=0), X.max(axis=0)
    X = (X - m) / (M - m)
    means = (means - m) / (M - m)
    stdevs /= M - m

    parallel_coordinates_plot("yeast-km.pdf", X, means, stdevs)
Esempio n. 4
0
def plot_showcase():
    ds = Table('showcase')
    X, = ds.to_numpy("a")
    m, M = X.min(axis=0), X.max(axis=0)
    X = (X - m) / (M - m)

    def annotate_critical_areas(ax):
        ax.add_artist(Ellipse(xy=(1., 0.6,), width=.1, height=0.3, facecolor='none'))
        ax.annotate('1.', xy=(1, 0.6), xytext=(0.5, 0.4),
                    arrowprops=dict(facecolor='white', shrink=0.05))
        ax.add_artist(Ellipse(xy=(2., 0.725,), width=.1, height=0.5, facecolor='none'))
        ax.add_artist(Ellipse(xy=(3., 0.8,), width=.1, height=0.4, facecolor='none'))
        ax.annotate('2.', xy=(2., 0.725), xytext=(2.5, 0.5),
                    arrowprops=dict(facecolor='white', shrink=0.05))
        ax.annotate('2.', xy=(3., 0.725), xytext=(2.5, 0.5),
                    arrowprops=dict(facecolor='white', shrink=0.05))

    parallel_coordinates_plot("showcase-lines.pdf", X, annotate=annotate_critical_areas)