In [1]:
"""Mainly Edited for private usage by:  Ioannis Agriomallos
                                        Ioanna Mitsioni
License: BSD 3 clause

============= CURRENT CODE USAGE =============
Current code trains MLP Classifiers, to classify force input samples as stable (0) or slip (1)
---- Input
-> Input samples originate from optoforce sensors and are 3D (fx,fy,fz) and come from 2 different datasets, 
   one training, containing several surfaces as well as slip-stable occurrences, 
   and one validation, containing 1 surface with slip-stable occurrences on a completely unseen task-setup.
---- Input transformation
-> Several pre-features can be taken from these inputs, but here |f| is kept.
-> Several time and frequency domain features are extracted from pre-feature windows. 
  (implemented in 'featext.py') These windows have size w and are shifted by s on each sample
-> Then a feature selection-ranking is performed using MutualVariableInformation
-> Finally PCA is performed to keep a reduced set among the best selected features
---- Training of ML Classifiers
-> Several MLP Classifiers are trained for all combinations of selected featuresets-datasets
---- Results
-> Stats of classification results are kept inside each .npz along with the respective trained model
"""
print(__doc__)
import time
start_time = time.time()
import numpy as np
from ml_training import *
import matplotlib.pyplot as plt
%matplotlib inline 
# %matplotlib qt
# inline (suitable for ipython only, shown inside browser!) or qt (suitable in general, shown in external window!)
from matplotlib.colors import ListedColormap
import matplotlib.image as mpimg
from mpl_toolkits.mplot3d import Axes3D


Mainly Edited for private usage by:  Ioannis Agriomallos
                                        Ioanna Mitsioni
License: BSD 3 clause

============= CURRENT CODE USAGE =============
Current code trains MLP Classifiers, to classify force input samples as stable (0) or slip (1)
---- Input
-> Input samples originate from optoforce sensors and are 3D (fx,fy,fz) and come from 2 different datasets, 
   one training, containing several surfaces as well as slip-stable occurrences, 
   and one validation, containing 1 surface with slip-stable occurrences on a completely unseen task-setup.
---- Input transformation
-> Several pre-features can be taken from these inputs, but here |f| is kept.
-> Several time and frequency domain features are extracted from pre-feature windows. 
  (implemented in 'featext.py') These windows have size w and are shifted by s on each sample
-> Then a feature selection-ranking is performed using MutualVariableInformation
-> Finally PCA is performed to keep a reduced set among the best selected features
---- Training of ML Classifiers
-> Several MLP Classifiers are trained for all combinations of selected featuresets-datasets
---- Results
-> Stats of classification results are kept inside each .npz along with the respective trained model

Prepare Config struct class to pass to the ml class, responsible for all function initializations


In [2]:
class struct:
    def __init__(self):
        ####### TRAINING DEFAULTS
        self.cv = KFold(n_splits=5,random_state=42)
        self.scaler = StandardScaler() ;
        self.decomp = PCA(n_components=20)
        self.names = ["NearNb", "RBFSVM1", "MLP1", "RandFor"]
        self.classifiers = [KNeighborsClassifier(5),
                       SVC(gamma='auto', C=1),
                       MLPClassifier(solver='lbfgs',alpha=1e-4,hidden_layer_sizes=(10,10),random_state=1,verbose=True),
                       RandomForestClassifier(max_depth=5, n_estimators=10, max_features=1)]

        self.download = 1            # Download pre-computed (1) data or compute them all anew (0)
        self.delete_big_features = 0 # Delete (1) or keep (0) computed big-in-size features,
                                  # helping mainly to avoid several computations when recomputing features

        ############ INITIALISATION PARAMETERS ############
        self.window, self.shift = 1024, 20
        self.samplesperdataset = 10000
        self.havelabel = 1
        self.returntime = 0
        self.featlabel = 0         # 0: all features, 1: temporal, 2: frequency, 3: FFT only
        self.magnFFT = 0           # 0: FFT in magnitude format, 1: FFT in real and imag format,
        self.featall = 0           # 0: all, 1: feat1 (phinyomark's), 2: feat2 (golz's)
        self.CV = 5                # cross validation checks
        self.numfeat = 10          # number of features to show
        self.nfeat = 1000          # number of features to keep
        ###### Initialize necessary names and paths
        self.datapath = 'data/'
        self.datafile = self.datapath+'dataset.npz'
        self.validfile = self.datapath+'validation.mat'
        self.featpath = self.datapath+'features/'+str(self.window)+'_'+str(self.shift)+'/'
        self.allfeatpath = self.featpath+'AllFeatures/'
        self.prefeatname = 'prefeatures'+'_'+str(self.window)+'_'+str(self.shift)+'_'+str(self.samplesperdataset)
        self.prefeatfile = self.featpath+self.prefeatname+'.npz'
        self.featname = 'features'+'_'+str(self.window)+'_'+str(self.shift)+'_'+str(self.samplesperdataset)
        self.featfile = self.featpath+self.featname+'.npz'
        self.validfeatname = 'valid'+self.featname
        self.validfeatfile = self.featpath+self.validfeatname+'.npz'
        self.surffile = self.featpath+self.featname+'_2fing_6surf.npz'
        self.XYfile = self.featpath+self.featname+'_XY.npz'
        self.XYsplitfile = self.featpath+self.featname+'_XYsplit.npz'
        self.validsurffile = self.featpath+self.validfeatname+'_2fing_6surf.npz'
        self.validXYfile = self.featpath+self.validfeatname+'_XY.npz'
        self.validXYsplitfile = self.featpath+self.validfeatname+'_XYsplit.npz'
        self.respath = self.datapath+'results'
        self.toolfile = self.datapath+'bargraph.zip'
        self.toolpath = self.datapath+'bargraph-rel_4_8/'
        self.tool = './'+self.toolpath+'bargraph.pl'
######### INITIALIZE OBJECT-STRUCT WITH PARAMETERS AND PASS THEM TO ML MODULE ########
c = struct()
m = ml(c)

DOWNLOAD NECESSARY FILES


In [3]:
download_required_files()


Necessary  data/dataset.npz  already here!
Necessary  data/validation.mat  already here!
Necessary  data/features/1024_20/features_1024_20_10000.npz  already here!
Necessary  data/features/1024_20/validfeatures_1024_20_10000.npz  already here!
Desired trained models for 1 surface found!
Desired trained models for 2 surface found!
Desired trained models for 3 surface found!
Desired trained models for 4 surface found!
Desired trained models for 5 surface found!
Downloaded 1.2 GB of content in total!

TRAINING PROCEDURE


