Package cc.mallet.types

Examples of cc.mallet.types.IndexedSparseVector


    assertEquals (0.0, s.dotProduct (s1), 1e-10);
  }

  public void testSerializable () throws IOException, ClassNotFoundException
  {
    IndexedSparseVector s = (IndexedSparseVector) s1.cloneMatrix ();
    IndexedSparseVector sPrime = (IndexedSparseVector) TestSerializable.cloneViaSerialization (s);
    assertEquals (s.numLocations (), sPrime.numLocations ());
    assertTrue (Arrays.equals (s.getIndices (), sPrime.getIndices ()));
    assertTrue (Arrays.equals (s.getValues (), sPrime.getValues ()));
  }
View Full Code Here


      int[] indices = new int[numLocations];
      for (int j = 0; j < numLocations; j++) {
        indices[j] = weightsPresent[i].nextSetBit (j == 0 ? 0 : indices[j-1]+1);
        //System.out.println ("CRF4 has index "+indices[j]);
      }
      newWeights[i] = new IndexedSparseVector (indices, new double[numLocations],
          numLocations, numLocations, false, false, false);
      newWeights[i].plusEqualsSparse (parameters.weights[i])// Put in the previous weights
      numWeights += (numLocations + 1);
    }
    logger.info("Number of weights = "+numWeights);
View Full Code Here

      parameters.weights = new SparseVector[1];
      parameters.defaultWeights = new double[1];
      featureSelections = new FeatureSelection[1];
      parameters.weightsFrozen = new boolean [1];
      // Use initial capacity of 8
      parameters.weights[0] = new IndexedSparseVector ();
      parameters.defaultWeights[0] = 0;
      featureSelections[0] = null;
      weightsStructureChanged();
    } else if (wi == parameters.weights.length) {
      SparseVector[] newWeights = new SparseVector[parameters.weights.length+1];
      double[] newDefaultWeights = new double[parameters.weights.length+1];
      FeatureSelection[] newFeatureSelections = new FeatureSelection[parameters.weights.length+1];
      for (int i = 0; i < parameters.weights.length; i++) {
        newWeights[i] = parameters.weights[i];
        newDefaultWeights[i] = parameters.defaultWeights[i];
        newFeatureSelections[i] = featureSelections[i];
      }
      newWeights[wi] = new IndexedSparseVector ();
      newDefaultWeights[wi] = 0;
      newFeatureSelections[wi] = null;
      parameters.weights = newWeights;
      parameters.defaultWeights = newDefaultWeights;
      featureSelections = newFeatureSelections;
View Full Code Here

TOP

Related Classes of cc.mallet.types.IndexedSparseVector

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.