# Path: pygesture/analysis/processing.py
# class Processor(object):
# class Session:
# class Recording:
#     def __init__(self, conditioner, windower, feature_extractor, rest_bounds,
#                  gesture_bounds):
# def batch_process(rootdir, pid, processor, sid_list='all', pool=1):
# def _process_session(args):
# def read_feature_file_list(file_list, labels='all'):
# def get_session_data(rootdir, pid, sid_list):
#     def __init__(self, rootdir, pid, sid, processor):
#     def process(self, saveproc=True):
#     def __init__(self, wavfile, processor):
#     def _read_file(self):
#     def process(self):
# def window(x, length, overlap=0, axis=0):
# def windowind(n, length, overlap=0):
#     X = data[:, 1:]


import numpy as np
from sklearn.lda import LDA
from sklearn.metrics import confusion_matrix
from sklearn.cross_validation import LeavePOut
from sklearn.preprocessing import StandardScaler
from pygesture.analysis import processing
    clf : sklearn classifier (default=None)
        An initialized (but not trained) classifier object, providing `fit()`
        and `predict()` methods. Default is `None`, which means
        `sklearn.lda.LDA` is used.
    label_dict: dict in the form 'int: (str, str)' (default=None)
        Mapping from class label (int) to a tuple including an abbreviation
        and a full name for each clss. Default is None, which means the
        integer labels contained in the data are given to the ConfusionMatrix
        returned.

    Returns
    -------
    cm : ConfusionMatrix
        The results of the classification test.

    Examples
    --------
    >>> from pygesture import classification
    >>> clf_dict = {
            'name': 'arm',
            'sid_list_train': ['arm1', 'arm2'],
            'sid_list_test': ['arm3', 'arm4']}
    >>> cm = classification.run_single('./data', ['p0'], clf_dict)
    >>> print(cm.get_avg_accuracy())
    0.9782919472
    """
    cm_list = []
    for pid in pids:
        data_train = processing.get_session_data(
            rootdir, pid, clf_dict['sid_list_train'])

# Path: pygesture/analysis/processing.py
# class Processor(object):
# class Session:
# class Recording:
#     def __init__(self, conditioner, windower, feature_extractor, rest_bounds,
#                  gesture_bounds):
# def batch_process(rootdir, pid, processor, sid_list='all', pool=1):
# def _process_session(args):
# def read_feature_file_list(file_list, labels='all'):
# def get_session_data(rootdir, pid, sid_list):
#     def __init__(self, rootdir, pid, sid, processor):
#     def process(self, saveproc=True):
#     def __init__(self, wavfile, processor):
#     def _read_file(self):
#     def process(self):
# def window(x, length, overlap=0, axis=0):
# def windowind(n, length, overlap=0):
#     X = data[:, 1:]


# Path: pygesture/analysis/classification.py
import numpy as np
from sklearn.lda import LDA
from sklearn.metrics import confusion_matrix
from sklearn.cross_validation import LeavePOut
from sklearn.preprocessing import StandardScaler
from pygesture.analysis import processing

    clf : sklearn classifier (default=None)
        An initialized (but not trained) classifier object, providing `fit()`
        and `predict()` methods. Default is `None`, which means
        `sklearn.lda.LDA` is used.
    label_dict: dict in the form 'int: (str, str)' (default=None)
        Mapping from class label (int) to a tuple including an abbreviation
        and a full name for each clss. Default is None, which means the
        integer labels contained in the data are given to the ConfusionMatrix
        returned.

    Returns
    -------
    cm : ConfusionMatrix
        The results of the classification test.

    Examples
    --------
    >>> from pygesture import classification
    >>> clf_dict = {
            'name': 'arm',
            'sid_list_train': ['arm1', 'arm2'],
            'sid_list_test': ['arm3', 'arm4']}
    >>> cm = classification.run_single('./data', ['p0'], clf_dict)
    >>> print(cm.get_avg_accuracy())
    0.9782919472
    """
    cm_list = []
    for pid in pids:
        data_train = processing.get_session_data(
            rootdir, pid, clf_dict['sid_list_train'])

        data_test = processing.get_session_data(