Package joshua.discriminative.semiring_parsingv2.applications

Examples of joshua.discriminative.semiring_parsingv2.applications.EntropyOnHGUsingIO


  }
 
  @Override
  protected ExpectationSemiring<LogSemiring, ScalarPM> createNewKWeight() {
    LogSemiring p = new LogSemiring();
    ScalarPM r = new ScalarPM();
    return new ExpectationSemiring<LogSemiring,ScalarPM>(p, r);
  }
View Full Code Here


   
    double logProb = scale * dt.getTransitionLogP(false);
    LogSemiring p = new LogSemiring(logProb);
   
    double val = logProb;
    ScalarPM r =  new ScalarPM( SignedValue.createSignedValueFromRealNumber(val) );
    r.multiSemiring(p);
   
    res = new ExpectationSemiring<LogSemiring,ScalarPM>(p, r);
   
    return res;
  }
View Full Code Here

  }

  @Override
  protected ExpectationSemiringPM<LogSemiring, ScalarPM, ScalarPM, ScalarPM, ScalarBO>
  createNewXWeight() {
    ScalarPM s = new ScalarPM();
    ScalarPM t = new ScalarPM();
    return new ExpectationSemiringPM<LogSemiring, ScalarPM, ScalarPM, ScalarPM, ScalarBO>(s, t, pBilinearOperator);
  }
View Full Code Here

  }

  @Override
  protected ExpectationSemiring<LogSemiring, ScalarPM> createNewKWeight() {
    LogSemiring p = new LogSemiring();
    ScalarPM s = new ScalarPM();
    return new ExpectationSemiring<LogSemiring, ScalarPM>(p,s);
  }
View Full Code Here

    //== r
    double val = 0;//real
    if(dt.getRule()!=null){
      val = dt.getRule().getEnglish().length-dt.getRule().getArity();//length; real semiring
    }   
    ScalarPM r =  new ScalarPM( SignedValue.createSignedValueFromRealNumber(val) );
   
    //== s
    ScalarPM s = r;
   
    //== t
    ScalarPM t = pBilinearOperator.bilinearMulti(r, s);
   
    //s = p s
    s.multiSemiring(p);
   
    //t= p t
    t.multiSemiring(p);
   
    return new ExpectationSemiringPM<LogSemiring, ScalarPM, ScalarPM, ScalarPM, ScalarBO>(s, t, pBilinearOperator);
  }
View Full Code Here

    //== r
    double val = 0;//real
    if(dt.getRule()!=null){
      val = dt.getRule().getEnglish().length-dt.getRule().getArity();//length; real semiring
    }   
    ScalarPM r =  new ScalarPM( SignedValue.createSignedValueFromRealNumber(val) );
   
    // r= p r
    r.multiSemiring(p);
   
    return new ExpectationSemiring<LogSemiring, ScalarPM>(p,r);
  }
View Full Code Here

  @Override
  protected ExpectationSemiringPM<LogSemiring, RiskAndEntropyPM, ListPM, ListPM, MinRiskDABO>
 
  createNewXWeight() {   
    ListPM s = new ListPM( new SparseMap() );   
    ListPM t = new ListPM( new SparseMap() );   
    return new ExpectationSemiringPM<LogSemiring, RiskAndEntropyPM, ListPM, ListPM,  MinRiskDABO>( s, t,  pBilinearOperator);
  }
View Full Code Here

        SignedValue.createSignedValueFromRealNumber(rEntropy),
        SignedValue.createSignedValueFromRealNumber(rRisk)
    );*/
       
     
    SparseMap gradientsMap = getFeatureForest().getGradientSparseMap(parentItem, dt, logProb);
    ListPM s = new ListPM( gradientsMap );
   
 
    //== t = L_e * (P_e)' - temperature * (1+logP_e) (P_e)' = (P_e)' * ( L_e - temperature * (1+logP_e) )
    //ListPM t = pBilinearOperator.bilinearMulti(r, s);
View Full Code Here

public class MinRiskDABO  implements BilinearOperator<RiskAndEntropyPM, ListPM, ListPM>{

  public ListPM bilinearMulti(RiskAndEntropyPM r, ListPM s) {
   
    //== get SparseArray
    SparseMap res = s.getValue().duplicate();
    for(SignedValue signedVal : res.getValues())
      signedVal.multi(r.getValue());   
   
   
    return new ListPM(res);
  }
View Full Code Here

 
 
  public ListPM bilinearMulti(SignedValue r, ListPM s) {
   
    //== get SparseArray
    SparseMap res = s.getValue().duplicate();
    for(SignedValue signedVal : res.getValues())
      signedVal.multi(r);   
   
    return new ListPM(res);
  }
View Full Code Here

TOP

Related Classes of joshua.discriminative.semiring_parsingv2.applications.EntropyOnHGUsingIO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.