title: How do I combine two features / classifiers into a single united and better classifier?
body: <p>I am creating an emotion recognition program and managed to produce two different algorithms/features to feed into sklearn's SVM. I got Dense Optical Flow data, compacted it into a matrix and feed it into the SVM function while I did the same with tracking data from facial landmarks. </p>
  
  <p>Right now, I have two different programs that each produces different accuracy, but does the same thing: recognizing emotion based on facial movement. </p>
  
  <p>My goal right now is to combine both dense optical flow and facial landmark features / classifiers together and unite them to get one better classifier that would use both of those to achieve higher accuracy in classification.</p>
  
  <p>Basically, I am trying to recreate a classifier from this:
  <a href="http://cgit.nutn.edu.tw:8080/cgit/PaperDL/LZJ_120826151743.PDF" rel="nofollow">http://cgit.nutn.edu.tw:8080/cgit/PaperDL/LZJ_120826151743.PDF</a>  </p>
  
  <pre><code>Confusion Matrix for Dense Optical Flow:   
  [[27 22  0  0]  
   [ 0 57  1  0]  
   [ 0 12 60  0]  
   [ 0  9  3 68]]  
  Accuracy: 80-90% range
  
  Confusion Matrix for Facial Landmarks:  
  [[27 10  5  2]  
   [ 7 44  5  3]  
   [ 6 14 33  1]  
   [ 1 13  1 60]]  
  Accuracy: 60-72% range
  </code></pre>
  
  <p>Matrix structure of matrix containing Dense Optical Flow data:</p>
  
  <pre><code>&gt;&gt;&gt; main.shape
  (646, 403680)
  &gt;&gt;&gt; main
  array([[ -1.18353125e-03,  -2.41295085e-04,  -1.88367767e-03, ...,
           -5.19892928e-05,   8.53588153e-06,  -3.90818786e-05],
         [  6.32877424e-02,  -7.24349543e-02,   8.19472596e-02, ...,
           -4.71765925e-05,   5.41217596e-05,  -3.12083102e-05],
         [ -1.66368652e-02,   2.50510368e-02,  -6.03965335e-02, ...,
           -9.85100851e-05,  -7.69595645e-05,  -7.09727174e-05],
         ..., 
         [ -3.44874617e-03,   5.31123485e-03,  -8.47499538e-03, ...,
           -2.77953018e-06,  -2.96417579e-06,  -1.51305017e-06],
         [  3.24894954e-03,   5.05338283e-03,   3.91049543e-03, ...,
           -3.23493354e-04,   1.30995919e-04,  -3.06804082e-04],
         [  7.82454386e-03,   1.69946514e-02,   8.11014231e-03, ...,
           -1.02751539e-03,   7.68289610e-05,  -7.82517891e-04]], dtype=float32)  
  </code></pre>
  
  <p>Matrix structure of matrix containing face landmark tracking information:</p>
  
  <pre><code>&gt;&gt;&gt; main.shape
  (646, 17, 68, 2)
  &gt;&gt;&gt; main
  array([[[[  0.        ,   0.        ],
           [  0.        ,   0.        ],
           [  0.        ,   0.        ],
           ..., 
           [  0.        ,   0.        ],
           [  0.        ,   0.        ],
           [  0.        ,   0.        ]],
  
          [[ -2.23606798,  -1.10714872],
           [ -2.23606798,  -1.10714872],
           [  3.        ,   1.        ],
           ..., 
           [  1.41421356,   0.78539816],
           [  1.41421356,   0.78539816],
           [  1.        ,   0.        ]],
  
          [[  2.82842712,  -0.78539816],
           [  2.23606798,  -1.10714872],
           [  2.23606798,  -1.10714872],
           ..., 
           [ -1.        ,  -0.        ],
           [ -1.        ,  -0.        ],
           [ -1.        ,  -0.        ]],
  
          ..., 
          [[  2.        ,   1.        ],
           [ -2.23606798,   1.10714872],
           [ -3.16227766,   1.24904577],
           ..., 
           [ -1.        ,  -0.        ],
           [ -1.41421356,   0.78539816],
           [ -1.        ,  -0.        ]],
  
          [[ -1.41421356,  -0.78539816],
           [  1.        ,   1.        ],
           [ -1.41421356,  -0.78539816],
           ..., 
           [  0.        ,   0.        ],
           [  0.        ,   0.        ],
           [  0.        ,   0.        ]],
  
          [[  3.        ,   1.        ],
           [  4.        ,   1.        ],
           [  4.        ,   1.        ],
           ..., 
           [  1.41421356,  -0.78539816],
           [  1.        ,   0.        ],
           [  1.        ,   0.        ]]],
  
  
         [[[  0.        ,   0.        ],
           [  0.        ,   0.        ],
           [  0.        ,   0.        ],
           ..., 
           [  0.        ,   0.        ],
           [  0.        ,   0.        ],
           [  0.        ,   0.        ]],
  
          [[  1.        ,   1.        ],
           [ -1.41421356,  -0.78539816],
           [ -1.        ,  -0.        ],
           ..., 
           [  2.        ,   0.        ],
           [  1.        ,   0.        ],
           [ -1.        ,  -0.        ]],
  
          [[  0.        ,   0.        ],
           [  1.        ,   1.        ],
           [  0.        ,   0.        ],
           ..., 
           [ -4.        ,  -0.        ],
           [ -3.        ,  -0.        ],
           [ -2.        ,  -0.        ]],
  
          ..., 
          [[ -2.23606798,  -1.10714872],
           [ -2.23606798,  -1.10714872],
           [  2.        ,   1.        ],
           ..., 
           [  0.        ,   0.        ],
           [  1.41421356,   0.78539816],
           [  1.41421356,   0.78539816]],
  
          [[  0.        ,   0.        ],
           [  0.        ,   0.        ],
           [ -1.        ,  -0.        ],
           ..., 
           [  1.        ,   1.        ],
           [  0.        ,   0.        ],
           [ -1.41421356,   0.78539816]],
  
          [[  1.        ,   1.        ],
           [  1.        ,   1.        ],
           [  1.        ,   1.        ],
           ..., 
           [  1.        ,   1.        ],
           [  0.        ,   0.        ],
           [  1.        ,   0.        ]]],
  
  
         [[[  0.        ,   0.        ],
           [  0.        ,   0.        ],
           [  0.        ,   0.        ],
           ..., 
           [  0.        ,   0.        ],
           [  0.        ,   0.        ],
           [  0.        ,   0.        ]],
  
          [[  3.16227766,   1.24904577],
           [  2.23606798,   1.10714872],
           [  2.23606798,   1.10714872],
           ..., 
           [ -1.41421356,  -0.78539816],
           [ -1.        ,  -0.        ],
           [ -1.41421356,   0.78539816]],
  
          [[ -1.41421356,   0.78539816],
           [  0.        ,   0.        ],
           [  1.41421356,   0.78539816],
           ..., 
           [ -1.41421356,   0.78539816],
           [ -1.        ,  -0.        ],
           [  0.        ,   0.        ]],
  
          ..., 
          [[  1.        ,   1.        ],
           [  1.        ,   1.        ],
           [  0.        ,   0.        ],
           ..., 
           [  1.        ,   1.        ],
           [  1.        ,   1.        ],
           [ -1.41421356,   0.78539816]],
  
          [[  1.        ,   1.        ],
           [  2.        ,   1.        ],
           [  2.23606798,   1.10714872],
           ..., 
           [  1.        ,   1.        ],
           [  1.        ,   1.        ],
           [ -1.41421356,  -0.78539816]],
  
          [[  1.        ,   1.        ],
           [  1.        ,   1.        ],
           [  1.        ,   1.        ],
           ..., 
           [ -2.        ,  -0.        ],
           [ -2.        ,  -0.        ],
           [ -1.        ,  -0.        ]]],
  
  
         ..., 
         [[[  0.        ,   0.        ],
           [  0.        ,   0.        ],
           [  0.        ,   0.        ],
           ..., 
           [  0.        ,   0.        ],
           [  0.        ,   0.        ],
           [  0.        ,   0.        ]],
  
          [[  1.41421356,   0.78539816],
           [  1.41421356,   0.78539816],
           [  1.41421356,   0.78539816],
           ..., 
           [  1.        ,   1.        ],
           [  0.        ,   0.        ],
           [  1.        ,   1.        ]],
  
          [[  5.        ,   1.        ],
           [ -4.12310563,   1.32581766],
           [ -4.12310563,   1.32581766],
           ..., 
           [  1.        ,   1.        ],
           [  0.        ,   0.        ],
           [  1.        ,   1.        ]],
  
          ..., 
          [[  3.16227766,   1.24904577],
           [  2.        ,   1.        ],
           [  2.        ,   1.        ],
           ..., 
           [  0.        ,   0.        ],
           [  0.        ,   0.        ],
           [  0.        ,   0.        ]],
  
          [[ -3.16227766,   1.24904577],
           [  2.        ,   1.        ],
           [ -2.23606798,   1.10714872],
           ..., 
           [  0.        ,   0.        ],
           [  1.        ,   0.        ],
           [  1.        ,   0.        ]],
  
          [[  1.        ,   1.        ],
           [  1.        ,   1.        ],
           [  1.41421356,   0.78539816],
           ..., 
           [  0.        ,   0.        ],
           [  0.        ,   0.        ],
           [  0.        ,   0.        ]]],
  
  
         [[[  0.        ,   0.        ],
           [  0.        ,   0.        ],
           [  0.        ,   0.        ],
           ..., 
           [  0.        ,   0.        ],
           [  0.        ,   0.        ],
           [  0.        ,   0.        ]],
  
          [[ -2.23606798,   0.46364761],
           [ -1.41421356,   0.78539816],
           [ -2.23606798,   0.46364761],
           ..., 
           [  1.        ,   0.        ],
           [  1.        ,   0.        ],
           [  1.        ,   1.        ]],
  
          [[ -2.23606798,  -0.46364761],
           [ -1.41421356,  -0.78539816],
           [  2.        ,   1.        ],
           ..., 
           [  0.        ,   0.        ],
           [  1.        ,   0.        ],
           [  1.        ,   0.        ]],
  
          ..., 
          [[  1.        ,   0.        ],
           [  1.        ,   1.        ],
           [ -2.23606798,  -1.10714872],
           ..., 
           [ 19.02629759,   1.51821327],
           [ 19.        ,   1.        ],
           [-19.10497317,  -1.46591939]],
  
          [[  3.60555128,   0.98279372],
           [  3.60555128,   0.5880026 ],
           [  5.        ,   0.64350111],
           ..., 
           [  7.28010989,  -1.29249667],
           [  7.61577311,  -1.16590454],
           [  8.06225775,  -1.05165021]],
  
          [[ -7.28010989,   1.29249667],
           [ -5.        ,   0.92729522],
           [ -5.83095189,   0.5404195 ],
           ..., 
           [ 20.09975124,   1.47112767],
           [ 21.02379604,   1.52321322],
           [-20.22374842,  -1.42190638]]],
  
  
         [[[  0.        ,   0.        ],
           [  0.        ,   0.        ],
           [  0.        ,   0.        ],
           ..., 
           [  0.        ,   0.        ],
           [  0.        ,   0.        ],
           [  0.        ,   0.        ]],
  
          [[ -1.41421356,   0.78539816],
           [ -2.23606798,   1.10714872],
           [  2.        ,   1.        ],
           ..., 
           [  1.        ,   1.        ],
           [  1.        ,   0.        ],
           [  2.23606798,  -0.46364761]],
  
          [[  1.        ,   0.        ],
           [  1.41421356,   0.78539816],
           [  1.        ,   1.        ],
           ..., 
           [  0.        ,   0.        ],
           [  1.        ,   1.        ],
           [  0.        ,   0.        ]],
  
          ..., 
          [[ -1.41421356,  -0.78539816],
           [  0.        ,   0.        ],
           [  1.        ,   1.        ],
           ..., 
           [  1.        ,   0.        ],
           [  1.        ,   0.        ],
           [  1.        ,   0.        ]],
  
          [[  1.        ,   1.        ],
           [ -1.        ,  -0.        ],
           [  1.        ,   1.        ],
           ..., 
           [ -1.        ,  -0.        ],
           [  0.        ,   0.        ],
           [ -1.        ,  -0.        ]],
  
          [[  0.        ,   0.        ],
           [  1.41421356,  -0.78539816],
           [ -1.        ,  -0.        ],
           ..., 
           [  1.        ,   0.        ],
           [  0.        ,   0.        ],
           [  1.        ,   0.        ]]]])
  </code></pre>
  
  <p>My code for Dense Optical Flow classifier:  </p>
  
  <pre><code>features_train, features_test, labels_train, labels_test = cross_validation.train_test_split(main, target, test_size = 0.4)
  
  # Determine amount of time to train
  t0 = time()
  model = SVC(probability=True)
  #model = SVC(kernel='poly')
  #model = GaussianNB()
  
  model.fit(features_train, labels_train)
  
  print 'training time: ', round(time()-t0, 3), 's'
  
  # Determine amount of time to predict
  t1 = time()
  pred = model.predict(features_test)
  </code></pre>
  
  <p>My code for Face Landmark Tracking classifier: </p>
  
  <pre><code>features_train, features_test, labels_train, labels_test = cross_validation.train_test_split(main.reshape(len(main), -1), target, test_size = 0.4)
  
  # Determine amount of time to train
  t0 = time()
  #model = SVC()
  model = SVC(kernel='linear')
  
  #model = GaussianNB()
  
  model.fit(features_train, labels_train)
  
  
  # Determine amount of time to predict
  t1 = time()
  pred = model.predict(features_test)
  </code></pre>
  
  <p>In sklearn (or machine learning in general), how do I combine these two features together in order to create an united and better classifier that takes these two information into account when training and predicting?</p>