// 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;
package edu.stanford.nlp.semparse.open.model;


public class AdvancedWordVectorParamsFullRank extends AdvancedWordVectorParams {
  
  double[][] weights;
  
  // Shorthands for word vector dimension
  protected final int dim;
  
  public AdvancedWordVectorParamsFullRank() {
    dim = getDim();
    weights = new double[dim][dim];
    if (Params.opts.initWeightsRandomly) {
      for (int i = 0; i < dim; i++) {
        for (int j = 0; j < dim; j++) {
          weights[i][j] = 2 * Params.opts.initRandom.nextDouble() - 1;
        }
      }
    }
    initGradientStats();
  }
  
  // ============================================================
  // Get score
  // ============================================================

  @Override
// 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;

package edu.stanford.nlp.semparse.open.model;


public class AdvancedWordVectorParamsFullRank extends AdvancedWordVectorParams {
  
  double[][] weights;
  
  // Shorthands for word vector dimension
  protected final int dim;
  
  public AdvancedWordVectorParamsFullRank() {
    dim = getDim();
    weights = new double[dim][dim];
    if (Params.opts.initWeightsRandomly) {
      for (int i = 0; i < dim; i++) {
        for (int j = 0; j < dim; j++) {
          weights[i][j] = 2 * Params.opts.initRandom.nextDouble() - 1;
        }
      }
    }
    initGradientStats();
  }
  
  // ============================================================
  // Get score
  // ============================================================

  @Override
  public double getScore(Candidate candidate) {