prediction_functions.py
def data_model(collection,\
               minlen=20,\
               order=2,\
               standardise=True,\
               count=True,\
               feedforward=True,\
               missing_clean=False,\
               start_average=False, \
               naive=False,\
               time=True,\
               cumsum=True,\
               feature=int(0)):

    
    """
    
          process data before fitting into machine learning models.
          
          
    Parameters
    ----------
    collection : list
        The out-of-sample set.
    order : int, optional
        Order of the signature.
        Default is 2.
        
    minlen: int
        the length of data considered for each patient.
        Default is 20.
    
    standardise: True or False
        whether or not the piece of data being standardised
    count: True or False
        whether or not the piece of data being counted for missing value
    
    feedforward: True or False
        whether or not the missing values in the piece of data is filled by feedforward function
        
    missing_clean:True or False
        whether or not the missing values in the piece of data is to be cleaned
    
    start_average: True or False
        whether or not the missing values at the beginning of the piece of data is filled by the average
    naive: True or False
        whether or not the navid method (by calculating the mean) is implemented
    time: True or False
        whether or not the time is included 
    
    cumsum: True or False
        whether or not the piece of data is being cumulated
        
    feature: which group we are considering
        Default: int(0), otherwise, int(1)/int(2)
        
    Returns
    -------
    
    x,y in appropriate form
    
    """




    x=[]
    y=[]


    for participant in collection:

        if dual:
            par_data=participant.data
        else:
            par_data=[participant.data[feature]]


        if missing_clean:
                participant_data=clean_missing1(par_data)
        elif count:
            if standardise:

                participant_data=normalise(feed_forward(par_data,\
                                                        count=count,\
                                                        time=time,\
                                                        start_average=start_average,\
                                                        cumsum=cumsum),\
                                           count=count,\
                                           time=time)

            else:

                participant_data=feed_forward(par_data,\
                                              count=count,\
                                              time=time,\
                                              start_average=start_average,\
                                              cumsum=cumsum)

        else:
            if standardise:
                if feedforward:
                    participant_data=normalise(feed_forward(par_data,\
                                                            count=count,\
                                                            time=time,\
                                                            start_average=start_average,\
                                                            cumsum=cumsum),\
                                               count=count,\
                                               time=time)

                else:
                    participant_data=normalise(list_to_num(par_data),\
                                               count=count,\
                                               time=time)
            else:
                if feedforward:
                        participant_data=feed_forward(par_data,\
                                                      count=count,\
                                                      time=time,\
                                                      start_average=start_average,\
                                                      cumsum=cumsum)
                else:
                    participant_data=list_to_num(par_data)



        

        if participant_data is not False:

            if naive:
                if len(participant_data)==0:
                        x.append([-1])

                else:

                    x.append([np.sum(participant_data)/minlen])
                    
            else:
                     x.append(iisignature.sig(participant_data, order))
            
            y.append(participant.nextdata[feature])




    return x,y

    
          process data before fitting into machine learning models.
          
          
    Parameters
    ----------
    collection : list
        The out-of-sample set.
    order : int, optional
        Order of the signature.
        Default is 2.
        
    minlen: int
        the length of data considered for each patient.
        Default is 20.
    
    standardise: True or False
        whether or not the piece of data being standardised
    count: True or False
        whether or not the piece of data being counted for missing value
    
    feedforward: True or False
        whether or not the missing values in the piece of data is filled by feedforward function
        
    missing_clean:True or False
        whether or not the missing values in the piece of data is to be cleaned
    
    start_average: True or False
        whether or not the missing values at the beginning of the piece of data is filled by the average
    naive: True or False
        whether or not the navid method (by calculating the mean) is implemented
    time: True or False
        whether or not the time is included 
    
    cumsum: True or False
        whether or not the piece of data is being cumulated
        
    feature: which group we are considering
        Default: int(0), otherwise, int(1)/int(2)
        
    Returns
    -------
    
    x,y in appropriate form
    
    
process data before fitting into machine learning models.
Parameters

collection : list
The out-of-sample set.
order : int, optional
Order of the signature.
Default is 2.

int
the length of data considered for each patient.
Default is 20.

True or False
whether or not the piece of data being standardised
count: True or False
whether or not the piece of data being counted for missing value

True or False
whether or not the missing values in the piece of data is filled by feedforward function

True or False
whether or not the missing values in the piece of data is to be cleaned

True or False
whether or not the missing values at the beginning of the piece of data is filled by the average
naive: True or False
whether or not the navid method (by calculating the mean) is implemented
time: True or False
whether or not the time is included

True or False
whether or not the piece of data is being cumulated



Returns