In [4]:
# necessary steps before training
f,l,fd,member,m1,m2 = data_prep(c.datafile)                      # read input force and labels
prefeat = compute_prefeat(f)                                     # compute corresponding prefeatures
features, labels = feature_extraction(prefeat,member,c.featfile) # feature extraction from prefeatures
avg_feat_comp_time(prefeat)                                      # average feature extraction time
new_labels = label_cleaning(prefeat,labels,member)               # trim labels, around change points
X,Y,Yn,Xsp,Ysp = computeXY(features,labels,new_labels,m1,m2,
                           c.XYfile,c.XYsplitfile)               # compute data and labels, trimmed and untrimmed
surf, surfla = computeXY_persurf(Xsp,Ysp,c.surffile)             # compute per surface data and labels
# training and offline testing
train_1_surface(surf,surfla)                                     # training of all combinations per 1 surface
train_2_surface(surf,surfla)                                     # training of all combinations per 2 surfaces
train_3_surface(surf,surfla)                                     # training of all combinations per 3 surfaces
train_4_surface(surf,surfla)                                     # training of all combinations per 4 surfaces
train_5_surface(surf,surfla)                                     # training of all combinations per 5 surfaces


---------------------------- LOADING DATA and COMPUTING NECESSARY STRUCTS ----------------------------
1 -> f1: (36,) (36,) (36, 4)
2 -> f2: (36,) (36,) (36, 4)
3 -> f: (72,) (72,) (72, 4)
4 -> m1,m2: 36 36 1.0 1.0
5 -> f=f+l: (72,) : [(345002, 4), (105001, 4), (210001, 4), (225002, 4), (130001, 4), (65001, 4), (195001, 4), (65001, 4), (130001, 4), (195001, 4), (65001, 4), (130001, 4), (225002, 4), (65001, 4), (130001, 4), (195001, 4), (65001, 4), (130001, 4), (75001, 4), (130001, 4), (195001, 4), (195001, 4), (130001, 4), (65001, 4), (65001, 4), (130001, 4), (195001, 4), (195001, 4), (130001, 4), (65001, 4), (65001, 4), (130001, 4), (195001, 4), (130001, 4), (195001, 4), (65001, 4), (345002, 4), (105001, 4), (210001, 4), (225002, 4), (130001, 4), (65001, 4), (195001, 4), (65001, 4), (130001, 4), (195001, 4), (65001, 4), (130001, 4), (225002, 4), (65001, 4), (130001, 4), (195001, 4), (65001, 4), (130001, 4), (75001, 4), (130001, 4), (195001, 4), (195001, 4), (130001, 4), (65001, 4), (65001, 4), (130001, 4), (195001, 4), (195001, 4), (130001, 4), (65001, 4), (65001, 4), (130001, 4), (195001, 4), (130001, 4), (195001, 4), (65001, 4)]
7 -> fscaled:  (72,) (72,) (72,) (72, 5)
--------------------------------------- COMPUTING PREFEATURES ----------------------------------------
(72,) : [(345002, 2), (105001, 2), (210001, 2), (225002, 2), (130001, 2), (65001, 2), (195001, 2), (65001, 2), (130001, 2), (195001, 2), (65001, 2), (130001, 2), (225002, 2), (65001, 2), (130001, 2), (195001, 2), (65001, 2), (130001, 2), (75001, 2), (130001, 2), (195001, 2), (195001, 2), (130001, 2), (65001, 2), (65001, 2), (130001, 2), (195001, 2), (195001, 2), (130001, 2), (65001, 2), (65001, 2), (130001, 2), (195001, 2), (130001, 2), (195001, 2), (65001, 2), (345002, 2), (105001, 2), (210001, 2), (225002, 2), (130001, 2), (65001, 2), (195001, 2), (65001, 2), (130001, 2), (195001, 2), (65001, 2), (130001, 2), (225002, 2), (65001, 2), (130001, 2), (195001, 2), (65001, 2), (130001, 2), (75001, 2), (130001, 2), (195001, 2), (195001, 2), (130001, 2), (65001, 2), (65001, 2), (130001, 2), (195001, 2), (195001, 2), (130001, 2), (65001, 2), (65001, 2), (130001, 2), (195001, 2), (130001, 2), (195001, 2), (65001, 2)]
---------------------------------------- FEATURE EXTRACTION ------------------------------------------
Features FOUND PRECOMPUTED! Feature Loading DONE in: 3.05684399605 seconds 
features:  (72,) , labels:  (72,)
------------------------------------ AVG FEATURE COMPUTATION TIME ------------------------------------
Avg feature computation time (millisec):  2.20874611537
----------- KEEPING LABEL's PURE (STABLE, SLIP) PHASE PARTS (TRIMMING AROUND CHANGE POINTS)-----------
new_labels:  (72,)
----------------------------- COMPUTING X,Y for CLASSIFIERS' INPUT -----------------------------------
XY files FOUND PRECOMPUTED!
X,Y [0,1,2]:  (9935, 3107) (9935,) (9935, 3107) (9935,) (9935, 3107) (9935,)
Xsp,Ysp [0,1,2]:  (8826, 3107) (8826,) (8826, 3107) (8826,) (8826, 3107) (8826,)
------------------------ COMPUTING X,Y per surface CLASSIFIERS' INPUT --------------------------------
(4, 6, 1) (1470, 6, 1)
-------------------------- TRAINING all combinations per 1 surface -----------------------------------
-------------------------- TRAINING all combinations per 2 surfaces ----------------------------------
-------------------------- TRAINING all combinations per 3 surfaces ----------------------------------
-------------------------- TRAINING all combinations per 4 surfaces ----------------------------------
-------------------------- TRAINING all combinations per 5 surfaces ----------------------------------

RESULT REPORTING


In [5]:
# generate files with stats
bargraph_perf_gen1(6)
bargraph_perf_gen2(6)
bargraph_perf_gen3(6)
bargraph_perf_gen4(6)
bargraph_perf_gen5(6)
# use the bargraph tool to plot graphs from generated files
# -left column cross-accuracy (trained on one, tested on all the others), 
# -right column self-accuracy (trained and tested on the same)
# -each row i represents training only with i surfaces.
# -each stack represents a training group, each bar represents a subfeatureset(AFFT,FREQ,TIME,BOTH)
# -blue,green,yellow,red : TP,TN,FN,FP
plt.figure(figsize=(20,40))
for i in range(5):
    make_bargraphs_from_perf(i)


---------------------------- Generating perf files for 1 surface -------------------------------------
---------------------------- Generating perf files for 2 surfaces ------------------------------------
---------------------------- Generating perf files for 3 surfaces ------------------------------------
---------------------------- Generating perf files for 4 surfaces ------------------------------------
---------------------------- Generating perf files for 5 surfaces ------------------------------------
---------------------------- Generating bar graphs for 1 surfaces ------------------------------------
---------------------------- Generating bar graphs for 2 surfaces ------------------------------------
---------------------------- Generating bar graphs for 3 surfaces ------------------------------------
---------------------------- Generating bar graphs for 4 surfaces ------------------------------------
---------------------------- Generating bar graphs for 5 surfaces ------------------------------------

