classifiers.py
def model_onego(Participants, minlen, training=0.7, sample_size=50, \
                start_average=False, cv=False,cumsum=True, class_=None):

    """
            trying models with different parameters in len(set) or order in one-go.

     Parameters
     ----------
     Participants: class of participants for the corresponding 2 tests

     minlen: num
         size of each participant data.
     training : scalar
         Training set proportional.
     sample_size: number for loop
         Default is 50
     start_average: if the firt element is missing, replace it with average or 0
         Default False
     cv: True or False
        whether or not using cross_validation for random forest
     cumsum: True or False
        whether or not the piece of data is being cumulated        
    class_: on the whole set (None) or on 0/1/2 groups
        default: None
    
     Returns
     -------

     mean_accuracy: average accuracy for each case

    """  

    random.seed(42)
    
    standardise_set=[False,True, True]
    count_set=[False, True,True]
    feedforward_set=[False,True,True]
    naive_set=[True, False,False]
    time_set=[False, True,True]
    missingclean_set=[False, False, False]


    order_set=[None, 2,3]
    col_num=len(standardise_set)    
    
    mean_accuracy=np.zeros(col_num)
    mean_CM=[np.zeros((3,3)) for j in  range(col_num)]
    
    accuracy_collections=[[] for j in  range(col_num)]
  
 
    for i in range(sample_size):


            #####################################################################################
            #################### Test on pair of sum scores from ALTMAN+QIDS ####################
             #####################################################################################

                train_set, test_set = buildData(Participants,\
                                                training=training,\
                                                minlen=minlen,\
                                                class_=class_)

                for j in range(col_num):
                
                    X_train,y_train=data_model(train_set,minlen=minlen,\
                                               order=order_set[j],\
                                               standardise=standardise_set[j],\
                                               count=count_set[j],\
                                               missing_clean=missingclean_set[j], \
                                               start_average=start_average,\
                                               feedforward=feedforward_set[j],\
                                               naive=naive_set[j],\
                                               time=time_set[j],\
                                               cumsum=cumsum)
                    


                    X_test,y_test=data_model(test_set,minlen=minlen, \
                                             order=order_set[j],\
                                             standardise=standardise_set[j], \
                                             count=count_set[j],\
                                             missing_clean=missingclean_set[j], \
                                             start_average=start_average,\
                                             feedforward=feedforward_set[j],\
                                             naive=naive_set[j],\
                                             time=time_set[j],\
                                             cumsum=cumsum)

                    if cv:
                        accuracy= rf_cv(X_train,y_train,X_test,y_test,threshold)
                    else:

                        CM,accuracy= rf_model(X_train,y_train,X_test,y_test,threshold,regression=regression)
                            
                        mean_CM[j]+=CM
                        
                    mean_accuracy[j]+=accuracy/sample_size
                    accuracy_collections[j].append(accuracy)
                    


        
        return mean_CM, mean_accuracy,accuracy_collections

            trying models with different parameters in len(set) or order in one-go.

     Parameters
     ----------
     Participants: class of participants for the corresponding 2 tests

     minlen: num
         size of each participant data.
     training : scalar
         Training set proportional.
     sample_size: number for loop
         Default is 50
     start_average: if the firt element is missing, replace it with average or 0
         Default False
     cv: True or False
        whether or not using cross_validation for random forest
     cumsum: True or False
        whether or not the piece of data is being cumulated        
    class_: on the whole set (None) or on 0/1/2 groups
        default: None
    
     Returns
     -------

     mean_accuracy: average accuracy for each case

    
trying models with different parameters in len(set) or order in one-go.
Parameters

class of participants for the corresponding 2 tests

num
size of each participant data.
training : scalar
Training set proportional.

Returns

