def make_hdf5(dataset_name, feature_count, data,
              output_filename, create_learning_curve):
    """
    Create the hdf5 file.

    Parameters
    ----------
    filename :
        name of the file that hdf5_create will use to create the hdf5 file.
    feature_count : integer
        number of features
    data : list of tuples
         data format ('feature_string', 'label')
    """
    # create raw data file for hdf5_create
    if dataset_name == "traindata" and create_learning_curve:
        max_trainingexamples = 501
        output_filename_save = output_filename
        steps = 10
        for trainingexamples in range(100, max_trainingexamples, steps):
            # adjust output_filename
            tmp = output_filename_save.split(".")
            tmp[-2] += "-%i-examples" % trainingexamples
            output_filename = ".".join(map(str, tmp))

            # Make sure the data has not more than ``trainingexamples``
            seen_symbols = defaultdict(int)
            new_data = {}
            for feature_string, label in data:
                if seen_symbols[label] < trainingexamples:
                    seen_symbols[label] += 1
                    new_data = (feature_string, label)

            # Create the hdf5 file
            utils.create_hdf5(output_filename, feature_count, new_data)
    else:
        utils.create_hdf5(output_filename, feature_count, data)
def make_hdf5 ( dataset_name , feature_count , data , output_filename , create_learning_curve ) : if dataset_name == "traindata" and create_learning_curve : max_trainingexamples = 501 output_filename_save = output_filename steps = 10 for trainingexamples in range ( 100 , max_trainingexamples , steps ) : tmp = output_filename_save . split ( "." ) tmp [ - 2 ] += "-%i-examples" % trainingexamples output_filename = "." . join ( map ( str , tmp ) ) seen_symbols = defaultdict ( int ) new_data = { } for feature_string , label in data : if seen_symbols [ label ] < trainingexamples : seen_symbols [ label ] += 1 new_data = ( feature_string , label ) utils . create_hdf5 ( output_filename , feature_count , new_data ) else : utils . create_hdf5 ( output_filename , feature_count , data )
Create the hdf5 file.

    Parameters
    ----------
    filename :
        name of the file that hdf5_create will use to create the hdf5 file.
    feature_count : integer
        number of features
    data : list of tuples
         data format ('feature_string', 'label')