Transducer.Incrementor incrementor = instanceWeight == 1.0 ? expectations.new Incrementor() : expectations.new WeightedIncrementor (instanceWeight); unlabeledWeight = new SumLatticeDefault (this.crf, input, null, incrementor).getTotalWeight();
Transducer.Incrementor incrementor = instanceWeight == 1.0 ? expectations.new Incrementor() : expectations.new WeightedIncrementor (instanceWeight); unlabeledWeight = new SumLatticeDefault (this.crf, input, null, incrementor).getTotalWeight();
Transducer.Incrementor incrementor = instanceWeight == 1.0 ? expectations.new Incrementor() : expectations.new WeightedIncrementor (instanceWeight); unlabeledWeight = new SumLatticeDefault (this.crf, input, null, incrementor).getTotalWeight();
: batchExpectations.new WeightedIncrementor (instanceWeight); unlabeledWeight = new SumLatticeDefault (this.crf, input, null, incrementor).getTotalWeight(); if (Double.isInfinite (unlabeledWeight)) {
: batchExpectations.new WeightedIncrementor (instanceWeight); unlabeledWeight = new SumLatticeDefault (this.crf, input, null, incrementor).getTotalWeight(); if (Double.isInfinite (unlabeledWeight)) {
: batchExpectations.new WeightedIncrementor (instanceWeight); unlabeledWeight = new SumLatticeDefault (this.crf, input, null, incrementor).getTotalWeight(); if (Double.isInfinite (unlabeledWeight)) {
/** * Set the constraints by running forward-backward with the <i>output label * sequence provided</i>, thus restricting it to only those paths that agree with * the label sequence. */ protected void gatherConstraints(InstanceList ilist) { logger.info("Gathering constraints..."); assert (constraints.structureMatches(crf.parameters)); constraints.zero(); for (Instance instance : ilist) { FeatureVectorSequence input = (FeatureVectorSequence) instance.getData(); FeatureSequence output = (FeatureSequence) instance.getTarget(); double instanceWeight = ilist.getInstanceWeight(instance); Transducer.Incrementor incrementor = instanceWeight == 1.0 ? constraints.new Incrementor() : constraints.new WeightedIncrementor(instanceWeight); new SumLatticeDefault (this.crf, input, output, incrementor); } constraints.assertNotNaNOrInfinite(); }
protected void gatherConstraints (InstanceList ilist) { // Set the constraints by running forward-backward with the *output // label sequence provided*, thus restricting it to only those // paths that agree with the label sequence. // Zero the constraints[] // Reset constraints[] to zero before we fill them again assert (constraints.structureMatches(crf.parameters)); constraints.zero(); for (Instance instance : ilist) { FeatureVectorSequence input = (FeatureVectorSequence) instance.getData(); FeatureSequence output = (FeatureSequence) instance.getTarget(); double instanceWeight = ilist.getInstanceWeight(instance); //System.out.println ("Constraint-gathering on instance "+i+" of "+ilist.size()); Transducer.Incrementor incrementor = instanceWeight == 1.0 ? constraints.new Incrementor() : constraints.new WeightedIncrementor(instanceWeight); new SumLatticeDefault (this.crf, input, output, incrementor); } // System.out.println ("testing Value and Gradient"); // TestOptimizable.testValueAndGradientCurrentParameters (this); }
protected void gatherConstraints (InstanceList ilist) { // Set the constraints by running forward-backward with the *output // label sequence provided*, thus restricting it to only those // paths that agree with the label sequence. // Zero the constraints[] // Reset constraints[] to zero before we fill them again assert (constraints.structureMatches(crf.parameters)); constraints.zero(); for (Instance instance : ilist) { FeatureVectorSequence input = (FeatureVectorSequence) instance.getData(); FeatureSequence output = (FeatureSequence) instance.getTarget(); double instanceWeight = ilist.getInstanceWeight(instance); //System.out.println ("Constraint-gathering on instance "+i+" of "+ilist.size()); Transducer.Incrementor incrementor = instanceWeight == 1.0 ? constraints.new Incrementor() : constraints.new WeightedIncrementor(instanceWeight); new SumLatticeDefault (this.crf, input, output, incrementor); } // System.out.println ("testing Value and Gradient"); // TestOptimizable.testValueAndGradientCurrentParameters (this); }
/** * Set the constraints by running forward-backward with the <i>output label * sequence provided</i>, thus restricting it to only those paths that agree with * the label sequence. */ protected void gatherConstraints(InstanceList ilist) { logger.info("Gathering constraints..."); assert (constraints.structureMatches(crf.parameters)); constraints.zero(); for (Instance instance : ilist) { FeatureVectorSequence input = (FeatureVectorSequence) instance.getData(); FeatureSequence output = (FeatureSequence) instance.getTarget(); double instanceWeight = ilist.getInstanceWeight(instance); Transducer.Incrementor incrementor = instanceWeight == 1.0 ? constraints.new Incrementor() : constraints.new WeightedIncrementor(instanceWeight); new SumLatticeDefault (this.crf, input, output, incrementor); } constraints.assertNotNaNOrInfinite(); }
/** * Set the constraints by running forward-backward with the <i>output label * sequence provided</i>, thus restricting it to only those paths that agree with * the label sequence. */ protected void gatherConstraints(InstanceList ilist) { logger.info("Gathering constraints..."); assert (constraints.structureMatches(crf.parameters)); constraints.zero(); for (Instance instance : ilist) { FeatureVectorSequence input = (FeatureVectorSequence) instance.getData(); FeatureSequence output = (FeatureSequence) instance.getTarget(); double instanceWeight = ilist.getInstanceWeight(instance); Transducer.Incrementor incrementor = instanceWeight == 1.0 ? constraints.new Incrementor() : constraints.new WeightedIncrementor(instanceWeight); new SumLatticeDefault (this.crf, input, output, incrementor); } constraints.assertNotNaNOrInfinite(); }
protected void gatherConstraints (InstanceList ilist) { // Set the constraints by running forward-backward with the *output // label sequence provided*, thus restricting it to only those // paths that agree with the label sequence. // Zero the constraints[] // Reset constraints[] to zero before we fill them again assert (constraints.structureMatches(crf.parameters)); constraints.zero(); for (Instance instance : ilist) { FeatureVectorSequence input = (FeatureVectorSequence) instance.getData(); FeatureSequence output = (FeatureSequence) instance.getTarget(); double instanceWeight = ilist.getInstanceWeight(instance); //System.out.println ("Constraint-gathering on instance "+i+" of "+ilist.size()); Transducer.Incrementor incrementor = instanceWeight == 1.0 ? constraints.new Incrementor() : constraints.new WeightedIncrementor(instanceWeight); new SumLatticeDefault (this.crf, input, output, incrementor); } // System.out.println ("testing Value and Gradient"); // TestOptimizable.testValueAndGradientCurrentParameters (this); }