Create a HDF5 feature files.

    Parameters
    ----------
    output_filename : string
        name of the HDF5 file that will be created
    feature_count : int
        dimension of all features combined
    data : list of tuples
        list of (x, y) tuples, where x is the feature vector of dimension
        ``feature_count`` and y is a label.

def create_hdf5(output_filename, feature_count, data):
    """
    Create a HDF5 feature files.

    Parameters
    ----------
    output_filename : string
        name of the HDF5 file that will be created
    feature_count : int
        dimension of all features combined
    data : list of tuples
        list of (x, y) tuples, where x is the feature vector of dimension
        ``feature_count`` and y is a label.
    """
    import h5py
    logging.info("Start creating of %s hdf file", output_filename)
    x = []
    y = []
    for features, label in data:
        assert len(features) == feature_count, \
            "Expected %i features, got %i features" % \
            (feature_count, len(features))
        x.append(features)
        y.append(int(label))
    Wfile = h5py.File(output_filename, 'w')
    Wfile.create_dataset("data", data=x, dtype='float32')
    Wfile.create_dataset("labels", data=y, dtype='int32')
    Wfile.close()