Examples of topN()


Examples of com.cloudera.oryx.ml.serving.als.model.ALSServingModel.topN()

          allowedFn = new NotKnownPredicate(new ObjectOpenHashSet<>(knownItems));
        }
      }
    }

    List<Pair<String,Double>> topIDDots = model.topN(
        new DotsFunction(userVector),
        howMany + offset,
        allowedFn);
    return toIDValueResponse(topIDDots, howMany, offset);
  }
View Full Code Here

Examples of com.cloudera.oryx.ml.serving.als.model.ALSServingModel.topN()

          }
        }
      }
    }

    List<Pair<String,Double>> topIDDots = alsServingModel.topN(
        new DotsFunction(userFeaturesVectors),
        howMany + offset,
        new NotKnownPredicate(userKnownItems));

    return toIDValueResponse(topIDDots, howMany, offset);
View Full Code Here

Examples of com.cloudera.oryx.ml.serving.als.model.ALSServingModel.topN()

      checkExists(itemVector != null, itemID);
      itemFeatureVectors[i] = itemVector;
      knownItems.add(itemID);
    }

    List<Pair<String,Double>> topIDCosines = alsServingModel.topN(
        new CosineAverageFunction(itemFeatureVectors),
        howMany + offset,
        new NotKnownPredicate(knownItems));

    return toIDValueResponse(topIDCosines, howMany, offset);
View Full Code Here

Examples of com.cloudera.oryx.ml.serving.als.model.ALSServingModel.topN()

    ObjectSet<String> knownItems = new ObjectOpenHashSet<>();
    for (Pair<String,?> itemValue : EstimateForAnonymous.parsePathSegments(pathSegments)) {
      knownItems.add(itemValue.getFirst());
    }

    List<Pair<String,Double>> topIDDots = model.topN(
        new DotsFunction(anonymousUserFeatures),
        howMany + offset,
        new NotKnownPredicate(knownItems));
    return toIDValueResponse(topIDDots, howMany, offset);
  }
View Full Code Here

Examples of com.cloudera.oryx.ml.serving.als.model.ALSServingModel.topN()

    int features = model.getFeatures();
    List<String> items = new ArrayList<>(features);
    float[] unitVector = new float[features];
    for (int i = 0; i < features; i++) {
      unitVector[i] = 1.0f;
      List<Pair<String,Double>> topIDDot = model.topN(new DotsFunction(unitVector), 1, null);
      items.add(topIDDot.isEmpty() ? null : topIDDot.get(0).getFirst());
      unitVector[i] = 0.0f; // reset
    }
    return items;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.