spectrum_functions.py
def test(self,\
             path,\
             order=2,\
             standardise=True,\
             count=True,\
             feedforward=True,\
             missing_clean=False,\
             start_average=False,\
             naive=False,\
             time=False,\
             cumsum=True):
        """Tests the model against a particular participant.

        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
        -------
        list
            3-dimensional vector indicating how often the participant
            has buckets that were classified in each clinical group.

        """

        # We load the pickle file of the participant
        file = open(path,'rb')
        collection = pickle.load(file)
        file.close()


        # We construct the inputs and outputs to test the model
        
    
        #data handling for classification task   

        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 find the predictions corresponding to the computed inputs


        predicted = self.rf.predict(x)
        
        # We find which group the predictions belong to, and
        # store how often the participant belongs to each group
        vector = np.zeros(3)

        for i in range(len(x)):
        
            vector[int(predicted[i])] += 1

            
        
        vector /= float(len(x))
        return vector
Tests the model against a particular participant.

        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
        -------
        list
            3-dimensional vector indicating how often the participant
            has buckets that were classified in each clinical group.

        
Tests the model against a particular participant.
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

list
3-dimensional vector indicating how often the participant
has buckets that were classified in each clinical group.
Tests the model against a particular participant . 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 list 3 - dimensional vector indicating how often the participant has buckets that were classified in each clinical group .
def test(self,\
             path,\
             order=2,\
             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()
        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)
        predicted = self.rf.predict(x)
        vector = np.zeros(3)
        for i in range(len(x)):
            vector[int(predicted[i])] += 1
        vector /= float(len(x))
        return vector
def test ( self , path , order = 2 , 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 ( ) 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 ) predicted = self . rf . predict ( x ) vector = np . zeros ( 3 ) for i in range ( len ( x ) ) : vector [ int ( predicted [ i ] ) ] += 1 vector /= float ( len ( x ) ) return vector
Tests the model against a particular participant.
Tests the model against a particular participant .
"""Tests the model against a particular participant.

        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
        -------
        list
            3-dimensional vector indicating how often the participant
            has buckets that were classified in each clinical group.

        """ # We load the pickle file of the participant # We construct the inputs and outputs to test the model #data handling for classification task    # We find the predictions corresponding to the computed inputs # We find which group the predictions belong to, and # store how often the participant belongs to each group
self
path
order
standardise
count
feedforward
missing_clean
start_average
naive
time
cumsum