ONLINE TESTING PROCEDURE


In [6]:
# same necessary steps as in training for data preparation
f,l,fd,member,m1,m2 = data_prep(c.validfile)
prefeat = compute_prefeat(f)
features, labels = feature_extraction(prefeat, member, c.validfeatfile, 'validfeat_')
new_labels = label_cleaning(prefeat,labels,member)
X,Y,Yn,Xsp,Ysp = computeXY(features,labels,new_labels,m1,m2,c.validXYfile,c.validXYsplitfile)
surf, surfla = computeXY_persurf(Xsp,Ysp,c.validsurffile)


---------------------------- LOADING DATA and COMPUTING NECESSARY STRUCTS ----------------------------
1 -> f1: (1, 1) (1, 1) (1, 1)
2 -> f2: (1, 1) (1, 1) (1, 1)
3 -> f: (2, 1) (2, 1) (2, 1)
4 -> m1,m2: 1 1 1.0 1.0
5 -> f=f+l: (2, 65000, 4) : [(65000, 4), (65000, 4)]
7 -> fscaled:  (2, 65000, 4) (2,) (2,) (2, 2)
--------------------------------------- COMPUTING PREFEATURES ----------------------------------------
(2,) : [(65000, 2), (65000, 2)]
---------------------------------------- FEATURE EXTRACTION ------------------------------------------
Features FOUND PRECOMPUTED! Feature Loading DONE in: 1.34288787842 seconds 
features:  (2,) , labels:  (2,)
----------- KEEPING LABEL's PURE (STABLE, SLIP) PHASE PARTS (TRIMMING AROUND CHANGE POINTS)-----------
new_labels:  (2,)
----------------------------- COMPUTING X,Y for CLASSIFIERS' INPUT -----------------------------------
XY files FOUND PRECOMPUTED!
X,Y [0,1,2]:  (3199, 3107) (3199,) (3199, 3107) (3199,) (6398, 3107) (6398,)
Xsp,Ysp [0,1,2]:  (2769, 3107) (2769,) (2769, 3107) (2769,) (5538, 3107) (5538,)
------------------------ COMPUTING X,Y per surface CLASSIFIERS' INPUT --------------------------------
(4, 6, 1) (922, 6, 1)

VISUALIZING ONLINE TESTING PROCEDURE


In [7]:
window=c.window
subfeats = ['AFFT','FREQ','TIME','BOTH']
feats = ['fnorm','ftfn','fnormftfn']
matplotlib.rcParams['text.usetex'] = True

fileid = filename1(0,3,0,5)
fileidb = filename1(0,0,0,5)
fileid5 = filename5(0,3,0,1,2,3,4,5)
fileid5b = filename5(0,0,0,1,2,3,4,5)
model = np.load(fileid)['model'][0]
modelb = np.load(fileidb)['model'][0]
model5 = np.load(fileid5)['model'][0]
model5b = np.load(fileid5b)['model'][0]
Yout = model.predict(X[0])
Youtb = modelb.predict(Xsp[0][:,-window-2:-window/2-1])
Yout5 = model5.predict(Xsp[0])
Yout5b = model5b.predict(Xsp[0][:,-window-2:-window/2-1])
print Yout.shape, Yout5.shape, Yout5b.shape
plt.rc('text', usetex=True)
plt.rc('axes', linewidth=2)
plt.rc('font', weight='bold')
plt.rcParams['text.latex.preamble'] = [r'\usepackage{sfmath} \boldmath']
offset = 2000-window
endset = 2650
skipf = 20
skipy = 15
ax = plt.figure(figsize=(20,10))
tf = np.linalg.norm(f[0][offset+window::skipf,:3][:endset],axis=1)
p1, = plt.plot(tf/max(tf),linewidth=5)
ty = Yout[offset/skipf:][:endset]+0.02
print tf.shape, ty.shape
p = plt.scatter(range(len(tf))[::skipy],ty[::skipy],color='red',s=30)
plt.hold
plt.text(100, 0.15, r'\textbf{Stable}', ha="center", va="center", rotation=0,
            size=25)
plt.text(1000, 0.85, r'\textbf{Slip}', ha="center", va="center", rotation=0,
            size=25)
plt.annotate('', fontsize=10, xy=(100, 0.05), xytext=(100, 0.12),
            arrowprops=dict(facecolor='black', shrink=0.05))
plt.annotate('', xy=(1000, 0.98), xytext=(1000, 0.9),
            arrowprops=dict(facecolor='black', shrink=0.05))
plt.text(400, 0.55, r'\textbf{P1}', ha="center", va="center", rotation=0,
            size=25)
plt.axvline(x=810,linestyle='dashed',color='black',linewidth=5)
plt.text(1000, 0.55, r'\textbf{P2}', ha="center", va="center", rotation=0,
            size=25)
plt.axvline(x=1200,linestyle='dashed',color='black',linewidth=5)
plt.text(1250, 0.55, r'\textbf{P3}', ha="center", va="center", rotation=0,
            size=25)
plt.axvline(x=1335,linestyle='dashed',color='black',linewidth=5)
plt.text(1385, 0.25, r'\textbf{P4}', ha="center", va="center", rotation=0,
            size=25)
plt.axvline(x=1445,linestyle='dashed',color='black',linewidth=5)
plt.text(1650, 0.55, r'\textbf{P1}', ha="center", va="center", rotation=0,
            size=25)
plt.axvline(x=1830,linestyle='dashed',color='black',linewidth=5)
plt.text(2000, 0.55, r'\textbf{P2}', ha="center", va="center", rotation=0,
            size=25)
plt.axvline(x=2200,linestyle='dashed',color='black',linewidth=5)
plt.text(2250, 0.55, r'\textbf{P3}', ha="center", va="center", rotation=0,
            size=25)
plt.axvline(x=2330,linestyle='dashed',color='black',linewidth=5)
plt.text(2385, 0.25, r'\textbf{P4}', ha="center", va="center", rotation=0,
            size=25)
plt.axvline(x=2440,linestyle='dashed',color='black',linewidth=5)
plt.text(2540, 0.55, r'\textbf{P1}', ha="center", va="center", rotation=0,
            size=25)
plt.xlabel(r't ($1e^{-2} sec$)',fontsize=35)
# plt.yticks([])
plt.legend([p1,p],[r'$|\textbf{f}|$',r'\textbf{out1}'],loc=2, prop={'size': 35})
plt.tick_params(labelsize=20)
plt.tight_layout()
savefig(c.datapath+'validation.pdf', bbox_inches='tight')


(3199,) (2769,) (2769,)
(2650,) (2650,)

Testing ATI Datasets (No scaling)


