parameters: (self, premodel_settings, session_type)
return_statement: return False
docstring: This method validates the premodel settings for the 'data_new',
          'data_append', 'model_generate', or 'model_predict' sessions.
  
          Note: This method does not validate the associated 'file upload(s)',
                which is the responsibility of the mongodb query process.
function: def validate_settings(self, premodel_settings, session_type):
          '''
  
          This method validates the premodel settings for the 'data_new',
          'data_append', 'model_generate', or 'model_predict' sessions.
  
          Note: This method does not validate the associated 'file upload(s)',
                which is the responsibility of the mongodb query process.
  
          '''
  
          # local variables
          model_type = current_app.config.get('MODEL_TYPE')
          dataset_type = current_app.config.get('DATASET_TYPE')
          sv_kernel_type = current_app.config.get('SV_KERNEL_TYPE')
  
          # validation on 'data_new', 'data_append' session
          if session_type in ['data_new', 'data_append']:
              if premodel_settings['stream'] == 'True' or session_type == 'data_new':
                  schema = Schema({
                      Required('collection'): All(unicode, Length(min=1)),
                      Required('dataset_type'): In(dataset_type),
                      Required('model_type'): In(model_type),
                      Required('session_type'): Any('data_new', 'data_append'),
                      Required('session_name'): All(unicode, Length(min=1)),
                      Optional('stream'): Any('True', 'False'),
                  })
  
              else:
                  schema = Schema({
                      Required('collection'): All(unicode, Length(min=1)),
                      Required('dataset_type'): In(dataset_type),
                      Required('model_type'): In(model_type),
                      Required('session_type'): Any('data_new', 'data_append'),
                      Optional('stream'): Any('True', 'False'),
                  })
  
          # validation on 'model_generate' session
          if session_type == 'model_generate':
              schema = Schema({
                  Required('collection'): All(unicode, Length(min=1)),
                  Required('model_type'): In(model_type),
                  Required('session_type'): 'model_generate',
                  Optional('stream'): Any('True', 'False'),
                  Required('sv_kernel_type'): In(sv_kernel_type),
                  Optional('gamma'): Any(Coerce(int), Coerce(float)),
                  Optional('penalty'): Any(Coerce(int), Coerce(float)),
              })
  
          # validation on 'model_predict' session
          elif session_type == 'model_predict':
              schema = Schema({
                  Required('collection'): All(unicode, Length(min=1)),
                  Optional('stream'): Any('True', 'False'),
                  Required('prediction_input[]'): [
                      Any(Coerce(int), Coerce(float)),
                  ],
                  Required('session_type'): 'model_predict',
              })
  
          try:
              validate_with_humanized_errors(premodel_settings, schema)
  
          except Exception, error:
              split_error = str(error).splitlines()
              self.list_error.append(split_error)
              return split_error
  
          return False
function_tokens: def validate_settings ( self , premodel_settings , session_type ) : # local variables model_type = current_app . config . get ( 'MODEL_TYPE' ) dataset_type = current_app . config . get ( 'DATASET_TYPE' ) sv_kernel_type = current_app . config . get ( 'SV_KERNEL_TYPE' ) # validation on 'data_new', 'data_append' session if session_type in [ 'data_new' , 'data_append' ] : if premodel_settings [ 'stream' ] == 'True' or session_type == 'data_new' : schema = Schema ( { Required ( 'collection' ) : All ( unicode , Length ( min = 1 ) ) , Required ( 'dataset_type' ) : In ( dataset_type ) , Required ( 'model_type' ) : In ( model_type ) , Required ( 'session_type' ) : Any ( 'data_new' , 'data_append' ) , Required ( 'session_name' ) : All ( unicode , Length ( min = 1 ) ) , Optional ( 'stream' ) : Any ( 'True' , 'False' ) , } ) else : schema = Schema ( { Required ( 'collection' ) : All ( unicode , Length ( min = 1 ) ) , Required ( 'dataset_type' ) : In ( dataset_type ) , Required ( 'model_type' ) : In ( model_type ) , Required ( 'session_type' ) : Any ( 'data_new' , 'data_append' ) , Optional ( 'stream' ) : Any ( 'True' , 'False' ) , } ) # validation on 'model_generate' session if session_type == 'model_generate' : schema = Schema ( { Required ( 'collection' ) : All ( unicode , Length ( min = 1 ) ) , Required ( 'model_type' ) : In ( model_type ) , Required ( 'session_type' ) : 'model_generate' , Optional ( 'stream' ) : Any ( 'True' , 'False' ) , Required ( 'sv_kernel_type' ) : In ( sv_kernel_type ) , Optional ( 'gamma' ) : Any ( Coerce ( int ) , Coerce ( float ) ) , Optional ( 'penalty' ) : Any ( Coerce ( int ) , Coerce ( float ) ) , } ) # validation on 'model_predict' session elif session_type == 'model_predict' : schema = Schema ( { Required ( 'collection' ) : All ( unicode , Length ( min = 1 ) ) , Optional ( 'stream' ) : Any ( 'True' , 'False' ) , Required ( 'prediction_input[]' ) : [ Any ( Coerce ( int ) , Coerce ( float ) ) , ] , Required ( 'session_type' ) : 'model_predict' , } ) try : validate_with_humanized_errors ( premodel_settings , schema ) except Exception , error : split_error = str ( error ) . splitlines ( ) self . list_error . append ( split_error ) return split_error return False