x,y in appropriate form
process data before fitting into machine learning models . Parameters collection : list The out - of - sample set . order : int optional Order of the signature . Default is 2 . int the length of data considered for each patient . Default is 20 . True or False whether or not the piece of data being standardised count : True or False whether or not the piece of data being counted for missing value True or False whether or not the missing values in the piece of data is filled by feedforward function True or False whether or not the missing values in the piece of data is to be cleaned True or False whether or not the missing values at the beginning of the piece of data is filled by the average naive : True or False whether or not the navid method ( by calculating the mean ) is implemented time : True or False whether or not the time is included True or False whether or not the piece of data is being cumulated Returns x y in appropriate form
def data_model(collection,\
               minlen=20,\
               order=2,\
               standardise=True,\
               count=True,\
               feedforward=True,\
               missing_clean=False,\
               start_average=False, \
               naive=False,\
               time=True,\
               cumsum=True,\
               feature=int(0)):
    x=[]
    y=[]
    for participant in collection:
        if dual:
            par_data=participant.data
        else:
            par_data=[participant.data[feature]]
        if missing_clean:
                participant_data=clean_missing1(par_data)
        elif count:
            if standardise:
                participant_data=normalise(feed_forward(par_data,\
                                                        count=count,\
                                                        time=time,\
                                                        start_average=start_average,\
                                                        cumsum=cumsum),\
                                           count=count,\
                                           time=time)
            else:
                participant_data=feed_forward(par_data,\
                                              count=count,\
                                              time=time,\
                                              start_average=start_average,\
                                              cumsum=cumsum)
        else:
            if standardise:
                if feedforward:
                    participant_data=normalise(feed_forward(par_data,\
                                                            count=count,\
                                                            time=time,\
                                                            start_average=start_average,\
                                                            cumsum=cumsum),\
                                               count=count,\
                                               time=time)
                else:
                    participant_data=normalise(list_to_num(par_data),\
                                               count=count,\
                                               time=time)
            else:
                if feedforward:
                        participant_data=feed_forward(par_data,\
                                                      count=count,\
                                                      time=time,\
                                                      start_average=start_average,\
                                                      cumsum=cumsum)
                else:
                    participant_data=list_to_num(par_data)
        if participant_data is not False:
            if naive:
                if len(participant_data)==0:
                        x.append([-1])
                else:
                    x.append([np.sum(participant_data)/minlen])
            else:
                     x.append(iisignature.sig(participant_data, order))
            y.append(participant.nextdata[feature])
    return x,y
def data_model ( collection , minlen = 20 , order = 2 , standardise = True , count = True , feedforward = True , missing_clean = False , start_average = False , naive = False , time = True , cumsum = True , feature = int ( 0 ) ) : x = [ ] y = [ ] for participant in collection : if dual : par_data = participant . data else : par_data = [ participant . data [ feature ] ] if missing_clean : participant_data = clean_missing1 ( par_data ) elif count : if standardise : participant_data = normalise ( feed_forward ( par_data , count = count , time = time , start_average = start_average , cumsum = cumsum ) , count = count , time = time ) else : participant_data = feed_forward ( par_data , count = count , time = time , start_average = start_average , cumsum = cumsum ) else : if standardise : if feedforward : participant_data = normalise ( feed_forward ( par_data , count = count , time = time , start_average = start_average , cumsum = cumsum ) , count = count , time = time ) else : participant_data = normalise ( list_to_num ( par_data ) , count = count , time = time ) else : if feedforward : participant_data = feed_forward ( par_data , count = count , time = time , start_average = start_average , cumsum = cumsum ) else : participant_data = list_to_num ( par_data ) if participant_data is not False : if naive : if len ( participant_data ) == 0 : x . append ( [ - 1 ] ) else : x . append ( [ np . sum ( participant_data ) / minlen ] ) else : x . append ( iisignature . sig ( participant_data , order ) ) y . append ( participant . nextdata [ feature ] ) return x , y
process data before fitting into machine learning models.
process data before fitting into machine learning models .
"""
    
          process data before fitting into machine learning models.
          
          
    Parameters
    ----------
    collection : list
        The out-of-sample set.
    order : int, optional
        Order of the signature.
        Default is 2.
        
    minlen: int
        the length of data considered for each patient.
        Default is 20.
    
    standardise: True or False
        whether or not the piece of data being standardised
    count: True or False
        whether or not the piece of data being counted for missing value
    
    feedforward: True or False
        whether or not the missing values in the piece of data is filled by feedforward function
        
    missing_clean:True or False
        whether or not the missing values in the piece of data is to be cleaned
    
    start_average: True or False
        whether or not the missing values at the beginning of the piece of data is filled by the average
    naive: True or False
        whether or not the navid method (by calculating the mean) is implemented
    time: True or False
        whether or not the time is included 
    
    cumsum: True or False
        whether or not the piece of data is being cumulated
        
    feature: which group we are considering
        Default: int(0), otherwise, int(1)/int(2)
        
    Returns
    -------
    
    x,y in appropriate form
    
    """
collection
minlen
order
standardise
count
feedforward
missing_clean
start_average
naive
time
cumsum
feature