In [8]:
tsd = ['ati_new_fd1.0N_kp3.5_152Hz_validation',
       'ati_new_fd1.5N_kp3_152Hz_validation',
       'ati_new_fd1.0N_kp3.5_326Hz_validation',
       'ati_new_fd1.5N_kp3_326Hz_validation',
       'ati_new_fd1.0N_kp3.5_836Hz_validation',
       'ati_new_fd1.5N_kp3.5_836Hz_validation',
       'ati_new_fd1N_kp3_nofilt_validation',
       'ati_new_fd1.5N_kp3_nofilt_validation']
for sc in [1.0]:
    print "-------- SCALING = ",sc,"--------"
    for i in range(len(tsd)):
        ####### NEWER TESTING DATA FROM ATI F/T SENSOR TRANSLATIONAL CASE
        prediction(tsd[i]+'.mat')
        ####### NEWER TESTING DATA FROM ATI F/T SENSOR ROTATIONAL CASE
        prediction(tsd[i]+'_rot.mat')


-------- SCALING =  1.0 --------
Filename for prediction: ati_new_fd1.0N_kp3.5_152Hz_validation.mat
Accuracy for surface  0 0.907877169559 0.890520694259
F1score for surface   0 0.917365269461 0.890666666667
TN(stable) and TP(slip) for surface  0 0.85100286533 0.9575 | 0.954154727794 0.835
Accuracy for surface  1 0.877169559413 0.949265687583
F1score for surface   1 0.885572139303 0.950131233596
TN(stable) and TP(slip) for surface  1 0.862464183381 0.89 | 1.0 0.905
Accuracy for surface  2 0.907877169559 0.711615487316
F1score for surface   2 0.914072229141 0.630136986301
TN(stable) and TP(slip) for surface  2 0.896848137536 0.9175 | 1.0 0.46
Accuracy for surface  3 0.891855807744 0.811748998665
F1score for surface   3 0.896551724138 0.79234167894
TN(stable) and TP(slip) for surface  3 0.908309455587 0.8775 | 0.971346704871 0.6725
Accuracy for surface  4 0.851802403204 0.762349799733
F1score for surface   4 0.850605652759 0.713826366559
TN(stable) and TP(slip) for surface  4 0.922636103152 0.79 | 1.0 0.555
Accuracy for surface  5 0.799732977303 0.630173564753
F1score for surface   5 0.769230769231 0.470363288719
TN(stable) and TP(slip) for surface  5 1.0 0.625 | 1.0 0.3075
======================================================================================
Accuracy for dataset    0.87271918113 0.792612372052
F1score for dataset    0.876136855782 0.762244897959
TN(stable) and TP(slip) for dataset  0.906876790831 0.842916666667 | 0.987583572111 0.6225
======================================================================================
Filename for prediction: ati_new_fd1.0N_kp3.5_152Hz_validation_rot.mat
Accuracy for surface  0 0.895679662803 0.652265542677
F1score for surface   0 0.875471698113 0.297872340426
TN(stable) and TP(slip) for surface  0 0.914389799636 0.87 | 1.0 0.175
Accuracy for surface  1 0.815595363541 0.676501580611
F1score for surface   1 0.788902291918 0.399217221135
TN(stable) and TP(slip) for surface  1 0.814207650273 0.8175 | 0.983606557377 0.255
Accuracy for surface  2 0.790305584826 0.620653319283
F1score for surface   2 0.743225806452 0.237288135593
TN(stable) and TP(slip) for surface  2 0.841530054645 0.72 | 0.970856102004 0.14
Accuracy for surface  3 0.767123287671 0.640674394099
F1score for surface   3 0.728834355828 0.257080610022
TN(stable) and TP(slip) for surface  3 0.785063752277 0.7425 | 1.0 0.1475
Accuracy for surface  4 0.700737618546 0.626975763962
F1score for surface   4 0.713131313131 0.206278026906
TN(stable) and TP(slip) for surface  4 0.568306010929 0.8825 | 1.0 0.115
Accuracy for surface  5 0.717597471022 0.608008429926
F1score for surface   5 0.662468513854 0.169642857143
TN(stable) and TP(slip) for surface  5 0.761384335155 0.6575 | 0.981785063752 0.095
======================================================================================
Accuracy for dataset    0.781173164735 0.63751317176
F1score for dataset    0.750700280112 0.264433357092
TN(stable) and TP(slip) for dataset  0.780813600486 0.781666666667 | 0.989374620522 0.154583333333
======================================================================================
Filename for prediction: ati_new_fd1.5N_kp3_152Hz_validation.mat
Accuracy for surface  0 0.739652870494 0.957276368491
F1score for surface   0 0.792773645058 0.958333333333
TN(stable) and TP(slip) for surface  0 0.518624641834 0.9325 | 1.0 0.92
Accuracy for surface  1 0.874499332443 0.946595460614
F1score for surface   1 0.886198547215 0.947368421053
TN(stable) and TP(slip) for surface  1 0.828080229226 0.915 | 1.0 0.9
Accuracy for surface  2 0.854472630174 0.903871829105
F1score for surface   2 0.870083432658 0.901098901099
TN(stable) and TP(slip) for surface  2 0.787965616046 0.9125 | 1.0 0.82
Accuracy for surface  3 0.86782376502 0.889185580774
F1score for surface   3 0.8788249694 0.884239888424
TN(stable) and TP(slip) for surface  3 0.833810888252 0.8975 | 1.0 0.7925
Accuracy for surface  4 0.929238985314 0.855807743658
F1score for surface   4 0.93399750934 0.846153846154
TN(stable) and TP(slip) for surface  4 0.919770773639 0.9375 | 0.985673352436 0.7425
Accuracy for surface  5 0.891855807744 0.666221628838
F1score for surface   5 0.887343532684 0.545454545455
TN(stable) and TP(slip) for surface  5 1.0 0.7975 | 1.0 0.375
======================================================================================
Accuracy for dataset    0.859590565198 0.869826435247
F1score for dataset    0.87239635996 0.861538461538
TN(stable) and TP(slip) for dataset  0.8147086915 0.89875 | 0.997612225406 0.758333333333
======================================================================================
Filename for prediction: ati_new_fd1.5N_kp3_152Hz_validation_rot.mat
Accuracy for surface  0 0.783983140148 0.722866174921
F1score for surface   0 0.753901560624 0.593508500773
TN(stable) and TP(slip) for surface  0 0.783242258652 0.785 | 0.899817850638 0.48
Accuracy for surface  1 0.860906217071 0.875658587987
F1score for surface   1 0.832911392405 0.826979472141
TN(stable) and TP(slip) for surface  1 0.888888888889 0.8225 | 1.0 0.705
Accuracy for surface  2 0.842992623815 0.648050579557
F1score for surface   2 0.810191082803 0.286324786325
TN(stable) and TP(slip) for surface  2 0.87795992714 0.795 | 0.998178506375 0.1675
Accuracy for surface  3 0.768177028451 0.801896733404
F1score for surface   3 0.744186046512 0.692810457516
TN(stable) and TP(slip) for surface  3 0.744990892532 0.8 | 1.0 0.53
Accuracy for surface  4 0.879873551106 0.822971548999
F1score for surface   4 0.861313868613 0.735015772871
TN(stable) and TP(slip) for surface  4 0.876138433515 0.885 | 0.998178506375 0.5825
Accuracy for surface  5 0.668071654373 0.620653319283
F1score for surface   5 0.595635430039 0.181818181818
TN(stable) and TP(slip) for surface  5 0.732240437158 0.58 | 1.0 0.1
======================================================================================
Accuracy for dataset    0.800667369161 0.748682824025
F1score for dataset    0.766892585747 0.589147286822
TN(stable) and TP(slip) for dataset  0.817243472981 0.777916666667 | 0.982695810565 0.4275
======================================================================================
Filename for prediction: ati_new_fd1.0N_kp3.5_326Hz_validation.mat
Accuracy for surface  0 0.849132176235 0.744993324433
F1score for surface   0 0.86996547756 0.781214203895
TN(stable) and TP(slip) for surface  0 0.739255014327 0.945 | 0.621776504298 0.8525
Accuracy for surface  1 0.890520694259 0.877169559413
F1score for surface   1 0.895408163265 0.870786516854
TN(stable) and TP(slip) for surface  1 0.905444126074 0.8775 | 0.994269340974 0.775
Accuracy for surface  2 0.851802403204 0.642189586115
F1score for surface   2 0.867065868263 0.512727272727
TN(stable) and TP(slip) for surface  2 0.790830945559 0.905 | 0.974212034384 0.3525
Accuracy for surface  3 0.927903871829 0.777036048064
F1score for surface   3 0.929133858268 0.736176935229
TN(stable) and TP(slip) for surface  3 0.977077363897 0.885 | 1.0 0.5825
Accuracy for surface  4 0.886515353805 0.628838451268
F1score for surface   4 0.886817576565 0.505338078292
TN(stable) and TP(slip) for surface  4 0.948424068768 0.8325 | 0.942693409742 0.355
Accuracy for surface  5 0.781041388518 0.576769025367
F1score for surface   5 0.745341614907 0.382066276803
TN(stable) and TP(slip) for surface  5 0.988538681948 0.6 | 0.957020057307 0.245
======================================================================================
Accuracy for dataset    0.864485981308 0.707832665777
F1score for dataset    0.868891280947 0.658339838668
TN(stable) and TP(slip) for dataset  0.891595033429 0.840833333333 | 0.914995224451 0.527083333333
======================================================================================
Filename for prediction: ati_new_fd1.0N_kp3.5_326Hz_validation_rot.mat
Accuracy for surface  0 0.900948366702 0.662802950474
F1score for surface   0 0.875 0.466666666667
TN(stable) and TP(slip) for surface  0 0.95810564663 0.8225 | 0.890710382514 0.35
Accuracy for surface  1 0.893572181243 0.660695468915
F1score for surface   1 0.857946554149 0.356
TN(stable) and TP(slip) for surface  1 0.989071038251 0.7625 | 0.979963570128 0.2225
Accuracy for surface  2 0.828240252898 0.659641728135
F1score for surface   2 0.780026990553 0.444061962134
TN(stable) and TP(slip) for surface  2 0.905282331512 0.7225 | 0.905282331512 0.3225
Accuracy for surface  3 0.744994731296 0.659641728135
F1score for surface   3 0.71327014218 0.384761904762
TN(stable) and TP(slip) for surface  3 0.739526411658 0.7525 | 0.956284153005 0.2525
Accuracy for surface  4 0.895679662803 0.532139093783
F1score for surface   4 0.88200238379 0.125984251969
TN(stable) and TP(slip) for surface  4 0.874316939891 0.925 | 0.861566484517 0.08
Accuracy for surface  5 0.623814541623 0.547945205479
F1score for surface   5 0.520805369128 0.19512195122
TN(stable) and TP(slip) for surface  5 0.724954462659 0.485 | 0.852459016393 0.13
======================================================================================
Accuracy for dataset    0.814541622761 0.62047769582
F1score for dataset    0.772020725389 0.334462580844
TN(stable) and TP(slip) for dataset  0.865209471767 0.745 | 0.907710989678 0.22625
======================================================================================
Filename for prediction: ati_new_fd1.5N_kp3_326Hz_validation.mat
Accuracy for surface  0 0.874499332443 0.929238985314
F1score for surface   0 0.886746987952 0.930171277997
TN(stable) and TP(slip) for surface  0 0.822349570201 0.92 | 0.982808022923 0.8825
Accuracy for surface  1 0.71562082777 0.927903871829
F1score for surface   1 0.776025236593 0.929319371728
TN(stable) and TP(slip) for surface  1 0.478510028653 0.9225 | 0.974212034384 0.8875
Accuracy for surface  2 0.794392523364 0.911882510013
F1score for surface   2 0.8285077951 0.912234042553
TN(stable) and TP(slip) for surface  2 0.638968481375 0.93 | 0.974212034384 0.8575
Accuracy for surface  3 0.894526034713 0.893190921228
F1score for surface   3 0.901618929016 0.888888888889
TN(stable) and TP(slip) for surface  3 0.882521489971 0.905 | 1.0 0.8
Accuracy for surface  4 0.922563417891 0.866488651535
F1score for surface   4 0.925449871465 0.858757062147
TN(stable) and TP(slip) for surface  4 0.948424068768 0.9 | 0.988538681948 0.76
Accuracy for surface  5 0.894526034713 0.695594125501
F1score for surface   5 0.890429958391 0.601398601399
TN(stable) and TP(slip) for surface  5 1.0 0.8025 | 1.0 0.43
======================================================================================
Accuracy for dataset    0.849354695149 0.870716510903
F1score for dataset    0.864083517366 0.864093567251
TN(stable) and TP(slip) for dataset  0.795128939828 0.896666666667 | 0.986628462273 0.769583333333
======================================================================================
Filename for prediction: ati_new_fd1.5N_kp3_326Hz_validation_rot.mat
Accuracy for surface  0 0.815595363541 0.702845100105
F1score for surface   0 0.789410348977 0.455598455598
TN(stable) and TP(slip) for surface  0 0.812386156648 0.82 | 1.0 0.295
Accuracy for surface  1 0.840885142255 0.840885142255
F1score for surface   1 0.809102402023 0.767334360555
TN(stable) and TP(slip) for surface  1 0.870673952641 0.8 | 1.0 0.6225
Accuracy for surface  2 0.794520547945 0.613277133825
F1score for surface   2 0.757160647572 0.290135396518
TN(stable) and TP(slip) for surface  2 0.819672131148 0.76 | 0.92349726776 0.1875
Accuracy for surface  3 0.869336143309 0.662802950474
F1score for surface   3 0.834666666667 0.333333333333
TN(stable) and TP(slip) for surface  3 0.932604735883 0.7825 | 1.0 0.2
Accuracy for surface  4 0.940990516333 0.800842992624
F1score for surface   4 0.926315789474 0.690671031097
TN(stable) and TP(slip) for surface  4 0.985428051002 0.88 | 1.0 0.5275
Accuracy for surface  5 0.68387776607 0.63645943098
F1score for surface   5 0.61038961039 0.270613107822
TN(stable) and TP(slip) for surface  5 0.754098360656 0.5875 | 0.983606557377 0.16
======================================================================================
Accuracy for dataset    0.824200913242 0.709518791711
F1score for dataset    0.787247608927 0.490763546798
TN(stable) and TP(slip) for dataset  0.86247723133 0.771666666667 | 0.984517304189 0.332083333333
======================================================================================
Filename for prediction: ati_new_fd1.0N_kp3.5_836Hz_validation.mat
Accuracy for surface  0 0.815754339119 0.781041388518
F1score for surface   0 0.843891402715 0.798525798526
TN(stable) and TP(slip) for surface  0 0.681948424069 0.9325 | 0.744985673352 0.8125
Accuracy for surface  1 0.866488651535 0.710280373832
F1score for surface   1 0.875621890547 0.703956343793
TN(stable) and TP(slip) for surface  1 0.85100286533 0.88 | 0.785100286533 0.645
Accuracy for surface  2 0.865153538051 0.611481975968
F1score for surface   2 0.87166454892 0.561085972851
TN(stable) and TP(slip) for surface  2 0.873925501433 0.8575 | 0.779369627507 0.465
Accuracy for surface  3 0.882510013351 0.694259012016
F1score for surface   3 0.882666666667 0.69344042838
TN(stable) and TP(slip) for surface  3 0.945558739255 0.8275 | 0.747851002865 0.6475
Accuracy for surface  4 0.893190921228 0.699599465955
F1score for surface   4 0.892761394102 0.68443197756
TN(stable) and TP(slip) for surface  4 0.962750716332 0.8325 | 0.80229226361 0.61
Accuracy for surface  5 0.833110814419 0.420560747664
F1score for surface   5 0.814814814815 0.44923857868
TN(stable) and TP(slip) for surface  5 1.0 0.6875 | 0.395415472779 0.4425
======================================================================================
Accuracy for dataset    0.859368046284 0.652870493992
F1score for dataset    0.863969005596 0.650067294751
TN(stable) and TP(slip) for dataset  0.885864374403 0.83625 | 0.709169054441 0.60375
======================================================================================
Filename for prediction: ati_new_fd1.0N_kp3.5_836Hz_validation_rot.mat
Accuracy for surface  0 0.820864067439 0.575342465753
F1score for surface   0 0.768392370572 0.351046698873
TN(stable) and TP(slip) for surface  0 0.905282331512 0.705 | 0.795992714026 0.2725
Accuracy for surface  1 0.853530031612 0.668071654373
F1score for surface   1 0.804500703235 0.554455445545
TN(stable) and TP(slip) for surface  1 0.954462659381 0.715 | 0.79781420765 0.49
Accuracy for surface  2 0.837723919916 0.4531085353
F1score for surface   2 0.765957446809 0.34552332913
TN(stable) and TP(slip) for surface  2 0.989071038251 0.63 | 0.533697632058 0.3425
Accuracy for surface  3 0.781875658588 0.661749209694
F1score for surface   3 0.693333333333 0.566801619433
TN(stable) and TP(slip) for surface  3 0.925318761384 0.585 | 0.761384335155 0.525
Accuracy for surface  4 0.903055848261 0.59114857745
F1score for surface   4 0.879895561358 0.328719723183
TN(stable) and TP(slip) for surface  4 0.947176684882 0.8425 | 0.848816029144 0.2375
Accuracy for surface  5 0.625922023182 0.641728134879
F1score for surface   5 0.484760522496 0.566326530612
TN(stable) and TP(slip) for surface  5 0.777777777778 0.4175 | 0.704918032787 0.555
======================================================================================
Accuracy for dataset    0.8038285915 0.598524762908
F1score for dataset    0.736120954406 0.458806818182
TN(stable) and TP(slip) for dataset  0.916514875531 0.649166666667 | 0.74043715847 0.40375
======================================================================================
Filename for prediction: ati_new_fd1.5N_kp3.5_836Hz_validation.mat
Accuracy for surface  0 0.802561366062 0.827107790822
F1score for surface   0 0.839549002602 0.871632329635
TN(stable) and TP(slip) for surface  0 0.767908309456 0.823129251701 | 0.644699140401 0.93537414966
Accuracy for surface  1 0.837780149413 0.93916755603
F1score for surface   1 0.866197183099 0.949779735683
TN(stable) and TP(slip) for surface  1 0.839541547278 0.836734693878 | 0.977077363897 0.916666666667
Accuracy for surface  2 0.918890074707 0.836712913554
F1score for surface   2 0.933333333333 0.862780269058
TN(stable) and TP(slip) for surface  2 0.942693409742 0.904761904762 | 0.868194842407 0.818027210884
Accuracy for surface  3 0.849519743863 0.886872998933
F1score for surface   3 0.867605633803 0.906690140845
TN(stable) and TP(slip) for surface  3 0.957020057307 0.785714285714 | 0.905444126074 0.875850340136
Accuracy for surface  4 0.931696905016 0.797225186766
F1score for surface   4 0.943462897527 0.833040421793
TN(stable) and TP(slip) for surface  4 0.971346704871 0.908163265306 | 0.78223495702 0.80612244898
Accuracy for surface  5 0.779082177161 0.614727854856
F1score for surface   5 0.818580192813 0.565583634176
TN(stable) and TP(slip) for surface  5 0.753581661891 0.794217687075 | 0.977077363897 0.399659863946
======================================================================================
Accuracy for dataset    0.85325506937 0.81696905016
F1score for dataset    0.878084823408 0.844491461387
TN(stable) and TP(slip) for dataset  0.872015281757 0.842120181406 | 0.859121298949 0.791950113379
======================================================================================
Filename for prediction: ati_new_fd1.5N_kp3.5_836Hz_validation_rot.mat
Accuracy for surface  0 0.816 0.6424
F1score for surface   0 0.785447761194 0.475967174678
TN(stable) and TP(slip) for surface  0 0.998333333333 0.647692307692 | 1.0 0.312307692308
Accuracy for surface  1 0.8 0.7272
F1score for surface   1 0.762808349146 0.648815653965
TN(stable) and TP(slip) for surface  1 0.996666666667 0.618461538462 | 0.99 0.484615384615
Accuracy for surface  2 0.8216 0.632
F1score for surface   2 0.799279927993 0.463869463869
TN(stable) and TP(slip) for surface  2 0.971666666667 0.683076923077 | 0.985 0.306153846154
Accuracy for surface  3 0.728 0.6296
F1score for surface   3 0.649484536082 0.450771055753
TN(stable) and TP(slip) for surface  3 0.991666666667 0.484615384615 | 0.995 0.292307692308
Accuracy for surface  4 0.8904 0.8504
F1score for surface   4 0.896447467876 0.849071832123
TN(stable) and TP(slip) for surface  4 0.866666666667 0.912307692308 | 0.895 0.809230769231
Accuracy for surface  5 0.712 0.536
F1score for surface   5 0.62577962578 0.207650273224
TN(stable) and TP(slip) for surface  5 0.981666666667 0.463076923077 | 0.99 0.116923076923
======================================================================================
Accuracy for dataset    0.794666666667 0.6696
F1score for dataset    0.762784966112 0.549126637555
TN(stable) and TP(slip) for dataset  0.967777777778 0.634871794872 | 0.975833333333 0.386923076923
======================================================================================
Filename for prediction: ati_new_fd1N_kp3_nofilt_validation.mat
Accuracy for surface  0 0.866488651535 0.937249666222
F1score for surface   0 0.880952380952 0.939510939511
TN(stable) and TP(slip) for surface  0 0.799426934097 0.925 | 0.965616045845 0.9125
Accuracy for surface  1 0.859813084112 0.891855807744
F1score for surface   1 0.874851013111 0.89628681178
TN(stable) and TP(slip) for surface  1 0.793696275072 0.9175 | 0.9111747851 0.875
Accuracy for surface  2 0.883845126836 0.643524699599
F1score for surface   2 0.89138576779 0.659872611465
TN(stable) and TP(slip) for surface  2 0.873925501433 0.8925 | 0.638968481375 0.6475
Accuracy for surface  3 0.913217623498 0.837116154873
F1score for surface   3 0.915474642393 0.829131652661
TN(stable) and TP(slip) for surface  3 0.951289398281 0.88 | 0.948424068768 0.74
Accuracy for surface  4 0.894526034713 0.761014686248
F1score for surface   4 0.897800776197 0.742446043165
TN(stable) and TP(slip) for surface  4 0.925501432665 0.8675 | 0.893982808023 0.645
Accuracy for surface  5 0.879839786382 0.580774365821
F1score for surface   5 0.874651810585 0.38188976378
TN(stable) and TP(slip) for surface  5 0.988538681948 0.785 | 0.968481375358 0.2425
======================================================================================
Accuracy for dataset    0.882955051179 0.775255896751
F1score for dataset    0.889029535865 0.762910798122
TN(stable) and TP(slip) for dataset  0.888729703916 0.877916666667 | 0.887774594078 0.677083333333
======================================================================================
Filename for prediction: ati_new_fd1N_kp3_nofilt_validation_rot.mat
Accuracy for surface  0 0.876712328767 0.644889357218
F1score for surface   0 0.838620689655 0.275268817204
TN(stable) and TP(slip) for surface  0 0.96174863388 0.76 | 0.998178506375 0.16
Accuracy for surface  1 0.859852476291 0.765015806112
F1score for surface   1 0.827943078913 0.659541984733
TN(stable) and TP(slip) for surface  1 0.903460837887 0.8 | 0.928961748634 0.54
Accuracy for surface  2 0.81875658588 0.598524762908
F1score for surface   2 0.752161383285 0.090692124105
TN(stable) and TP(slip) for surface  2 0.939890710383 0.6525 | 1.0 0.0475
Accuracy for surface  3 0.866174920969 0.719704952582
F1score for surface   3 0.821879382889 0.501872659176
TN(stable) and TP(slip) for surface  3 0.963570127505 0.7325 | 1.0 0.335
Accuracy for surface  4 0.886195995785 0.761854583772
F1score for surface   4 0.857894736842 0.649068322981
TN(stable) and TP(slip) for surface  4 0.938069216758 0.815 | 0.936247723133 0.5225
Accuracy for surface  5 0.795574288725 0.653319283456
F1score for surface   5 0.690095846645 0.301486199575
TN(stable) and TP(slip) for surface  5 0.981785063752 0.54 | 1.0 0.1775
======================================================================================
Accuracy for dataset    0.850544432736 0.690551457675
F1score for dataset    0.801677930552 0.44730238394
TN(stable) and TP(slip) for dataset  0.948087431694 0.716666666667 | 0.97723132969 0.297083333333
======================================================================================
Filename for prediction: ati_new_fd1.5N_kp3_nofilt_validation.mat
Accuracy for surface  0 0.825100133511 0.871829105474
F1score for surface   0 0.847497089639 0.878481012658
TN(stable) and TP(slip) for surface  0 0.727793696275 0.91 | 0.876790830946 0.8675
Accuracy for surface  1 0.719626168224 0.782376502003
F1score for surface   1 0.777070063694 0.817469204927
TN(stable) and TP(slip) for surface  1 0.495702005731 0.915 | 0.63323782235 0.9125
Accuracy for surface  2 0.909212283044 0.728971962617
F1score for surface   2 0.914572864322 0.749072929543
TN(stable) and TP(slip) for surface  2 0.908309455587 0.91 | 0.696275071633 0.7575
Accuracy for surface  3 0.877169559413 0.895861148198
F1score for surface   3 0.884130982368 0.891966759003
TN(stable) and TP(slip) for surface  3 0.876790830946 0.8775 | 1.0 0.805
Accuracy for surface  4 0.923898531375 0.853137516689
F1score for surface   4 0.925490196078 0.841954022989
TN(stable) and TP(slip) for surface  4 0.968481375358 0.885 | 0.991404011461 0.7325
Accuracy for surface  5 0.882510013351 0.560747663551
F1score for surface   5 0.877094972067 0.307368421053
TN(stable) and TP(slip) for surface  5 0.994269340974 0.785 | 0.994269340974 0.1825
======================================================================================
Accuracy for dataset    0.856252781486 0.782153983089
F1score for dataset    0.867405582923 0.776738882554
TN(stable) and TP(slip) for dataset  0.828557784145 0.880416666667 | 0.865329512894 0.709583333333
======================================================================================
Filename for prediction: ati_new_fd1.5N_kp3_nofilt_validation_rot.mat
Accuracy for surface  0 0.574288724974 0.616438356164
F1score for surface   0 0.61669829222 0.35231316726
TN(stable) and TP(slip) for surface  0 0.40072859745 0.8125 | 0.885245901639 0.2475
Accuracy for surface  1 0.8177028451 0.665964172813
F1score for surface   1 0.770252324037 0.432915921288
TN(stable) and TP(slip) for surface  1 0.885245901639 0.725 | 0.930783242259 0.3025
Accuracy for surface  2 0.830347734457 0.535300316122
F1score for surface   2 0.772919605078 0.261306532663
TN(stable) and TP(slip) for surface  2 0.936247723133 0.685 | 0.783242258652 0.195
Accuracy for surface  3 0.859852476291 0.671232876712
F1score for surface   3 0.803545051699 0.370967741935
TN(stable) and TP(slip) for surface  3 0.990892531876 0.68 | 0.992714025501 0.23
Accuracy for surface  4 0.880927291886 0.754478398314
F1score for surface   4 0.853437094682 0.623586429725
TN(stable) and TP(slip) for surface  4 0.92349726776 0.8225 | 0.952641165756 0.4825
Accuracy for surface  5 0.799789251844 0.656480505796
F1score for surface   5 0.691558441558 0.317991631799
TN(stable) and TP(slip) for surface  5 0.994535519126 0.5325 | 0.99635701275 0.19
======================================================================================
Accuracy for dataset    0.793818054092 0.649982437654
F1score for dataset    0.743668122271 0.39806704923
TN(stable) and TP(slip) for dataset  0.855191256831 0.709583333333 | 0.92349726776 0.274583333333
======================================================================================