average accuracy for each case
trying models with different parameters in len ( set ) or order in one - go . Parameters class of participants for the corresponding 2 tests num size of each participant data . training : scalar Training set proportional . Returns average accuracy for each case
def model_onego(Participants, minlen, training=0.7, sample_size=50, \
                start_average=False, cv=False,cumsum=True, class_=None):
    random.seed(42)
    standardise_set=[False,True, True]
    count_set=[False, True,True]
    feedforward_set=[False,True,True]
    naive_set=[True, False,False]
    time_set=[False, True,True]
    missingclean_set=[False, False, False]
    order_set=[None, 2,3]
    col_num=len(standardise_set)    
    mean_accuracy=np.zeros(col_num)
    mean_CM=[np.zeros((3,3)) for j in  range(col_num)]
    accuracy_collections=[[] for j in  range(col_num)]
    for i in range(sample_size):
                train_set, test_set = buildData(Participants,\
                                                training=training,\
                                                minlen=minlen,\
                                                class_=class_)
                for j in range(col_num):
                    X_train,y_train=data_model(train_set,minlen=minlen,\
                                               order=order_set[j],\
                                               standardise=standardise_set[j],\
                                               count=count_set[j],\
                                               missing_clean=missingclean_set[j], \
                                               start_average=start_average,\
                                               feedforward=feedforward_set[j],\
                                               naive=naive_set[j],\
                                               time=time_set[j],\
                                               cumsum=cumsum)
                    X_test,y_test=data_model(test_set,minlen=minlen, \
                                             order=order_set[j],\
                                             standardise=standardise_set[j], \
                                             count=count_set[j],\
                                             missing_clean=missingclean_set[j], \
                                             start_average=start_average,\
                                             feedforward=feedforward_set[j],\
                                             naive=naive_set[j],\
                                             time=time_set[j],\
                                             cumsum=cumsum)
                    if cv:
                        accuracy= rf_cv(X_train,y_train,X_test,y_test,threshold)
                    else:
                        CM,accuracy= rf_model(X_train,y_train,X_test,y_test,threshold,regression=regression)
                        mean_CM[j]+=CM
                    mean_accuracy[j]+=accuracy/sample_size
                    accuracy_collections[j].append(accuracy)
        return mean_CM, mean_accuracy,accuracy_collections
def model_onego ( Participants , minlen , training = 0.7 , sample_size = 50 , start_average = False , cv = False , cumsum = True , class_ = None ) : random . seed ( 42 ) standardise_set = [ False , True , True ] count_set = [ False , True , True ] feedforward_set = [ False , True , True ] naive_set = [ True , False , False ] time_set = [ False , True , True ] missingclean_set = [ False , False , False ] order_set = [ None , 2 , 3 ] col_num = len ( standardise_set ) mean_accuracy = np . zeros ( col_num ) mean_CM = [ np . zeros ( ( 3 , 3 ) ) for j in range ( col_num ) ] accuracy_collections = [ [ ] for j in range ( col_num ) ] for i in range ( sample_size ) : train_set , test_set = buildData ( Participants , training = training , minlen = minlen , class_ = class_ ) for j in range ( col_num ) : X_train , y_train = data_model ( train_set , minlen = minlen , order = order_set [ j ] , standardise = standardise_set [ j ] , count = count_set [ j ] , missing_clean = missingclean_set [ j ] , start_average = start_average , feedforward = feedforward_set [ j ] , naive = naive_set [ j ] , time = time_set [ j ] , cumsum = cumsum ) X_test , y_test = data_model ( test_set , minlen = minlen , order = order_set [ j ] , standardise = standardise_set [ j ] , count = count_set [ j ] , missing_clean = missingclean_set [ j ] , start_average = start_average , feedforward = feedforward_set [ j ] , naive = naive_set [ j ] , time = time_set [ j ] , cumsum = cumsum ) if cv : accuracy = rf_cv ( X_train , y_train , X_test , y_test , threshold ) else : CM , accuracy = rf_model ( X_train , y_train , X_test , y_test , threshold , regression = regression ) mean_CM [ j ] += CM mean_accuracy [ j ] += accuracy / sample_size accuracy_collections [ j ] . append ( accuracy ) return mean_CM , mean_accuracy , accuracy_collections
trying models with different parameters in len(set) or order in one-go.
trying models with different parameters in len ( set ) or order in one - go .
"""
            trying models with different parameters in len(set) or order in one-go.

     Parameters
     ----------
     Participants: class of participants for the corresponding 2 tests

     minlen: num
         size of each participant data.
     training : scalar
         Training set proportional.
     sample_size: number for loop
         Default is 50
     start_average: if the firt element is missing, replace it with average or 0
         Default False
     cv: True or False
        whether or not using cross_validation for random forest
     cumsum: True or False
        whether or not the piece of data is being cumulated        
    class_: on the whole set (None) or on 0/1/2 groups
        default: None
    
     Returns
     -------

     mean_accuracy: average accuracy for each case

    """ ##################################################################################### #################### Test on pair of sum scores from ALTMAN+QIDS #################### #####################################################################################
Participants
minlen
training
sample_size
start_average
cv
cumsum
class_