Example #1
0
def mainregress(selection, alpha):
    if len(selection) < 2:
        return

    x = xdown.get()['value']
    y = ydown.get()['value']

    tabdata = []
    mldatax = []
    mldatay = []
    species = iris.Species.unique()
    for i, p in enumerate(selection['points']):
        mldatax.append(p['x'])
        mldatay.append(p['y'])
        tabdata.append({
            x: p['x'],
            y: p['y'],
            'species': species[p['curve']]
        })


    X = np.c_[mldatax, np.array(mldatax) ** 2]
    ridge = KernelRidge(alpha=alpha).fit(X, mldatay)

    xspace = np.linspace(min(mldatax)-1, max(mldatax)+1, 100)

    plot = pw.scatter(mldatax, mldatay, label='train', markersize=15)
    for i, df in iris.groupby('Species'):
        plot += pw.scatter(df[x], df[y], label=i)
    plot += pw.line(xspace, ridge.predict(np.c_[xspace, xspace**2]), label='model', mode='lines')
    plot.xlabel = x
    plot.ylabel = y
    linear.do_all(plot.dict)
    table1.do_data(pd.DataFrame(tabdata))
Example #2
0
def gen_stars(label):
    buss1 = business[business.categories.str.contains(label)]

    cache['bids'] = buss1.business_id
    chart = pw.scatter(buss1.review_count, buss1.stars, text=buss1.name)
    chart.xlabel('reviews')
    chart.ylabel('stars')
    chart.title(label)
    chart.layout['hovermode'] = 'closest'
    return chart
Example #3
0
def pairplot(x, y):
    if x is None or y is None:
        return
    x = x['value']
    y = y['value']
    plot = pw.Chart()
    for i, df in iris.groupby('Species'):
        plot += pw.scatter(df[x], df[y], label=i)
    plot.xlabel = x
    plot.ylabel = y
    mainplot.do_all(plot.dict)
Example #4
0
def pairplot(x, y):
    print('hellox')
    if x is None or y is None:
        return
    x = x['value']
    y = y['value']
    plot = pw.Chart()
    for i, df in iris.groupby('Species'):
        plot += pw.scatter(df[x], df[y], label=i)
    plot.xlabel(x)
    plot.ylabel(y)
    mainplot.do_all(plot.to_json())
Example #5
0
def vizplace(place):
    bid = cache['bids'][place['point']]
    name = business[business.business_id == bid].name.values[0]

    chart = gen_busy(bid)
    chart.title(name)
    busy.do_all(chart.dict)
    revbid = reviews[reviews.business_id == bid]

    chart = pw.scatter(revbid.date, revbid.stars)
    chart.data[0]['marker'] = {'opacity': 1 / np.log(revbid.shape[0])}
    chart.ylabel('stars')
    chart.title(name)
    chart.layout['hovermode'] = 'closest'
    revdate.do_all(chart.dict)
Example #6
0
def mainregress(selection, alpha):
    if len(selection) < 2:
        return

    x = xdown.get()['value']
    y = ydown.get()['value']

    tabdata = []
    mldatax = []
    mldatay = []
    species = iris.Species.unique()
    for i, p in enumerate(selection['points']):
        mldatax.append(p['x'])
        mldatay.append(p['y'])
        tabdata.append({
            x: p['x'],
            y: p['y'],
            'species': species[p['curveNumber']]
        })

    X = np.c_[mldatax, np.array(mldatax)**2]
    ridge = KernelRidge(alpha=alpha).fit(X, mldatay)

    xspace = np.linspace(min(mldatax) - 1, max(mldatax) + 1, 100)

    plot = pw.scatter(mldatax, mldatay, label='train', markersize=15)
    for i, df in iris.groupby('Species'):
        plot += pw.scatter(df[x], df[y], label=i)
    plot += pw.line(xspace,
                    ridge.predict(np.c_[xspace, xspace**2]),
                    label='model',
                    mode='lines')
    plot.xlabel(x)
    plot.ylabel(y)
    linear.do_all(plot.to_json())
    table1.do_update(tabdata)
Example #7
0
def bubble():
    chart = pw.scatter(data, markersize=np.arange(1, 6) * 10)
    chart.save('fig_bubble.html', **options)
Example #8
0
def scatter():
    pw.scatter(data).save('fig_scatter.html', **options)
Example #9
0
def bubble():
    chart = pw.scatter(data, markersize=np.arange(1, 6) * 10)
    chart.save('fig_bubble.html', **options)
Example #10
0
def scatter():
    pw.scatter(data).save('fig_scatter.html', **options)