private int getPredIndex(String predicate) { return pmap.get(predicate); }
public GISModelWriter(AbstractModel model) { Object[] data = model.getDataStructures(); PARAMS = (Context[]) data[0]; IndexHashTable<String> pmap = (IndexHashTable<String>) data[1]; OUTCOME_LABELS = (String[]) data[2]; CORRECTION_CONSTANT = (Integer) data[3]; CORRECTION_PARAM = (Double) data[4]; PRED_LABELS = new String[pmap.size()]; pmap.toArray(PRED_LABELS); }
private void init(String[] predLabels, String[] outcomeNames){ this.pmap = new IndexHashTable<String>(predLabels, 0.7d); this.outcomeNames = outcomeNames; }
/** * Retrieves the index for the specified key. * * @param key * @return the index or -1 if there is no entry to the keys */ public int get(T key) { int startIndex = indexForHash(key.hashCode(), keys.length); int index = searchKey(startIndex, key, false); if (index != -1) { return values[index]; } else { return -1; } }
int paraIdx = oi * pmap.size() + predIdx;
/** * Retrieves the index for the specified key. * * @param key * @return the index or -1 if there is no entry to the keys */ public int get(T key) { int startIndex = indexForHash(key.hashCode(), keys.length); int index = searchKey(startIndex, key, false); if (index != -1) { return values[index]; } else { return -1; } }
int paraIdx = oi * pmap.size() + predIdx;
public GISModelWriter(AbstractModel model) { Object[] data = model.getDataStructures(); PARAMS = (Context[]) data[0]; IndexHashTable<String> pmap = (IndexHashTable<String>) data[1]; OUTCOME_LABELS = (String[]) data[2]; CORRECTION_CONSTANT = (Integer) data[3]; CORRECTION_PARAM = (Double) data[4]; PRED_LABELS = new String[pmap.size()]; pmap.toArray(PRED_LABELS); }
private int getPredIndex(String predicate) { return pmap.get(predicate); }
int startIndex = indexForHash(mapping[i].hashCode(), keys.length); int index = searchKey(startIndex, null, true);
private void init(String[] predLabels, String[] outcomeNames){ this.pmap = new IndexHashTable<String>(predLabels, 0.7d); this.outcomeNames = outcomeNames; }
@SuppressWarnings("unchecked") private void initialise() { Object[] dataStructures = maxentModel.getDataStructures(); outcomeNames = (String[]) dataStructures[2]; TreeSet<String> outcomeSet = new TreeSet<String>(); for (String outcome : outcomeNames) outcomeSet.add(outcome); outcomeList.addAll(outcomeSet); this.predicateTable = (IndexHashTable<String>) dataStructures[1]; predicates = new String[predicateTable.size()]; predicateTable.toArray(predicates); modelParameters = (Context[]) dataStructures[0]; }
public double[] eval(String[] context, float[] values,double[] outsums) { int[] scontexts = new int[context.length]; java.util.Arrays.fill(outsums, 0); for (int i=0; i<context.length; i++) { Integer ci = pmap.get(context[i]); scontexts[i] = ci == null ? -1 : ci; } return eval(scontexts,values,outsums,evalParams,true); }
int startIndex = indexForHash(mapping[i].hashCode(), keys.length); int index = searchKey(startIndex, null, true);
pmap = new IndexHashTable<String>(predLabels, 0.7d);
public PerceptronModelWriter (AbstractModel model) { Object[] data = model.getDataStructures(); this.numOutcomes = model.getNumOutcomes(); PARAMS = (Context[]) data[0]; IndexHashTable<String> pmap = (IndexHashTable<String>) data[1]; OUTCOME_LABELS = (String[])data[2]; PRED_LABELS = new String[pmap.size()]; pmap.toArray(PRED_LABELS); }
public double[] eval(String[] context, float[] values,double[] outsums) { int[] scontexts = new int[context.length]; java.util.Arrays.fill(outsums, 0); for (int i=0; i<context.length; i++) { Integer ci = pmap.get(context[i]); scontexts[i] = ci == null ? -1 : ci; } return eval(scontexts,values,outsums,evalParams,true); }
pmap = new IndexHashTable<String>(predLabels, 0.7d);