예제 #1
0
파일: load.py 프로젝트: yuemind/fastseq
def show_results(x: TensorSeq,
                 y,
                 samples,
                 outs,
                 ctxs=None,
                 max_n=9,
                 nrows=None,
                 ncols=None,
                 figsize=None,
                 **kwargs):
    if ctxs is None:
        ctxs = get_grid(min(len(samples), max_n),
                        nrows=nrows,
                        ncols=ncols,
                        add_vert=1,
                        figsize=figsize)
    for i in range(len(outs[0])):
        ctxs = [
            TSTensorSeqy(b, m='*r', label='pred').show(ctx=c, **kwargs)
            for b, c, _ in zip(outs.itemgot(i), ctxs, range(max_n))
        ]
    for i in range(len(samples[0])):
        ctxs = [
            b.show(ctx=c, **kwargs)
            for b, c, _ in zip(samples.itemgot(i), ctxs, range(max_n))
        ]
    return ctxs
예제 #2
0
파일: core.py 프로젝트: yx925/timeseries
def show_results(x: TensorTS,
                 y,
                 samples,
                 outs,
                 ctxs=None,
                 max_n=9,
                 nrows=None,
                 ncols=None,
                 figsize=(14, 12),
                 **kwargs):
    if ctxs is None:
        ctxs = get_grid(min(len(samples), max_n),
                        nrows=nrows,
                        ncols=ncols,
                        add_vert=1,
                        figsize=figsize)
    # outs = [('6.0',),('2.0',)]
    outs = [detuplify(o) for o in outs]
    # outs = ['6.0', '2.0']

    ctxs = default_show_results(x,
                                y,
                                samples,
                                outs,
                                ctxs=ctxs,
                                max_n=max_n,
                                figsize=figsize,
                                **kwargs)
    return ctxs
예제 #3
0
def show_batch(x:TensorTS, y, samples, ctxs=None, max_n=9, rows=None, cols=None, figsize=None, title=None, **kwargs):
    if ctxs is None: ctxs = get_grid(max_n, rows=rows, cols=cols, figsize=figsize)

    ctxs = default_show_batch(x, y, samples, ctxs=ctxs, max_n=max_n, **kwargs)
    if title:
        plt.suptitle(title, fontsize=16)
        plt.subplots_adjust()
        plt.subplots_adjust(left=0.0, wspace=0.4, top=0.9, bottom=0.5)
    return ctxs
예제 #4
0
파일: core.py 프로젝트: yx925/timeseries
def show_batch(x: TensorTS,
               y,
               samples,
               ctxs=None,
               max_n=9,
               nrows=None,
               ncols=None,
               figsize=(14, 12),
               **kwargs):
    if ctxs is None:
        ctxs = get_grid(min(len(samples), max_n),
                        nrows=nrows,
                        ncols=ncols,
                        figsize=figsize)
    ctxs = default_show_batch(x, y, samples, ctxs=ctxs, max_n=max_n, **kwargs)
    return ctxs
예제 #5
0
def show_graphs(arrays,
                rows=None,
                cols=None,
                figsize=None,
                titles=None,
                **kwargs):
    "Show all images `arrays` as subplots with `rows` using `titles`"
    if titles is None: titles = [None] * len(arrays)
    axs = get_grid(len(arrays),
                   rows=rows,
                   cols=cols,
                   add_vert=1,
                   figsize=figsize)
    for a, t, ax in zip(arrays, titles, axs):
        ctx = show_graph(a[0], ax=ax, title=t)
        for y in a[1:]:
            ctx = y.show(ctx=ctx)
    return axs
예제 #6
0
파일: load.py 프로젝트: jrich10/fastseq
def show_batch(x: TSMulti,
               y: TensorSeq,
               its,
               *args,
               ctxs=None,
               max_n=10,
               rows=None,
               cols=None,
               figsize=None,
               **kwargs):
    if ctxs is None:
        ctxs = get_grid(min(x[0].shape[0], max_n),
                        add_vert=1,
                        figsize=figsize,
                        **kwargs)
    for i, ctx in enumerate(ctxs):
        o = TSMulti([type(o)(o, **o._meta) for o in its[i] if o.shape[-1] > 0])
        ctx = o.show(ctx=ctx)
    return ctxs
