/** * Informs this sequence model that the value of the element at position pos has changed. * This allows this sequence model to update its internal model if desired. * */ public void updateSequenceElement(int[] sequence, int pos, int oldVal) { if(models != null){ for (SequenceListener model : models) model.updateSequenceElement(sequence, pos, oldVal); return; } model1.updateSequenceElement(sequence, pos, oldVal); model2.updateSequenceElement(sequence, pos, oldVal); }
/** * Samples a single position in the sequence. * Destructively modifies the sequence in place. * returns the score of the new sequence * @param sequence the sequence to start with * @param pos the position to sample. * @param temperature the temperature to control annealing */ public double samplePosition(SequenceModel model, int[] sequence, int pos, double temperature) { int oldTag = sequence[pos]; Pair<Integer, Double> newPosProb = samplePositionHelper(model, sequence, pos, temperature); int newTag = newPosProb.first(); // System.out.println("Sampled " + oldTag + "->" + newTag); sequence[pos] = newTag; listener.updateSequenceElement(sequence, pos, oldTag); return newPosProb.second(); }
/** * Informs this sequence model that the value of the element at position pos has changed. * This allows this sequence model to update its internal model if desired. * */ public void updateSequenceElement(int[] sequence, int pos, int oldVal) { if(models != null){ for (SequenceListener model : models) model.updateSequenceElement(sequence, pos, oldVal); return; } model1.updateSequenceElement(sequence, pos, oldVal); model2.updateSequenceElement(sequence, pos, oldVal); }
/** * Informs this sequence model that the value of the element at position pos has changed. * This allows this sequence model to update its internal model if desired. * */ public void updateSequenceElement(int[] sequence, int pos, int oldVal) { if(models != null){ for(int i = 0; i < models.length; i++) models[i].updateSequenceElement(sequence, pos, oldVal); return; } model1.updateSequenceElement(sequence, pos, oldVal); model2.updateSequenceElement(sequence, pos, oldVal); }
/** * Informs this sequence model that the value of the element at position pos has changed. * This allows this sequence model to update its internal model if desired. * */ public void updateSequenceElement(int[] sequence, int pos, int oldVal) { if(models != null){ for(int i = 0; i < models.length; i++) models[i].updateSequenceElement(sequence, pos, oldVal); return; } model1.updateSequenceElement(sequence, pos, 0); model2.updateSequenceElement(sequence, pos, 0); }
/** * Samples a single position in the sequence. * Destructively modifies the sequence in place. * returns the score of the new sequence * @param sequence the sequence to start with * @param pos the position to sample. * @param temperature the temperature to control annealing */ public double samplePosition(SequenceModel model, int[] sequence, int pos, double temperature) { int oldTag = sequence[pos]; Pair<Integer, Double> newPosProb = samplePositionHelper(model, sequence, pos, temperature); int newTag = newPosProb.first(); // System.out.println("Sampled " + oldTag + "->" + newTag); sequence[pos] = newTag; listener.updateSequenceElement(sequence, pos, oldTag); return newPosProb.second(); }
/** * Samples a single position in the sequence. * Destructively modifies the sequence in place. * returns the score of the new sequence * @param sequence the sequence to start with * @param pos the position to sample. * @param temperature the temperature to control annealing */ public double samplePosition(SequenceModel model, int[] sequence, int pos, double temperature) { int oldTag = sequence[pos]; Pair<Integer, Double> newPosProb = samplePositionHelper(model, sequence, pos, temperature); int newTag = newPosProb.first(); // System.out.println("Sampled " + oldTag + "->" + newTag); sequence[pos] = newTag; listener.updateSequenceElement(sequence, pos, oldTag); return newPosProb.second(); }
listener.updateSequenceElement(sequence, pos, oldTag); return distribution[newTag];