data_transforms.py
def normalise(data,cumsum=True,count=True,time=True):
    """Normalises the data of the patient with missing count.

    Parameters
    ----------
    data : two dim data, consisting of ALTMAN and QIDS scores


    Returns
    -------
    normalised_data: data that are normalised and cumulated.

    """

    normalised_data=np.zeros((data.shape[0],data.shape[1]))

    scoreMAX=[20,27]
    scoreMIN=[0,0]

    if count:
        if time:
            len_data=data.shape[1]-2
        else:
            len_data=data.shape[1]-1
    else:
        len_data=data.shape[1]

    for i in range(len_data):

        for j in range(data.shape[0]):
            
            normalised_data[j][i]=standardise1(data[j][i],scoreMIN[i],scoreMAX[i])

            if j>0:
                    normalised_data[j][i]+=normalised_data[j-1][i]


    if count:
        if time:
            for kk in range(len(data[:,-1])):
                normalised_data[kk][-1]=standardise(data[kk][-1],0,data[-1][-1])
            
            if cumsum and data[-1][-2]!=0:
                for jj in range(len(data[:,-2])):
                    normalised_data[jj][-2]=standardise(data[jj][-2],0,data[-1][-2])

        else:
            if cumsum and data[-1][-1]!=0:
                for jjj in range(len(data[:,-1])):
                    normalised_data[jjj][-1]=standardise(data[jjj][-1],0,data[-1][-1])
                    
#         if data[0][-1]!=data[-1][-1]:
#             for j in range(len(data[:,-1])):
#                 normalised_data[j][-1]=standardise(data[j][-1],data[0][-1],data[-1][-1])
#         if time:
#      #       if data[-1][-2]!=0:
#                 for jj in range(len(data[:,-2])):
#                     normalised_data[jj][-2]=standardise(data[jj][-2],data[0][-2],data[-1][-2])
   
    
    return normalised_data
Normalises the data of the patient with missing count.

    Parameters
    ----------
    data : two dim data, consisting of ALTMAN and QIDS scores


    Returns
    -------
    normalised_data: data that are normalised and cumulated.

    
Normalises the data of the patient with missing count.
Parameters

data : two dim data, consisting of ALTMAN and QIDS scores

Returns

data that are normalised and cumulated.
Normalises the data of the patient with missing count . Parameters data : two dim data consisting of ALTMAN and QIDS scores Returns data that are normalised and cumulated .
def normalise(data,cumsum=True,count=True,time=True):
    normalised_data=np.zeros((data.shape[0],data.shape[1]))
    scoreMAX=[20,27]
    scoreMIN=[0,0]
    if count:
        if time:
            len_data=data.shape[1]-2
        else:
            len_data=data.shape[1]-1
    else:
        len_data=data.shape[1]
    for i in range(len_data):
        for j in range(data.shape[0]):
            normalised_data[j][i]=standardise1(data[j][i],scoreMIN[i],scoreMAX[i])
            if j>0:
                    normalised_data[j][i]+=normalised_data[j-1][i]
    if count:
        if time:
            for kk in range(len(data[:,-1])):
                normalised_data[kk][-1]=standardise(data[kk][-1],0,data[-1][-1])
            if cumsum and data[-1][-2]!=0:
                for jj in range(len(data[:,-2])):
                    normalised_data[jj][-2]=standardise(data[jj][-2],0,data[-1][-2])
        else:
            if cumsum and data[-1][-1]!=0:
                for jjj in range(len(data[:,-1])):
                    normalised_data[jjj][-1]=standardise(data[jjj][-1],0,data[-1][-1])
    return normalised_data
def normalise ( data , cumsum = True , count = True , time = True ) : normalised_data = np . zeros ( ( data . shape [ 0 ] , data . shape [ 1 ] ) ) scoreMAX = [ 20 , 27 ] scoreMIN = [ 0 , 0 ] if count : if time : len_data = data . shape [ 1 ] - 2 else : len_data = data . shape [ 1 ] - 1 else : len_data = data . shape [ 1 ] for i in range ( len_data ) : for j in range ( data . shape [ 0 ] ) : normalised_data [ j ] [ i ] = standardise1 ( data [ j ] [ i ] , scoreMIN [ i ] , scoreMAX [ i ] ) if j > 0 : normalised_data [ j ] [ i ] += normalised_data [ j - 1 ] [ i ] if count : if time : for kk in range ( len ( data [ : , - 1 ] ) ) : normalised_data [ kk ] [ - 1 ] = standardise ( data [ kk ] [ - 1 ] , 0 , data [ - 1 ] [ - 1 ] ) if cumsum and data [ - 1 ] [ - 2 ] != 0 : for jj in range ( len ( data [ : , - 2 ] ) ) : normalised_data [ jj ] [ - 2 ] = standardise ( data [ jj ] [ - 2 ] , 0 , data [ - 1 ] [ - 2 ] ) else : if cumsum and data [ - 1 ] [ - 1 ] != 0 : for jjj in range ( len ( data [ : , - 1 ] ) ) : normalised_data [ jjj ] [ - 1 ] = standardise ( data [ jjj ] [ - 1 ] , 0 , data [ - 1 ] [ - 1 ] ) return normalised_data
Normalises the data of the patient with missing count.
Normalises the data of the patient with missing count .
"""Normalises the data of the patient with missing count.

    Parameters
    ----------
    data : two dim data, consisting of ALTMAN and QIDS scores


    Returns
    -------
    normalised_data: data that are normalised and cumulated.

    """ #         if data[0][-1]!=data[-1][-1]: #             for j in range(len(data[:,-1])): #                 normalised_data[j][-1]=standardise(data[j][-1],data[0][-1],data[-1][-1]) #         if time: #      #       if data[-1][-2]!=0: #                 for jj in range(len(data[:,-2])): #                     normalised_data[jj][-2]=standardise(data[jj][-2],data[0][-2],data[-1][-2])
data
cumsum
count
time