code: def map_predict(interface, state, label, inp):
      import numpy as np
      out = interface.output(0)
      continuous = [j for i, j in enumerate(state["X_indices"]) if
                    state["X_meta"][i] == "c"]
      discrete = [j for i, j in enumerate(state["X_indices"]) if
                  state["X_meta"][i] == "d"]
      cont = True if len(continuous) > 0 else False
      disc = True if len(discrete) > 0 else False
      for row in inp:
          row = row.strip().split(state["delimiter"])
          if len(row) > 1:
              x_id = "" if state["id_index"] == -1 else row[state["id_index"]]
              probs = state["fit_model"]["prior_log"]
              if cont:
                  x = np.array([(0 if row[j] in state["missing_vals"] else float(row[j])) for j in
                                continuous])
                  probs = probs - 0.5 * np.sum(
                      np.true_divide((x - state["fit_model"]["mean"]) ** 2, state["fit_model"]["var"]) +
                      state["fit_model"]["var_log"], axis=1)
              if disc:
                  probs = probs + np.sum(
                      [(0 if row[i] in state["missing_vals"] else state["fit_model"].get((str(i), row[i]), np.zeros(1)))
                       for i in discrete], axis=0)
              log_prob_x = np.log(np.sum(np.exp(probs)))
              probs = np.exp(np.array(probs) - log_prob_x)
              y_predicted = max(zip(probs, state["fit_model"]["y_labels"]))[1]
              out.add(x_id, (y_predicted, probs.tolist()))