src/random_forest.py
def preprocessing_trainingfiles(labelfile_rdd, dat_rdd):
    '''
    This function preprocess the training files and returns and rdd containing
    the filenames,data and their labels.
    Arg1 : rdd containing the labels and filenames
    Arg2 : rdd containing the data and filenames.
    '''
    #shortening the full filepath to just the filename for the label
    labelfile_rdd = labelfile_rdd.map(lambda x : (x[0].split('/')[-1],x[1]))

    #Removed the filepointers from the files
    dat_rdd = dat_rdd.map(lambda x : (x[0],x[1].split()[1:]))

    #shortening the full filepath to just the filename for the data
    dat_rdd = dat_rdd.map(lambda x : (x[0].split('/')[-1],x[1]))

    #joined the rdd containing label and filename to the rdd with data and filename
    dat_rdd = labelfile_rdd.join(dat_rdd)

    return dat_rdd

    This function preprocess the training files and returns and rdd containing
    the filenames,data and their labels.
    Arg1 : rdd containing the labels and filenames
    Arg2 : rdd containing the data and filenames.
    
This function preprocess the training files and returns and rdd containing
the filenames,data and their labels.
Arg1 : rdd containing the labels and filenames
Arg2 : rdd containing the data and filenames.
This function preprocess the training files and returns and rdd containing the filenames data and their labels . Arg1 : rdd containing the labels and filenames Arg2 : rdd containing the data and filenames .
def preprocessing_trainingfiles(labelfile_rdd, dat_rdd):
    labelfile_rdd = labelfile_rdd.map(lambda x : (x[0].split('/')[-1],x[1]))
    dat_rdd = dat_rdd.map(lambda x : (x[0],x[1].split()[1:]))
    dat_rdd = dat_rdd.map(lambda x : (x[0].split('/')[-1],x[1]))
    dat_rdd = labelfile_rdd.join(dat_rdd)
    return dat_rdd
def preprocessing_trainingfiles ( labelfile_rdd , dat_rdd ) : labelfile_rdd = labelfile_rdd . map ( lambda x : ( x [ 0 ] . split ( '/' ) [ - 1 ] , x [ 1 ] ) ) dat_rdd = dat_rdd . map ( lambda x : ( x [ 0 ] , x [ 1 ] . split ( ) [ 1 : ] ) ) dat_rdd = dat_rdd . map ( lambda x : ( x [ 0 ] . split ( '/' ) [ - 1 ] , x [ 1 ] ) ) dat_rdd = labelfile_rdd . join ( dat_rdd ) return dat_rdd
This function preprocess the training files and returns and rdd containing
the filenames,data and their labels.
This function preprocess the training files and returns and rdd containing the filenames data and their labels .
'''
    This function preprocess the training files and returns and rdd containing
    the filenames,data and their labels.
    Arg1 : rdd containing the labels and filenames
    Arg2 : rdd containing the data and filenames.
    ''' #shortening the full filepath to just the filename for the label #Removed the filepointers from the files #shortening the full filepath to just the filename for the data #joined the rdd containing label and filename to the rdd with data and filename
labelfile_rdd
dat_rdd