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


    
    """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


    Returns
    -------
    
    x,y in appropriate form
    
    """


    x=[]
    y=[]


    for participant in collection:

        par_data=participant.data

        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),\
                                           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),\
                                               cumsum=cumsum,\
                                               count=count,\
                                               time=time)

                else:
                    participant_data=normalise(list_to_num(par_data),\
                                               count=count,\
                                               time=time,\
                                               cumsum=cumsum)
            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 missing_clean:

                    x.append(np.sum(participant_data,axis=0)/minlen)
                else:
                    x.append(np.sum(list_to_num(par_data),axis=0)/minlen)
            else:
                    x.append(iisignature.sig(participant_data, order))
            

            y.append(participant.diagnosis)

    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


    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

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

True or False
whether or not the navid method (by calculating the mean) is implemented

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 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 True or False whether or not the navid method ( by calculating the mean ) is implemented 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, order=2,minlen=20, standardise=True, count=True, feedforward=True,\
               missing_clean=False,start_average=False, naive=False,time=True,cumsum=True):
    x=[]
    y=[]
    for participant in collection:
        par_data=participant.data
        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),\
                                           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),\
                                               cumsum=cumsum,\
                                               count=count,\
                                               time=time)
                else:
                    participant_data=normalise(list_to_num(par_data),\
                                               count=count,\
                                               time=time,\
                                               cumsum=cumsum)
            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 missing_clean:
                    x.append(np.sum(participant_data,axis=0)/minlen)
                else:
                    x.append(np.sum(list_to_num(par_data),axis=0)/minlen)
            else:
                    x.append(iisignature.sig(participant_data, order))
            y.append(participant.diagnosis)
    return x,y
def data_model ( collection , order = 2 , minlen = 20 , standardise = True , count = True , feedforward = True , missing_clean = False , start_average = False , naive = False , time = True , cumsum = True ) : x = [ ] y = [ ] for participant in collection : par_data = participant . data 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 ) , 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 ) , cumsum = cumsum , count = count , time = time ) else : participant_data = normalise ( list_to_num ( par_data ) , count = count , time = time , cumsum = cumsum ) 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 missing_clean : x . append ( np . sum ( participant_data , axis = 0 ) / minlen ) else : x . append ( np . sum ( list_to_num ( par_data ) , axis = 0 ) / minlen ) else : x . append ( iisignature . sig ( participant_data , order ) ) y . append ( participant . diagnosis ) 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


    Returns
    -------
    
    x,y in appropriate form
    
    """
collection
order
minlen
standardise
count
feedforward
missing_clean
start_average
naive
time
cumsum