In [1]:
%pylab inline
from tfs.models import LeNet
net = LeNet()
In [2]:
netout = net.build()
print netout
In [3]:
print net
In [4]:
print net.print_shape()
In [5]:
print net.initializer
In [6]:
print net.losser
In [7]:
print net.optimizer
In [8]:
from tfs.dataset import Mnist
dataset = Mnist()
In [9]:
import numpy as np
idx = np.random.randint(0,60000) # we have 60000 images in the training dataset
img = dataset.train.data[idx,:,:,0]
lbl = dataset.train.labels[idx]
imshow(img,cmap='gray')
print 'index:',idx,'\t','label:',lbl
In [10]:
net.monitor
Out[10]:
In [11]:
from tfs.core.monitor import *
net.monitor['default'].interval=20
net.monitor['var'] = LayerInputVarMonitor(net,interval=10)
In [12]:
net.fit(dataset,batch_size=200,n_epoch=1)
Out[12]:
In [13]:
var_result = net.monitor['var'].results
In [14]:
import pandas as pd
var = pd.DataFrame(var_result,columns=[n.name for n in net.nodes])
In [15]:
var
Out[15]:
In [ ]: