Package uk.ac.cam.ch.wwmm.ptc.experimental.indexersearcher

Examples of uk.ac.cam.ch.wwmm.ptc.experimental.indexersearcher.SVDHarness


    for(String feature : featureList) {
      featureIndex.put(feature, featureNo);
      featureNo++;
    }

    SVDHarness svdh = new SVDHarness(termNo, featureNo);
    int wordNo = 0;
    for(String word : terms) {
      Bag<String> ngrams = new Bag<String>();
      String fooWord = "^^^" + word.toLowerCase() + "$$$";
      for(int i=0;i<fooWord.length() - 3;i++) {
        ngrams.add(fooWord.substring(i,i+4));
      }
      for(String f : ngrams.getSet()) {
        int fno = featureIndex.get(f);
        svdh.set(fno, wordNo, ngrams.getCount(f));
      }
      wordNo++;
    }
    System.out.println("Harness ready...");
    int values = 50;
    svdh.svd(values);
    Matrix ut = svdh.getUt(); // Terms
    //Matrix vt = svdh.getVt(); // Features
   
    //System.out.println(ut.getColumnDimension() + "\t" + ut.getRowDimension());
    //System.out.println(vt.getColumnDimension() + "\t" + vt.getRowDimension());
    //System.out.println(wordNo);
View Full Code Here


    for(String feature : features) {
      featureIndex.put(feature, featureNo);
      featureNo++;
    }
    System.out.println("Indexed...");
    SVDHarness svdh = new SVDHarness(termNo, featureNo);
    for(int i=0;i<termNo;i++) {
      Map<String,Double> wv = se.getWeightVector(terms.get(i));
      for(String feature : wv.keySet()) {
        int fno = featureIndex.get(feature);
        svdh.set(fno, i, wv.get(feature));
      }
    }
    System.out.println("Harness ready...");
    svdh.svd(10);
    Matrix lm = svdh.getUt().transpose();
    System.out.println(lm.getRowDimension());
    System.out.println(lm.getColumnDimension());
    System.out.println(termNo);
    System.out.println(featureNo);
    double [] svals = svdh.getS();
    if(true) {
      for(int i=0;i<svals.length;i++) {
        System.out.println(svals[i]);
        for(int j=0;j<lm.getRowDimension();j++) {
          lm.set(j, i, lm.get(j, i) * svals[i]);
 
View Full Code Here

TOP

Related Classes of uk.ac.cam.ch.wwmm.ptc.experimental.indexersearcher.SVDHarness

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.