Search in sources :

Example 96 with structures._SparseFeature

use of structures._SparseFeature in project IR_Base by Linda-sunshine.

the class MTCLinAdaptWithHDP method logit.

// Logit function is different from the father class.
@Override
protected double logit(_SparseFeature[] fvs, _Review r) {
    int k, n;
    double[] Au = r.getHDPThetaStar().getModel();
    // Bias term: w_s0*a0+b0.
    double sum = Au[0] * getSupWeights(0) + Au[m_dim];
    for (_SparseFeature fv : fvs) {
        n = fv.getIndex() + 1;
        k = m_featureGroupMap[n];
        sum += (Au[k] * getSupWeights(n) + Au[m_dim + k]) * fv.getValue();
    }
    return Utils.logistic(sum);
}
Also used : structures._SparseFeature(structures._SparseFeature)

Aggregations

structures._SparseFeature (structures._SparseFeature)94 structures._ChildDoc (structures._ChildDoc)14 structures._Doc (structures._Doc)14 structures._Review (structures._Review)14 HashMap (java.util.HashMap)7 structures._ParentDoc (structures._ParentDoc)7 structures._Stn (structures._Stn)7 Feature (Classifier.supervised.liblinear.Feature)6 FeatureNode (Classifier.supervised.liblinear.FeatureNode)6 structures._RankItem (structures._RankItem)5 File (java.io.File)3 PrintWriter (java.io.PrintWriter)3 Classifier.supervised.modelAdaptation._AdaptStruct (Classifier.supervised.modelAdaptation._AdaptStruct)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 Entry (java.util.Map.Entry)2 structures._ChildDoc4BaseWithPhi (structures._ChildDoc4BaseWithPhi)2 structures._HDPThetaStar (structures._HDPThetaStar)2