code: def main(opt):
      """Main routine that exits with status code 0"""
  
      ### pre process
  
      # load model file
      clr = pickle.load(opt.model)
      clr_info = pickle.load(opt.model)
  
      # read data
      D = np.loadtxt(opt.infile)
  
      # split data and process missing values
      y = np.array(D[:, -1])
      if opt.ns:
          X = fill_missing_with_mean(D[:, : -(1 + N_NS)])
      else:
          X = fill_missing_with_mean(D[:, :-1])
      S = np.atleast_2d(D[:, -(1 + N_NS) : -1])
  
      ### main process
  
      # set starting time
      start_time = datetime.datetime.now()
      start_utime = os.times()[0]
      opt.start_time = start_time.isoformat()
      logger.info("start time = " + start_time.isoformat())
  
      # prediction and write results
      p = clr.predict_proba(X)
  
      # output prediction
      n = 0
      m = 0
      for i in range(p.shape[0]):
          c = np.argmax(p[i, :])
          opt.outfile.write("%d %d " % (y[i], c))
          opt.outfile.write(" ".join(S[i, :].astype(str)) + " ")
          opt.outfile.write(str(p[i, 0]) + " " + str(p[i, 1]) + "\n")
          n += 1
          m += 1 if c == y[i] else 0
  
      # set end and elapsed time
      end_time = datetime.datetime.now()
      end_utime = os.times()[0]
      logger.info("end time = " + end_time.isoformat())
      opt.end_time = end_time.isoformat()
      logger.info("elapsed_time = " + str((end_time - start_time)))
      opt.elapsed_time = str((end_time - start_time))
      logger.info("elapsed_utime = " + str((end_utime - start_utime)))
      opt.elapsed_utime = str((end_utime - start_utime))
  
      ### output
  
      # add meta info
      opt.nos_samples = n
      logger.info("nos_samples = " + str(opt.nos_samples))
      opt.nos_correct_samples = m
      logger.info(
          "nos_correct_samples = " + str(opt.nos_correct_samples)
      )
      opt.accuracy = m / float(n)
      logger.info("accuracy = " + str(opt.accuracy))
      opt.negative_mean_prob = np.mean(p[:, 0])
      logger.info("negative_mean_prob = " + str(opt.negative_mean_prob))
      opt.positive_mean_prob = np.mean(p[:, 1])
      logger.info("positive_mean_prob = " + str(opt.positive_mean_prob))
  
      # output meta information
      if opt.info:
          for key in clr_info.keys():
              opt.outfile.write(
                  "#classifier_%s=%s\n" % (key, str(clr_info[key]))
              )
  
          for key, key_val in vars(opt).items():
              opt.outfile.write("#%s=%s\n" % (key, str(key_val)))
  
      ### post process
  
      # close file
      if opt.infile != sys.stdin:
          opt.infile.close()
  
      if opt.outfile != sys.stdout:
          opt.outfile.close()
  
      if opt.model != sys.stdout:
          opt.model.close()
  
      sys.exit(0)
  
file_path: AIF360/aif360/algorithms/inprocessing/kamfadm-2012ecmlpkdd/predict_lr.py
imports: import sys
  import argparse
  import os
  import platform
  from subprocess import getoutput
  import logging
  import datetime
  import pickle
  import numpy
  from fadm.util import fill_missing_with_mean
label_desc: Use image node_id 1 for calling a global function with example usage: main(opt) without return types