예제 #7
0
def show_batch(x: TSMulti,
               none_1,
               none_2,
               *args,
               ctxs=None,
               max_n=10,
               rows=None,
               cols=None,
               figsize=None,
               **kwargs):
    if ctxs is None:
        ctxs = get_grid(min(x[0].shape[0], max_n),
                        add_vert=1,
                        figsize=figsize,
                        **kwargs)
    for i, ctx in enumerate(ctxs):
        o = TSMulti([type(o)(o[i], **o._meta) for o in x])
        ctx = o.show(ctx=ctx)
    return ctxs
예제 #8
0
def show_results(x:TensorTS, y, samples,  outs, ctxs=None, max_n=9, rows=None, cols=None, figsize=None, **kwargs):
    # if ctxs is None: ctxs = get_grid(min(len(samples), max_n), rows=rows, cols=cols, add_vert=1, figsize=figsize)
    s = len(samples)  # min(len(samples), max_n)
    # max_n = min(s, max_n)
    if ctxs is None: ctxs = get_grid(max_n, rows=rows, cols=cols, add_vert=1, figsize=figsize)
    # print(len(samples), max_n)
    # print(samples)
    # print(type(y))
    # outs = [('6.0',),('2.0',)]
    # print(f'outs - before detuplify : {outs}')
    outs = [detuplify(o) for o in outs]
    # outs = ['6.0', '2.0']
    # print(f'outs : {outs})

    ctxs = [b[0].show(ctx=c, title=f'{o} / {b[1]}', **kwargs) for b,o,c,_ in zip(samples,outs,ctxs,range(max_n))]
    # if title:
    #     plt.suptitle(title, fontsize=16)
    #     plt.subplots_adjust(left=0.0, wspace=0.4, top=0.9)
    plt.tight_layout()
    return ctxs
예제 #9
0
def show_results(x: TSMulti,
                 y,
                 its,
                 outs,
                 ctxs=None,
                 max_n=9,
                 rows=None,
                 cols=None,
                 figsize=None,
                 **kwargs):
    if ctxs is None:
        ctxs = get_grid(min(x[0].shape[0], max_n),
                        add_vert=1,
                        figsize=figsize,
                        **kwargs)
    for i, ctx in enumerate(ctxs):
        r = [type(o)(o, **o._meta) for o in its[i] if o.shape[-1] > 0]
        r.append(type(its[i][-1])(outs[i][0], label=['pred_y'], m=['r']))
        o = TSMulti(r)
        ctx = o.show(ctx=ctx)
예제 #10
0
def show_results(x: TSMulti,
                 x1,
                 none_1,
                 none_2,
                 ctxs=None,
                 max_n=9,
                 rows=None,
                 cols=None,
                 figsize=None,
                 **kwargs):
    if ctxs is None:
        ctxs = get_grid(min(x[0].shape[0], max_n),
                        add_vert=1,
                        figsize=figsize,
                        **kwargs)
    for i, ctx in enumerate(ctxs):
        r = [type(o)(o[i], **o._meta) for o in x]
        r.append(type(x1[-1])(x1[-1][i], label=['pred'], m=['r']))
        o = TSMulti(r)
        ctx = o.show(ctx=ctx)
예제 #11
0
파일: load.py 프로젝트: yuemind/fastseq
def show_batch(x: TensorSeq,
               y,
               samples,
               ctxs=None,
               max_n=10,
               nrows=None,
               ncols=None,
               figsize=None,
               **kwargs):
    if ctxs is None:
        ctxs = get_grid(min(len(samples), max_n),
                        nrows=nrows,
                        ncols=ncols,
                        add_vert=1,
                        figsize=figsize)
    ctxs = show_batch[object](x,
                              y,
                              samples=samples,
                              ctxs=ctxs,
                              max_n=max_n,
                              **kwargs)
    return ctxs
예제 #12
0
def show_batch(x: TSeries, y, samples, ctxs=None, max_n=10,rows=None, cols=None, figsize=None, **kwargs):
    "Show batch for TSeries objects"
    if ctxs is None: ctxs = get_grid(min(len(samples), max_n), rows=rows, cols=cols, add_vert=1, figsize=figsize)
    ctxs = show_batch[object](x, y, samples=samples, ctxs=ctxs, max_n=max_n, **kwargs)
    return ctxs