// Path: src/edu/stanford/nlp/semparse/open/model/candidate/Candidate.java
// public class Candidate {
//   public final Example ex;
//   public final CandidateGroup group;
//   public final TreePattern pattern;
//   public final List<String> predictedEntities;
//   public FeatureVector features;
//   
//   public Candidate(CandidateGroup group, TreePattern pattern) {
//     this.pattern = pattern;
//     this.group = group;
//     group.candidates.add(this);
//     // Perform shallow copy
//     this.ex = group.ex;
//     this.predictedEntities = group.predictedEntities;
//   }
//   
//   public int numEntities() {
//     return group.numEntities();
//   }
//   
//   public double getReward() {
//     return group.ex.expectedAnswer.reward(this);
//   }
//   
//   public Map<String, Double> getCombinedFeatures() {
//     Map<String, Double> map = new HashMap<>();
//     features.increment(1, map);
//     group.features.increment(1, map);
//     return map;
//   }
//   
//   // ============================================================
//   // Debug Print
//   // ============================================================
//   
//   public String sampleEntities() {
//     return group.sampleEntities();
//   }
//   
//   public String allEntities() {
//     return group.allEntities();
//   }
// }


import edu.stanford.nlp.semparse.open.model.candidate.Candidate;
import fig.basic.Fmt;
import fig.basic.LogInfo;
  // Logging
  // ============================================================

  @Override
  public void log() {
    LogInfo.begin_track("Advanced Word Vector Params");
    for (int i = 0; i < dim; i++) {
      StringBuilder sb = new StringBuilder();
      for (int j = 0; j < dim; j++) {
        sb.append(String.format("%10s ", Fmt.D(weights[i][j])));
      }
      LogInfo.log(sb.toString());
    }
    LogInfo.end_track();
  }

  @Override
  public void logFeatureWeights(Candidate candidate) {
    LogInfo.begin_track("Advanced Word Vector feature weights");
    double[] x = getX(candidate), y = getY(candidate);
    if (x == null) {
      LogInfo.log("NONE: x (query word vector) is null");
    } else if (y == null) {
      LogInfo.log("NONE: y (entities word vector) is null");
    } else {
      LogInfo.logs("Advanced Word Vector: %s", Fmt.D(getScore(x, y)));
    }
    LogInfo.end_track();
  }

// Path: src/edu/stanford/nlp/semparse/open/model/candidate/Candidate.java
// public class Candidate {
//   public final Example ex;
//   public final CandidateGroup group;
//   public final TreePattern pattern;
//   public final List<String> predictedEntities;
//   public FeatureVector features;
//   
//   public Candidate(CandidateGroup group, TreePattern pattern) {
//     this.pattern = pattern;
//     this.group = group;
//     group.candidates.add(this);
//     // Perform shallow copy
//     this.ex = group.ex;
//     this.predictedEntities = group.predictedEntities;
//   }
//   
//   public int numEntities() {
//     return group.numEntities();
//   }
//   
//   public double getReward() {
//     return group.ex.expectedAnswer.reward(this);
//   }
//   
//   public Map<String, Double> getCombinedFeatures() {
//     Map<String, Double> map = new HashMap<>();
//     features.increment(1, map);
//     group.features.increment(1, map);
//     return map;
//   }
//   
//   // ============================================================
//   // Debug Print
//   // ============================================================
//   
//   public String sampleEntities() {
//     return group.sampleEntities();
//   }
//   
//   public String allEntities() {
//     return group.allEntities();
//   }
// }


// Path: src/edu/stanford/nlp/semparse/open/model/AdvancedWordVectorParamsFullRank.java
import edu.stanford.nlp.semparse.open.model.candidate.Candidate;
import fig.basic.Fmt;
import fig.basic.LogInfo;

  // Logging
  // ============================================================

  @Override
  public void log() {
    LogInfo.begin_track("Advanced Word Vector Params");
    for (int i = 0; i < dim; i++) {
      StringBuilder sb = new StringBuilder();
      for (int j = 0; j < dim; j++) {
        sb.append(String.format("%10s ", Fmt.D(weights[i][j])));
      }
      LogInfo.log(sb.toString());
    }
    LogInfo.end_track();
  }

  @Override
  public void logFeatureWeights(Candidate candidate) {
    LogInfo.begin_track("Advanced Word Vector feature weights");
    double[] x = getX(candidate), y = getY(candidate);
    if (x == null) {
      LogInfo.log("NONE: x (query word vector) is null");
    } else if (y == null) {
      LogInfo.log("NONE: y (entities word vector) is null");
    } else {
      LogInfo.logs("Advanced Word Vector: %s", Fmt.D(getScore(x, y)));
    }
    LogInfo.end_track();
  }

  @Override