Check the training forces and compare them with testing ones (2.86 1.35 2.12 1.68)


In [9]:
printit = False
f,_,_,_,_,_ = data_prep(c.datafile,printit=printit)                        # read training input force
pf = compute_prefeat(f,printit=printit)                                  # compute corresponding prefeatures
fv,_,_,_,_,_ = data_prep(c.validfile,printit=printit)                      # read validation input force
pfv = compute_prefeat(fv,printit=printit)                                # compute corresponding prefeatures

atifiles = ['ati_new_fd1.0N_kp3.5_152Hz_validation.mat',
            'ati_new_fd1.0N_kp3.5_152Hz_validation_rot.mat',
            'ati_new_fd1.5N_kp3_152Hz_validation.mat',
            'ati_new_fd1.5N_kp3_152Hz_validation_rot.mat',
            'ati_new_fd1.0N_kp3.5_326Hz_validation.mat',
            'ati_new_fd1.0N_kp3.5_326Hz_validation_rot.mat',
            'ati_new_fd1.5N_kp3_326Hz_validation.mat',
            'ati_new_fd1.5N_kp3_326Hz_validation_rot.mat',
            'ati_new_fd1.0N_kp3.5_836Hz_validation.mat',
            'ati_new_fd1.0N_kp3.5_836Hz_validation_rot.mat',
            'ati_new_fd1.5N_kp3.5_836Hz_validation.mat',
            'ati_new_fd1.5N_kp3.5_836Hz_validation_rot.mat',
            'ati_new_fd1N_kp3_nofilt_validation.mat',
            'ati_new_fd1N_kp3_nofilt_validation_rot.mat',
            'ati_new_fd1.5N_kp3_nofilt_validation.mat',
            'ati_new_fd1.5N_kp3_nofilt_validation_rot.mat']
