Package net.myrrix.common.math

Examples of net.myrrix.common.math.Solver


                                "Number of values doesn't match number of items");
   
    Generation generation = getCurrentGeneration();

    FastByIDMap<float[]> Y = generation.getY();
    Solver ytySolver = generation.getYTYSolver();
    if (ytySolver == null) {
      throw new NotReadyException();
    }

    float[] anonymousUserFeatures = null;
    Lock yLock = generation.getYLock().readLock();

    boolean anyItemIDFound = false;
    for (int j = 0; j < itemIDs.length; j++) {
      long itemID = itemIDs[j];
      float[] itemFeatures;
      yLock.lock();
      try {
        itemFeatures = Y.get(itemID);
      } finally {
        yLock.unlock();
      }
      if (itemFeatures == null) {
        continue;
      }
      anyItemIDFound = true;
      double[] userFoldIn = ytySolver.solveFToD(itemFeatures);
      if (anonymousUserFeatures == null) {
        anonymousUserFeatures = new float[userFoldIn.length];
      }
      double signedFoldInWeight = foldInWeight(0.0, values == null ? 1.0f : values[j]);
      if (signedFoldInWeight != 0.0) {
View Full Code Here


    }
    // Here, we are using userFeatures, which is a row of X, as if it were a column of X'.
    // This is multiplied on the left by (X'*X)^-1. That's our left-inverse of X or at least the one
    // column we need. Which is what the new data point is multiplied on the left by. The result is a column;
    // we scale to complete the multiplication of the fold-in and add it in.
    Solver xtxSolver = generation.getXTXSolver();
    double[] itemFoldIn = xtxSolver == null ? null : xtxSolver.solveFToD(userFeatures);

    // Same, but reversed. Multiply itemFeatures, which is a row of Y, on the right by (Y'*Y)^-1.
    // This is the right-inverse for Y', or at least the row we need. Because of the symmetries we can use
    // the same method above to carry out the multiply; the result is conceptually a row vector.
    // The result is scaled and added in.
    Solver ytySolver = generation.getYTYSolver();
    double[] userFoldIn = ytySolver == null ? null : ytySolver.solveFToD(itemFeatures);

    if (itemFoldIn != null) {
      if (SimpleVectorMath.norm(userFoldIn) > BIG_FOLDIN_THRESHOLD) {
        log.warn("Item fold in vector is large; reduce -Dmodel.features?");
      }
View Full Code Here

TOP

Related Classes of net.myrrix.common.math.Solver

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.