def predict(self,exp_uid,args_json,db,ell):
    """
    Have the model learned by some particular algorithm predict a variety of stuff 

    Expected input (in json structure with string keys):
      (string) predict_id : identifier for the desired prediction
      (list) params : dictionary of stat_id specific fields.


    ##########
    Description: Each algorithm (with an associated alg_label) has a test_alg_label associated with it. 

    Expected input:
      (string) predict_id : 'evaluate_on_test'
      (dict) params : dictionary with fields
          (string) alg_label : describes target algorithm to test
          (string) test_alg_label : describes the algorithm that whos triplets are evaluated on the target algorithm

    Expected output (in json structure):
      (float) num_reported_answers : number of reported answers after which the calculation was made
      (float) error : 0/1 loss on test set
    """

    try:
      app_id = self.app_id

      log_entry = { 'exp_uid':exp_uid,'task':'predict','json':args_json,'timestamp':utils.datetimeNow() } 
      ell.log( app_id+':APP-CALL', log_entry  )

      # convert args_json to args_dict
      try:
        args_dict = json.loads(args_json)
      except:
        error = "%s.predict input args_json is in improper format" % self.app_id
        return '{}',False,error

      # check for the fields that must be contained in args or error occurs
      necessary_fields = ['predict_id','params']
      for field in necessary_fields:
        try:
          args_dict[field]
        except KeyError:
          error = "%s.predict input arguments missing field: %s" % (self.app_id,str(field)) 
          return '{}',False,error

      predict_id = args_dict['predict_id']
      params = args_dict['params']

      alg_label = params['alg_label']

      # get list of algorithms associated with project
      alg_list,didSucceed,message = db.get(app_id+':experiments',exp_uid,'alg_list')
      
      # get alg_id
      for algorithm in alg_list:
        if alg_label == algorithm['alg_label']:
          alg_id = algorithm['alg_id']
          alg_uid = algorithm['alg_uid']

      meta = {}
      if predict_id=='get_embedding':

        # get sandboxed database for the specific app_id,alg_id,exp_uid - closing off the rest of the database to the algorithm
        rc = ResourceClient(app_id,exp_uid,alg_uid,db)

        # get specific algorithm to make calls to 
        alg = utils.get_app_alg(self.app_id,alg_id)

        ##### Get Embedding #####
        Xd,num_reported_answers,dt = utils.timeit(alg.predict)(rc)

        log_entry_durations = { 'exp_uid':exp_uid,'alg_uid':alg_uid,'task':'predict','duration':dt } 
        log_entry_durations.update( rc.getDurations() )
        meta = {'log_entry_durations':log_entry_durations}

        params['Xd'] = Xd
        params['num_reported_answers'] = num_reported_answers

        log_entry = { 'exp_uid':exp_uid,'alg_uid':alg_uid,'timestamp':utils.datetimeNow() } 
        log_entry.update( params )

        ell.log( app_id+':ALG-EVALUATION', log_entry  )

        params['timestamp'] = str(log_entry['timestamp'])
        response_args_dict = params

      elif predict_id=='get_queries':

        # get list of triplets from test
        queries,didSucceed,message = db.get_docs_with_filter(app_id+':queries',{'alg_uid':alg_uid})

        S = []
        for query in queries:
          if 'q' in query.keys():
            q = query['q']
            S.append(q)

        params['queries'] = S
        params['num_reported_answers'] = len(S)
        response_args_dict = params


      args_out = {'args':response_args_dict,'meta':meta}
      predict_json = json.dumps(args_out)

      log_entry = { 'exp_uid':exp_uid,'task':'predict','json':predict_json,'timestamp':utils.datetimeNow() } 
      ell.log( app_id+':APP-RESPONSE', log_entry  )

      return predict_json,True,''
    except Exception, err:
      error = traceback.format_exc()
      log_entry = { 'exp_uid':exp_uid,'task':'predict','error':str(error),'timestamp':utils.datetimeNow() } 
      didSucceed,message = ell.log( app_id+':APP-EXCEPTION', log_entry  )
      return '{}',False,error
dataset/ETHPy150Open nextml/NEXT/next/apps/PoolBasedTripletMDS/PoolBasedTripletMDS.py/PoolBasedTripletMDS.predict/original