atiftr = []
atifrt = []
for filen in atifiles:
    tf,_,_,_,_,_ = data_prep(c.datapath+filen,k=1,printit=printit)
    ptf = compute_prefeat(tf,printit=printit)
    if filen[-7:-4] == 'rot':
        atifrt.append(ptf)
    else:
        atiftr.append(ptf)
atiftr = np.array(atiftr).flatten()
atifrt = np.array(atifrt).flatten()

plist = [pf, pfv, atiftr, atifrt]
pname = ['train', 'valid','atitran','atirot']
print pf.shape, pfv.shape, atiftr.shape, atifrt.shape
mf, mfst, mfsl = np.zeros((4,4)), np.zeros((4,4)), np.zeros((4,4))
print 'datasetname: [all/stable/slip:[0:mean, 1:max, 2:min, 3:std]]'
for ind in range(len(plist)):
    pt = plist[ind]
    # 0:mean, 1:max, 2:min, 3:std
    for p in range(len(pt)):
        mf[ind,0] += np.mean(pt[p][:,0])
        mf[ind,1] += np.max(pt[p][:,0])
        mf[ind,2] += np.min(pt[p][:,0])
        mf[ind,3] += np.std(pt[p][:,0])
        stind = pt[p][:,1]==0
        slind = pt[p][:,1]==1
        mfst[ind,0] += np.mean(pt[p][stind,0])
        mfst[ind,1] += np.max(pt[p][stind,0])
        mfst[ind,2] += np.min(pt[p][stind,0])
        mfst[ind,3] += np.std(pt[p][stind,0])
        mfsl[ind,0] += np.mean(pt[p][slind,0])
        mfsl[ind,1] += np.max(pt[p][slind,0])
        mfsl[ind,2] += np.min(pt[p][slind,0])
        mfsl[ind,3] += np.std(pt[p][slind,0])
    mf[ind,0] /= len(plist[ind])
    mf[ind,1] /= len(plist[ind])
    mf[ind,2] /= len(plist[ind])
    mf[ind,3] /= len(plist[ind])
    mfst[ind,0] /= len(plist[ind])
    mfst[ind,1] /= len(plist[ind])
    mfst[ind,2] /= len(plist[ind])
    mfst[ind,3] /= len(plist[ind])
    mfsl[ind,0] /= len(plist[ind])
    mfsl[ind,1] /= len(plist[ind])
    mfsl[ind,2] /= len(plist[ind])
    mfsl[ind,3] /= len(plist[ind])
    print pname[ind], mf[ind], mfst[ind], mfsl[ind]


(72,) (2,) (48,) (48,)
datasetname: [all/stable/slip:[0:mean, 1:max, 2:min, 3:std]]
train [ 2.86251015  5.09840423  1.49469399  0.98215772] [ 2.18675048  3.03727431  1.72562893  0.28885944] [ 3.66916912  5.09562958  1.51392494  0.8716188 ]
valid [ 1.34931022  3.08346999  0.6870942   0.76446083] [ 0.7360613   1.01612632  0.6870942   0.07938595] [ 1.64921946  3.08346999  0.69021954  0.76977593]
atitran [ 1.7081888   4.31136074  0.49442186  0.64149739] [ 1.47028108  1.67330645  1.22426491  0.13014016] [ 1.92579317  4.31136074  0.49605079  0.80594714]
atirot [ 1.66960896  2.3169749   1.01502636  0.23922276] [ 1.59671116  1.85347776  1.3185732   0.12934402] [ 1.77400117  2.31319775  1.06879374  0.26144718]