API details.
show_graph can show an array...
a = np.arange(10)
ax = show_graph(a)
a = tensor(np.arange(10)+np.random.randn(2,10))[None,:]
ax = show_graph(a)
ax = TensorSeq(np.arange(10)).show()
ts = TSTensorSeq(np.arange(10))
ctx = ts.show()
y = TSTensorSeqy(np.arange(12))
y.show(ctx=ctx)
y_hat = TSTensorSeqy(np.array([10.3,10.8,12.2]), x_len=10, m='*r', label='pred')
show_graphs(((a, y, y_hat), (a*.7, y*.7, y_hat*.7)), titles=('y','y * .7'), figsize=(10,10))
l = L(1,2,3)
test_eq(first_item(l),1)
l = [1,2,3]
test_eq(first_item(l),1)
test_eq(1,1)
dct = defaultdict(dict)
new_d = {'foo':{'bar':torch.randn(4,4)}}
dct = concat_dct(new_d, dct)
print(dct['foo']['bar'].shape)
new_d = {'foo':{'bar':torch.randn(4,4)+10}}
dct = concat_dct(new_d, dct)
print(dct['foo']['bar'].shape)
new_d = {'foo':{'bar':torch.randn(8,4)+10}}
dct = concat_dct(new_d, dct)
print(dct['foo']['bar'].shape)
l = []
skip = Skip(.9)
for i in range(10000):
if not skip(i):
l.append(1)
else:
l.append(0)
test_eq(l[0],1)
test_close(np.mean(l),.9,.01)
from fastseq.data.all import *
from fastai2.basics import *
path = untar_data(URLs.m4_daily)
pd.read_csv(path/'val.csv',skiprows = Skip(.9))
# train, val = get_ts_files(path, nrows=1000)
items = list(range(10))
splitter = IndexsSplitter(5,8)
test_eq(splitter(items),(L(0,1,2,3,4),L(5,6,7)))
splitter = IndexsSplitter(5,8,True)
test_eq(splitter(items),(L(0,1,2,3,4),L(5,6,7),L(8,9)))
ts
ts_lists(ts)