spectrum_functions.py
def train(path,\
          order=2,\
          minlen=20,\
          standardise=True,\
          count=True,\
          feedforward=True,\
          missing_clean=False,\
          start_average=False, \
          naive=False,\
          time=False,\
          cumsum=True):
    
    """
    
            Trains the model, as specified in the original paper.

        Parameters
        ----------
        path : str
            Path of the pickle file containing the streams
            of data from the participant.
        order : int, optional
            Order of the signature.
            Default is 2.
        
        minlen: int; the length of data considered for each patient.
            Default is 20.
    
        standardise: data whether or not standardised
            Default True
        count: missing data count or not
            Default True
        missing_clean: rulling out missing data or not
            Default False
        start_average: if the firt element is missing, replace it with average or 0
            Default False
        naive: using merely mean value of each dimension

        cumsum: whether or not cumulate the data with time
            Default True

    Returns
    -------
        Model
            Trained model.

    """

    file = open(path,'rb')
    collection = pickle.load(file)
    file.close()
    random_state=42

    # Each clinical group is associated with a point on the
    # plane. These points were found using cross-valiation.

    
    x,y=data_model(collection,\
                   order=order,\
                   minlen=minlen,\
                   standardise=standardise,\
                   count=count,\
                   missing_clean=missing_clean,\
                   start_average=start_average, \
                   feedforward=feedforward,\
                   naive=naive,\
                   time=time,\
                   cumsum=cumsum)
    
    
    # We train the model using Random Forests.

    reg = OneVsRestClassifier(RandomForestClassifier(n_estimators=1500,random_state=random_state))

    
    reg.fit(x, y)

    # Return the trained model.
    return Model(rf)

    
            Trains the model, as specified in the original paper.

        Parameters
        ----------
        path : str
            Path of the pickle file containing the streams
            of data from the participant.
        order : int, optional
            Order of the signature.
            Default is 2.
        
        minlen: int; the length of data considered for each patient.
            Default is 20.
    
        standardise: data whether or not standardised
            Default True
        count: missing data count or not
            Default True
        missing_clean: rulling out missing data or not
            Default False
        start_average: if the firt element is missing, replace it with average or 0
            Default False
        naive: using merely mean value of each dimension

        cumsum: whether or not cumulate the data with time
            Default True

    Returns
    -------
        Model
            Trained model.

    
Trains the model, as specified in the original paper.
Parameters

path : str
Path of the pickle file containing the streams
of data from the participant.
order : int, optional
Order of the signature.
Default is 2.

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

data whether or not standardised
Default True
count: missing data count or not
Default True
missing_clean: rulling out missing data or not
Default False
start_average: if the firt element is missing, replace it with average or 0
Default False
naive: using merely mean value of each dimension

whether or not cumulate the data with time
Default True

Returns

Model
Trained model.
Trains the model as specified in the original paper . Parameters path : str Path of the pickle file containing the streams of data from the participant . order : int optional Order of the signature . Default is 2 . int ; the length of data considered for each patient . Default is 20 . data whether or not standardised Default True count : missing data count or not Default True missing_clean : rulling out missing data or not Default False start_average : if the firt element is missing replace it with average or 0 Default False naive : using merely mean value of each dimension whether or not cumulate the data with time Default True Returns Model Trained model .
def train(path,\
          order=2,\
          minlen=20,\
          standardise=True,\
          count=True,\
          feedforward=True,\
          missing_clean=False,\
          start_average=False, \
          naive=False,\
          time=False,\
          cumsum=True):
    file = open(path,'rb')
    collection = pickle.load(file)
    file.close()
    random_state=42
    x,y=data_model(collection,\
                   order=order,\
                   minlen=minlen,\
                   standardise=standardise,\
                   count=count,\
                   missing_clean=missing_clean,\
                   start_average=start_average, \
                   feedforward=feedforward,\
                   naive=naive,\
                   time=time,\
                   cumsum=cumsum)
    reg = OneVsRestClassifier(RandomForestClassifier(n_estimators=1500,random_state=random_state))
    reg.fit(x, y)
    return Model(rf)
def train ( path , order = 2 , minlen = 20 , standardise = True , count = True , feedforward = True , missing_clean = False , start_average = False , naive = False , time = False , cumsum = True ) : file = open ( path , 'rb' ) collection = pickle . load ( file ) file . close ( ) random_state = 42 x , y = data_model ( collection , order = order , minlen = minlen , standardise = standardise , count = count , missing_clean = missing_clean , start_average = start_average , feedforward = feedforward , naive = naive , time = time , cumsum = cumsum ) reg = OneVsRestClassifier ( RandomForestClassifier ( n_estimators = 1500 , random_state = random_state ) ) reg . fit ( x , y ) return Model ( rf )
Trains the model, as specified in the original paper.
Trains the model as specified in the original paper .
"""
    
            Trains the model, as specified in the original paper.

        Parameters
        ----------
        path : str
            Path of the pickle file containing the streams
            of data from the participant.
        order : int, optional
            Order of the signature.
            Default is 2.
        
        minlen: int; the length of data considered for each patient.
            Default is 20.
    
        standardise: data whether or not standardised
            Default True
        count: missing data count or not
            Default True
        missing_clean: rulling out missing data or not
            Default False
        start_average: if the firt element is missing, replace it with average or 0
            Default False
        naive: using merely mean value of each dimension

        cumsum: whether or not cumulate the data with time
            Default True

    Returns
    -------
        Model
            Trained model.

    """ # Each clinical group is associated with a point on the # plane. These points were found using cross-valiation. # We train the model using Random Forests. # Return the trained model.
path
order
minlen
standardise
count
feedforward
missing_clean
start_average
naive
time
cumsum