src/random_forest.py
def readTrainingFiles(filename_path, filelabel_path, data_path):
    '''
    This function reads the name of the training files, their labels
    and their data given each of these paths and returns an rdd containing
    the data and an rdd containing the labels.

    Arg1 : Path of the file storing the name of the files.
    Arg2 : Path of the file storing the labels of these files.
    Arg3 : Path where the data is stored.

    '''
    # reading the training files
    x_train = readFile(filename_path)
    y_train = readFile(filelabel_path)

    #storing the path of data
    byte_data_directory = data_path

    #appending hashcode of the files to the datapath
    x_filenames = x_train.map(lambda x: byte_data_directory+x+'.bytes')
    x_filenames = x_filenames.collect()

    #reading the data
    dat_train = readWholeFile(",".join(x_filenames))

    #making the list of filename and its labels
    label_map = dict(zip(x_filenames,y_train.collect()))
    #converting it to rdd
    labelfile_rdd = sc.parallelize(label_map)


    return dat_train, labelfile_rdd

    This function reads the name of the training files, their labels
    and their data given each of these paths and returns an rdd containing
    the data and an rdd containing the labels.

    Arg1 : Path of the file storing the name of the files.
    Arg2 : Path of the file storing the labels of these files.
    Arg3 : Path where the data is stored.

    
This function reads the name of the training files, their labels
and their data given each of these paths and returns an rdd containing
the data and an rdd containing the labels.

Arg1 : Path of the file storing the name of the files.
Arg2 : Path of the file storing the labels of these files.
Arg3 : Path where the data is stored.
This function reads the name of the training files their labels and their data given each of these paths and returns an rdd containing the data and an rdd containing the labels . Arg1 : Path of the file storing the name of the files . Arg2 : Path of the file storing the labels of these files . Arg3 : Path where the data is stored .
def readTrainingFiles(filename_path, filelabel_path, data_path):
    x_train = readFile(filename_path)
    y_train = readFile(filelabel_path)
    byte_data_directory = data_path
    x_filenames = x_train.map(lambda x: byte_data_directory+x+'.bytes')
    x_filenames = x_filenames.collect()
    dat_train = readWholeFile(",".join(x_filenames))
    label_map = dict(zip(x_filenames,y_train.collect()))
    labelfile_rdd = sc.parallelize(label_map)
    return dat_train, labelfile_rdd
def readTrainingFiles ( filename_path , filelabel_path , data_path ) : x_train = readFile ( filename_path ) y_train = readFile ( filelabel_path ) byte_data_directory = data_path x_filenames = x_train . map ( lambda x : byte_data_directory + x + '.bytes' ) x_filenames = x_filenames . collect ( ) dat_train = readWholeFile ( "," . join ( x_filenames ) ) label_map = dict ( zip ( x_filenames , y_train . collect ( ) ) ) labelfile_rdd = sc . parallelize ( label_map ) return dat_train , labelfile_rdd
This function reads the name of the training files, their labels
and their data given each of these paths and returns an rdd containing
the data and an rdd containing the labels.
This function reads the name of the training files their labels and their data given each of these paths and returns an rdd containing the data and an rdd containing the labels .
'''
    This function reads the name of the training files, their labels
    and their data given each of these paths and returns an rdd containing
    the data and an rdd containing the labels.

    Arg1 : Path of the file storing the name of the files.
    Arg2 : Path of the file storing the labels of these files.
    Arg3 : Path where the data is stored.

    ''' # reading the training files #storing the path of data #appending hashcode of the files to the datapath #reading the data #making the list of filename and its labels #converting it to rdd
filename_path
filelabel_path
data_path