|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.shephertz.app42.paas.sdk.android.recommend.RecommenderService
public class RecommenderService
Recommendation engine which provides reommendation based on customer id, item id and the preference of the customer for a particular Item. Recommendations can be fetched based on User Similarity which finds similarity based on Users and Item Similarity which finds similarity based on Items. The Recommendation Engine currently supports two types of Similarity Algorithms i.e. EuclideanDistanceSimilarity and PearsonCorrelationSimilarity. By default when similarity is not specified PearsonCorrelationSimilarity is used e.g. in the method itemBased(String preferenceFileName, long userId, int howMany), it uses PearsonCorrelationSimilarity. In the method itemBasedBySimilarity(String similarity, String preferenceFileName, long userId, int howMany) one can specify which similarity algorithm has to be used e.g. Recommender.EUCLIDEAN_DISTANCE or Recommender.PEARSON_CORRELATION. Preference file can be loaded using the method loadPreferenceFile(String fileName, String preferenceFilePath, String description) in csv format. This prefernce file has to be uploaded once which can be a batch process The csv format for the file is given below. customerId, itemId, preference e.g. 1,101,5.0 1,102,3.0 1,103,2.5 2,101,2.0 2,102,2.5 2,103,5.0 2,104,2.0 3,101,2.5 3,104,4.0 3,105,4.5 3,107,5.0 4,101,5.0 4,103,3.0 4,104,4.5 4,106,4.0 5,101,4.0 5,102,3.0 5,103,2.0 5,104,4.0 5,105,3.5 5,106,4.0 The customer Id and item id can be any alphanumaric character(s) and preference values can be in any range. If app developers have used the Review Service. The Recommendation Engine can be used in conjunction with Review. In this case a CSV preference file need not be uploaded. The customerId, itemId and preference will be taken from Review where customerId is mapped with userName, itemId is mapped with itemId and preference with rating. The methods for recommendations based on Reviews are part of the Review service
ReviewService
Constructor Summary | |
---|---|
RecommenderService(java.lang.String apiKey,
java.lang.String secretKey,
java.lang.String baseURL)
The costructor for the Service |
Method Summary | |
---|---|
App42Response |
addOrUpdatePreference(java.util.ArrayList<PreferenceData> preferenceDataList)
Add or Update preference list on the cloud. |
App42Response |
deleteAllPreferences()
Delete existing preference file. |
Recommender |
itemBased(long userId,
int howMany)
Item based recommendations. |
Recommender |
itemBasedBySimilarity(RecommenderSimilarity recommenderSimilarity,
long userId,
int howMany)
Item based recommendations. |
Recommender |
itemBasedBySimilarityForAll(RecommenderSimilarity recommenderSimilarity,
int howMany)
Item based recommendations for all Users. |
Recommender |
itemBasedForAll(int howMany)
Item based recommendations for all Users. |
App42Response |
loadPreferenceFile(java.io.InputStream inputStream)
Uploads peference file on the cloud. |
App42Response |
loadPreferenceFile(java.lang.String preferenceFilePath)
Uploads peference file on the cloud. |
Recommender |
slopeOne(long userId,
int howMany)
Recommendations based on SlopeOne Algorithm |
Recommender |
slopeOneForAll(int howMany)
Recommendations based on SlopeOne Algorithm for all Users |
Recommender |
userBasedNeighborhood(long userId,
int size,
int howMany)
User based recommendations based on Neighborhood. |
Recommender |
userBasedNeighborhoodBySimilarity(RecommenderSimilarity recommenderSimilarity,
long userId,
int size,
int howMany)
User based recommendations based on Neighborhood and Similarity. |
Recommender |
userBasedNeighborhoodBySimilarityForAll(RecommenderSimilarity recommenderSimilarity,
int size,
int howMany)
User based recommendations based on Neighborhood and Similarity for all Users. |
Recommender |
userBasedNeighborhoodForAll(int size,
int howMany)
User based recommendations based on Neighborhood for All Users. |
Recommender |
userBasedThreshold(long userId,
double threshold,
int howMany)
User based neighborhood recommendations based on Threshold. |
Recommender |
userBasedThresholdBySimilarity(RecommenderSimilarity recommenderSimilarity,
long userId,
double threshold,
int howMany)
User based neighborood recommendations based on Threshold. |
Recommender |
userBasedThresholdBySimilarityForAll(RecommenderSimilarity recommenderSimilarity,
double threshold,
int howMany)
User based neighborood recommendations based on Threshold for All. |
Recommender |
userBasedThresholdForAll(double threshold,
int howMany)
User based neighborood recommendations based on Threshold for all Users. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RecommenderService(java.lang.String apiKey, java.lang.String secretKey, java.lang.String baseURL)
apiKey
- secretKey
- baseURL
- Method Detail |
---|
public App42Response addOrUpdatePreference(java.util.ArrayList<PreferenceData> preferenceDataList) throws App42Exception
preferenceDataList
- List of PreferenceData which contains customerId, itemId,
preference
App42Exception
public App42Response deleteAllPreferences() throws App42Exception
App42Exception
public Recommender itemBased(long userId, int howMany) throws App42Exception
userId
- The user Id for whom recommendations have to be foundhowMany
- Specifies that how many recommendations have to be found
App42Exception
public Recommender itemBasedBySimilarity(RecommenderSimilarity recommenderSimilarity, long userId, int howMany) throws App42Exception
recommenderSimilarity
- Similarity algorithm e.g. Recommender.EUCLIDEAN_DISTANCE and
Recommender.PEARSON_CORRELATIONuserId
- The user Id for whom recommendations have to be foundhowMany
- Specifies that how many recommendations have to be found
App42Exception
public Recommender itemBasedBySimilarityForAll(RecommenderSimilarity recommenderSimilarity, int howMany) throws App42Exception
recommenderSimilarity
- Similarity algorithm e.g. Recommender.EUCLIDEAN_DISTANCE and
Recommender.PEARSON_CORRELATIONhowMany
- Specifies that how many recommendations have to be found
App42Exception
public Recommender itemBasedForAll(int howMany) throws App42Exception
howMany
- Specifies that how many recommendations have to be found
App42Exception
public App42Response loadPreferenceFile(java.io.InputStream inputStream) throws App42Exception
inputStream
- InputStream of the file to load.
App42Exception
public App42Response loadPreferenceFile(java.lang.String preferenceFilePath) throws App42Exception
preferenceFilePath
- Path of the preference file to be loaded
App42Exception
public Recommender slopeOne(long userId, int howMany) throws App42Exception
userId
- The user Id for whom recommendations have to be foundhowMany
- Specifies that how many recommendations have to be found
App42Exception
public Recommender slopeOneForAll(int howMany) throws App42Exception
howMany
- Specifies that how many recommendations have to be found
App42Exception
public Recommender userBasedNeighborhood(long userId, int size, int howMany) throws App42Exception
userId
- The user Id for whom recommendations have to be foundsize
- Size of the NeighborhoodhowMany
- Specifies that how many recommendations have to be found
App42Exception
public Recommender userBasedNeighborhoodBySimilarity(RecommenderSimilarity recommenderSimilarity, long userId, int size, int howMany) throws App42Exception
recommenderSimilarity
- Similarity algorithm e.g. Recommender.EUCLIDEAN_DISTANCE and
Recommender.PEARSON_CORRELATIONuserId
- The user Id for whom recommendations have to be foundsize
- Size of the NeighborhoodhowMany
- Specifies that how many recommendations have to be found
App42Exception
public Recommender userBasedNeighborhoodBySimilarityForAll(RecommenderSimilarity recommenderSimilarity, int size, int howMany) throws App42Exception
recommenderSimilarity
- Similarity algorithm e.g. Recommender.EUCLIDEAN_DISTANCE and
Recommender.PEARSON_CORRELATIONsize
- Size of the NeighborhoodhowMany
- Specifies that how many recommendations have to be found
App42Exception
public Recommender userBasedNeighborhoodForAll(int size, int howMany) throws App42Exception
size
- Size of the NeighborhoodhowMany
- Specifies that how many recommendations have to be found
App42Exception
public Recommender userBasedThreshold(long userId, double threshold, int howMany) throws App42Exception
userId
- The user Id for whom recommendations have to be foundthreshold
- Threshold size. Values can vary from -1 to 1howMany
- Specifies that how many recommendations have to be found
App42Exception
public Recommender userBasedThresholdBySimilarity(RecommenderSimilarity recommenderSimilarity, long userId, double threshold, int howMany) throws App42Exception
recommenderSimilarity
- Similarity algorithm e.g. Recommender.EUCLIDEAN_DISTANCE and
Recommender.PEARSON_CORRELATIONuserId
- The user Id for whom recommendations have to be foundthreshold
- Threshold size. Values can vary from -1 to 1howMany
- Specifies that how many recommendations have to be found
App42Exception
public Recommender userBasedThresholdBySimilarityForAll(RecommenderSimilarity recommenderSimilarity, double threshold, int howMany) throws App42Exception
recommenderSimilarity
- Similarity algorithm e.g. Recommender.EUCLIDEAN_DISTANCE and
Recommender.PEARSON_CORRELATIONthreshold
- Threshold size. Values can vary from -1 to 1howMany
- Specifies that how many recommendations have to be found
App42Exception
public Recommender userBasedThresholdForAll(double threshold, int howMany) throws App42Exception
threshold
- Threshold size. Values can vary from -1 to 1howMany
- Specifies that how many recommendations have to be found
App42Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |