Training deep neural networks

@cesans


In [1]:
import matplotlib.pyplot as plt
%matplotlib inline

In [2]:
import sys
sys.path.append('../')
import numpy as np

import deep_control as dc

import pandas
import seaborn as sns


/home/carlos/venv/py3/lib/python3.5/site-packages/theano/tensor/signal/downsample.py:6: UserWarning: downsample module has been moved to the theano.tensor.signal.pool module.
  "downsample module has been moved to the theano.tensor.signal.pool module.")

Loading data

Previously generated trajectories can be loaded with dc.data.load_trajectories


In [4]:
import glob
import pickle
from tqdm import tqdm

files = glob.glob('../data/rw/*pic')

total = 0
trajs = []
for f in tqdm(files, leave=True):    
        rw = pickle.load(open(f,'rb'))
        for rwi in rw:
            traj = np.hstack((rwi[0], rwi[1]))
            df = pandas.DataFrame(data=traj)
            col_names = ['t', 'x', 'y', 'z', 'vz', 'theta', 'm', 'u1', 'u2']
            df.columns = col_names
            trajs.append(df)


100%|██████████| 835/835 [00:34<00:00, 24.20it/s]

In [5]:
ini_ps = np.vstack([t.values[0,:] for t in trajs])

In [6]:
for i in range(3):
    for j in range(2):
            plt.subplot(2,3,i*2+j+1)
            plt.hist(ini_ps[:,i*2+j+1],59)
            plt.locator_params(nbins=5)            
            
plt.tight_layout()



In [7]:
plot_idx_t = [(x,list(range(1,x)))for x in range(1,7)]

In [8]:
plot_idx = []

In [9]:
for p in plot_idx_t:
    for pi in p[1]:
        plot_idx.append((p[0],pi))

In [10]:
plt.rcParams['figure.figsize'] = [30,20]

In [11]:
for i in range(5):
    for j in range(3):
        plt.subplot(5,3,i*3+j+1)
        plt.scatter(ini_ps[:,plot_idx[i*3+j][0]], ini_ps[:,plot_idx[i*3+j][1]], s=5, alpha=0.1)
        plt.locator_params(nbins=4)