Recommendation service provides recommendations based on customer ID, item ID and the preference of the customers for a particular item. Recommendations can be fetched based on user similarity and item similarity. This engine currently supports two types of similarity algorithms i.e. EuclideanDistanceSimilarity and PearsonCorrelationSimilarity. By default when similarity is not specified PearsonCorrelationSimilarity is used, for instance in the method ItemBased(Double userId, int howMany) it uses PearsonCorrelationSimilarity. In the method ItemBasedBySimilarity(String similarity, Double userId, int howMany) one can specify which similarity algorithm has to be used like Recommender.EUCLIDEAN_DISTANCE or Recommender.PEARSON_CORRELATION.
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 in any alphanumeric character(s) and preference values can be in any range. This service can be used in conjunction with the Review service. 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 a part of the Review service.
import com.shephertz.app42.paas.sdk.android.App42API; import com.shephertz.app42.paas.sdk.android.App42Response; import com.shephertz.app42.paas.sdk.android.App42Exception; import com.shephertz.app42.paas.sdk.android.App42BadParameterException; import com.shephertz.app42.paas.sdk.android.App42NotFoundException; import com.shephertz.app42.paas.sdk.android.recommend.PreferenceData; import com.shephertz.app42.paas.sdk.android.recommend.Recommender; import com.shephertz.app42.paas.sdk.android.recommend.RecommenderService; import com.shephertz.app42.paas.sdk.android.recommend.RecommenderSimilarity;using com.shephertz.app42.paas.sdk.windows; using com.shephertz.app42.paas.sdk.windows.recommend;#import "Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h"Not Availableimport com.shephertz.app42.paas.sdk.java.App42API; import com.shephertz.app42.paas.sdk.java.App42Response; import com.shephertz.app42.paas.sdk.java.App42Exception; import com.shephertz.app42.paas.sdk.java.App42BadParameterException; import com.shephertz.app42.paas.sdk.java.App42NotFoundException; import com.shephertz.app42.paas.sdk.java.recommend.Recommender; import com.shephertz.app42.paas.sdk.java.recommend.PreferenceData; import com.shephertz.app42.paas.sdk.java.recommend.RecommenderService; import com.shephertz.app42.paas.sdk.java.recommend.RecommenderSimilarity;Not AvailableComing SoonComing Soonusing com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.recommend;include_once '../RecommenderService.php'; include_once '../App42Log.php'; include_once '../App42Response.php'; include_once '../App42Exception.php'; include_once '../App42BadParameterException.php'; include_once '../App42NotFoundException.php';Coming SoonComing SoonComing SoonComing Soonimport com.shephertz.app42.paas.sdk.jme.App42API; import com.shephertz.app42.paas.sdk.jme.App42Response; import com.shephertz.app42.paas.sdk.jme.App42Exception; import com.shephertz.app42.paas.sdk.jme.App42BadParameterException; import com.shephertz.app42.paas.sdk.jme.App42NotFoundException; import com.shephertz.app42.paas.sdk.jme.recommend.PreferenceData; import com.shephertz.app42.paas.sdk.jme.recommend.Recommender; import com.shephertz.app42.paas.sdk.jme.recommend.RecommenderService; import com.shephertz.app42.paas.sdk.jme.recommend.RecommenderSimilarity;
In order to use the various functions available in a specific API, the developer has to initialize with App42API by passing the apiKey and the secretKey which will become available after the app creation from AppHQ dashboard.
Required Parameters
apiKey - The Application key given when the application was created.
secretKey - The secret key corresponding to the application key given when the application was created.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];Not AvailableApp42API.initialize("API_KEY","SECRET_KEY");Coming SoonNot AvailableApp42API:initialize("API_KEY","SECRET_KEY");App42API::Initialize("API_KEY", "SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");App42API::initialize("API_KEY","SECRET_KEY");App42API::Initialize("API_KEY", "SECRET_KEY");api = App42::ServiceAPI.new("API_KEY","SECRET_KEY")App42API.initialize("API_KEY","SECRET_KEY");Coming SoonApp42API.initialize("API_KEY","SECRET_KEY");
After initialization, the developer will have to call the buildXXXService method on App42API to get the instance of the particular API that they wish to build. For example, to build an instance of Recommender Service, buildRecommenderService() method needs to be called.
RecommenderService recommenderService = App42API.buildRecommenderService();RecommenderService recommenderService = App42API.BuildRecommenderService();RecommenderService *recommenderService = [api buildRecommenderService];Not AvailableRecommenderService recommenderService = App42API.buildRecommenderService();Coming SoonNot AvailableComing SoonComing SoonRecommenderService recommenderService = App42API.BuildRecommenderService();$recommenderService = App42API::buildRecommenderService();Coming SoonComing SoonComing SoonComing SoonRecommenderService recommenderService = App42API.buildRecommenderService();
Uploads preference file on the cloud. The preference file should be in CSV format. This preference file has to be uploaded once which can be a
batch process. New versions of the preference file either can be uploaded in
a different name or the older one has to be removed and uploaded in
the same name. 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 in any alphanumeric character(s) and preference values can be in any range. If the recommendations have to be done based on reviews then this file need not be uploaded.
Required Parameters
filePath - Path of the preference file to be loaded.
String filePath = "Your File Path"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); recommenderService.loadPreferenceFile(filePath, new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String filePath = "Your File Path"; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); recommenderService.LoadPreferenceFile(filePath,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object object) { App42Response response = (App42Response) object; String jsonResponse = response.ToString(); } }NSString *filePath = @"Your File Path"; ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"API_KEY"; api.secretKey = @"SECRET_KEY"; RecommenderService *recommenderService = [api buildRecommenderService]; [recommenderService loadPreferenceFile:filePath completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not AvailableString filePath = "Your File Path"; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); App42Response app42response = recommenderService.loadPreferenceFile(filePath); System.out.println("response is " + app42response) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();Coming SoonNot AvailableComing SoonComing SoonString filePath = "Your File Path"; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); App42Response response = recommenderService.LoadPreferenceFile(filePath); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$filePath = "Your File Path"; App42API::initialize("API_KEY","SECRET_KEY"); $recommenderService = App42API::buildRecommenderService(); $response = $recommenderService->loadPreferenceFile($filePath); $success = $respons->isResponseSuccess(); $jsonResponse = $respons->toString();Coming SoonComing SoonComing SoonComing SoonString filePath = "Your File Path"; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); App42Response response = recommenderService.loadPreferenceFile(filePath); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();
Uploads preference file on the cloud. The preference file should be in CSV format. This preference file has to be uploaded once which can be a
batch process. New versions of preference file either can be uploaded in
a different name or the older one has to be removed and uploaded in
the same name. 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 in any alphanumeric character(s) and preference values can be in any range. If the recommendations have to be done based on reviews then this file need not be uploaded.
Required Parameters
inputStream - Input Stream of the file to load.
InputStream inputStream = null; /*Get input stream from your source*/ App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); recommenderService.loadPreferenceFile(inputStream, new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Stream inputStream = null; /*Get input stream from your source*/ App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); recommenderService.LoadPreferenceFile(inputStream,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object object) { App42Response response = (App42Response) object; String jsonResponse = response.ToString(); } }ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"API_KEY"; api.secretKey = @"SECRET_KEY"; RecommenderService *recommenderService = [api buildRecommenderService]; [recommenderService loadPreferenceFile:@"Get NSData from your source" completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not AvailableInputStream inputStream = null; /*Get input stream from your source*/ App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); App42Response app42response = recommenderService.loadPreferenceFile(inputStream); System.out.println("response is " + app42response) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();Coming SoonNot AvailableComing SoonComing SoonStream inputStream = null; /*Get input stream from your source*/ App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); App42Response response = recommenderService.LoadPreferenceFile(inputStream); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();Not AvailableComing SoonComing SoonComing SoonComing SoonInputStream inputStream = null; /*Get input stream from your source*/ App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); App42Response response = recommenderService.loadPreferenceFile(inputStream); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();
User based recommendations are found based on similar users in the neighborhood of the given user. Size of the neighborhood can be entered.
Required Parameters
userId - The user ID for whom recommendations have to be found.
size - Size of the Neighborhood.
howMany - Specify that how many recommendations have to be found.
long userId = 3; int size = 4567788 ; int howMany = 2; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); recommenderService.userBasedNeighborhood(userId, size, howMany, new App42CallBack() { public void onSuccess(Object response) { Recommender recommender = (Recommender )response; ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });long userId = 3; int size = 4567788 ; int howMany = 2; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); recommenderService.UserBasedNeighborhood(userId, size, howMany,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Recommender recommender = (Recommender) response; String jsonResponse = recommender.ToString(); } }long userId = 3; int size = 4567788 ; int howMany = 2; ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"API_KEY"; api.secretKey = @"SECRET_KEY"; RecommenderService *recommenderService = [api buildRecommenderService]; [recommenderService userBasedNeighborhood:userId size:size howMany:howMany completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Recommender *recommender = (Recommender*)responseObj; NSMutableArray *recommendedItemList = recommender.recommendedItemList; for(RecommendedItem *recommendedItem in recommendedItemList){ NSLog(@"item is = %@",recommendedItem.userId); NSLog(@"value is = %f",recommendedItem.value); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not Availablelong userId = 3; int size = 4567788 ; int howMany = 2; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.userBasedNeighborhood(userId, size, howMany); ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } String jsonResponse = recommender.toString();Coming SoonNot AvailableComing SoonComing SoonInt64 userId = 3; int size = 4567788 ; int howMany = 2; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); Recommender recommender = recommenderService.UserBasedNeighborhood(userId, size, howMany); IList<Recommender.RecommendedItem> recommendedItemList = recommender.GetRecommendedItemList(); for(int i = 0; i < recommendedItemList.Count; i++) { Console.WriteLine("item is " + recommendedItemList[0].GetItem()); Console.WriteLine("value is " + recommendedItemList[0].GetValue()); } String jsonResponse = recommender.ToString();$userId = 3; $size = 4567788 ; $howMany = 2; App42API::initialize("API_KEY","SECRET_KEY"); $recommenderService = App42API::buildRecommenderService(); $recommender = $recommenderService->userBasedNeighborhood($userId, $size, $howMany); $recommendedItemList = $recommender->getRecommendedItemList(); foreach( $recommendedItemList as $recommendedItem ){ print_r("value is" . $recommendedItem->getValue()); print_r("item is" . $recommendedItem->getItem()); } $jsonResponse = $recommender->toString();Coming SoonComing SoonComing SoonComing Soonlong userId = 3; int size = 4567788 ; int howMany = 2; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.userBasedNeighborhood(userId, size, howMany); Vector recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i< recommendedItemList.size();i++) { Recommender.RecommendedItem recommendedItem = (Recommender.RecommendedItem) recommendedItemList.elementAt(i); System.out.println("item is " + recommendedItem.getItem()); System.out.println("value is " + recommendedItem.getValue()); } String jsonResponse = recommender.toString();
Recommendations are found based on the similar users in the neighborhood with the specified Similarity Algorithm. Algorithm can be specified using the constants Recommender.EUCLIDEAN_DISTANCE and Recommender.PEARSON_CORRELATION.
Required Parameters
recommenderSimilarity - Similarity algorithm e.g. Recommender.EUCLIDEAN_DISTANCE and Recommender.PEARSON_CORRELATION.
userId - The user Id for whom recommendations have to be found.
size - Size of the Neighborhood.
howMany - Specifies that how many recommendations have to be found.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); RecommenderSimilarity recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; long userId = 1; int size = 2; int howMany = 2; recommenderService.userBasedNeighborhoodBySimilarity(recommenderSimilarity, userId, size, howMany, new App42CallBack() { public void onSuccess(Object response) { Recommender recommender = (Recommender )response; ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } }); String jsonResponse = recommender.toString();String recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; long userId = 1; int size = 2; int howMany = 2; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); recommenderService.UserBasedNeighborhoodBySimilarity(recommenderSimilarity,userId, size, howMany,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Recommender recommender = (Recommender) response; String jsonResponse = recommender.ToString(); } }long userId = 1; int size = 2; int howMany = 2; ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"API_KEY"; api.secretKey = @"SECRET_KEY"; RecommenderService *recommenderService = [api buildRecommenderService]; [recommenderService userBasedNeighborhoodBySimilarity:EUCLIDEAN_DISTANCE userId:userId size:size howMany:howMany completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Recommender *recommender = (Recommender*)responseObj; NSMutableArray *recommendedItemList = recommender.recommendedItemList; for(RecommendedItem *recommendedItem in recommendedItemList){ NSLog(@"item is = %@",recommendedItem.userId); NSLog(@"value is = %f",recommendedItem.value); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not AvailableApp42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); RecommenderSimilarity recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; long userId = 1; int size = 2; int howMany = 2; Recommender recommender = recommenderService.userBasedNeighborhoodBySimilarity(recommenderSimilarity, userId, size, howMany); ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } String jsonResponse = recommender.toString();Coming SoonNot AvailableComing SoonComing SoonString recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; Int64 userId = 1; int size = 2; int howMany = 2; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); Recommender recommender = recommenderService.UserBasedNeighborhoodBySimilarity(recommenderSimilarity, userId, size, howMany); IList<Recommender.RecommendedItem> recommendedItemList = recommender.GetRecommendedItemList(); for(int i = 0; i < recommendedItemList.Count; i++) { Console.WriteLine("item is " + recommendedItemList[0].GetItem()); Console.WriteLine("value is " + recommendedItemList[0].GetValue()); } String jsonResponse = recommender.ToString();recommenderSimilarity = RecommenderSimilarity::EUCLIDEAN_DISTANCE; $userId = 1; $size = 2; $howMany = 2; App42API::initialize("API_KEY","SECRET_KEY"); $recommenderService = App42API::buildRecommenderService(); $recommender = $recommenderService->userBasedNeighborhoodBySimilarity($recommenderSimilarity,$userId, $size, $howMany); $recommendedItemList = $recommender->getRecommendedItemList(); foreach( $recommendedItemList as $recommendedItem ){ print_r("value is" . $recommendedItem->getValue()); print_r("item is" . $recommendedItem->getItem()); } $jsonResponse = $recommender->toString();Coming SoonComing SoonComing SoonComing SoonString recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; long userId = 1; int size = 2; int howMany = 2; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.userBasedNeighborhoodBySimilarity(recommenderSimilarity,userId, size, howMany); Vector recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i< recommendedItemList.size();i++) { Recommender.RecommendedItem recommendedItem = (Recommender.RecommendedItem) recommendedItemList.elementAt(i); System.out.println("item is " + recommendedItem.getItem()); System.out.println("value is " + recommendedItem.getValue()); } String jsonResponse = recommender.toString();
Recommendations based on neighborhood for all users are found through similar users in the given neighborhood of a particular user. The size of the neighborhood can be entered.
Required Parameters
size - Size of the Neighborhood.
howMany - Specify that how many recommendations have to be found.
int size = 1; int howMany = 1; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); recommenderService.userBasedNeighborhoodForAll(size, howMany, new App42CallBack() { public void onSuccess(Object response) { Recommender recommender = (Recommender )response; ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("userId is " + recommendedItemList.get(i).getUserId()); System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });int size = 1; int howMany = 1; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); recommenderService.UserBasedNeighborhoodForAll(size, howMany,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Recommender recommender = (Recommender) response; String jsonResponse = recommender.ToString(); } }int size = 1; int howMany = 1; ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"API_KEY"; api.secretKey = @"SECRET_KEY"; RecommenderService *recommenderService = [api buildRecommenderService]; [recommenderService userBasedNeighborhoodForAll:size howMany:howMany completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Recommender *recommender = (Recommender*)responseObj; NSMutableArray *recommendedItemList = recommender.recommendedItemList; for(RecommendedItem *recommendedItem in recommendedItemList){ NSLog(@"item is = %@",recommendedItem.userId); NSLog(@"value is = %f",recommendedItem.value); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not Availableint size = 1; int howMany = 1; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.userBasedNeighborhoodForAll(size, howMany); ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("userId is " + recommendedItemList.get(i).getUserId()); System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } String jsonResponse = recommender.toString();Coming SoonNot AvailableComing SoonComing Soonint size = 1; int howMany = 1; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); Recommender recommender = recommenderService.UserBasedNeighborhoodForAll(size, howMany); IList<Recommender.RecommendedItem> recommendedItemList = recommender.GetRecommendedItemList(); for(int i = 0; i < recommendedItemList.Count; i++) { Console.WriteLine("userId is " + recommendedItemList[0].GetUserId()); Console.WriteLine("item is " + recommendedItemList[0].GetItem()); Console.WriteLine("value is " + recommendedItemList[0].GetValue()); } String jsonResponse = recommender.ToString();$size = 1; $howMany = 1; App42API::initialize("API_KEY","SECRET_KEY"); $recommenderService = App42API::buildRecommenderService(); $recommender = $recommenderService->userBasedNeighborhoodForAll($size, $howMany); $success = $recommender->isResponseSuccess(); $jsonResponse = $recommender->toString();Coming SoonComing SoonComing SoonComing Soonint size = 1; int howMany = 1; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.userBasedNeighborhoodForAll(size, howMany); Vector recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i< recommendedItemList.size();i++) { Recommender.RecommendedItem recommendedItem = (Recommender.RecommendedItem) recommendedItemList.elementAt(i); System.out.println("userId is " + recommendedItem.getUserId()); System.out.println("item is " + recommendedItem.getItem()); System.out.println("value is " + recommendedItem.getValue()); } String jsonResponse = recommender.toString();
Recommendations are found based on similar users in the given neighborhood with the specified Similarity Algorithm. Algorithm can be specified using the constants Recommender.EUCLIDEAN_DISTANCE and Recommender.PEARSON_CORRELATION
Required Parameters
recommenderSimilarity - Similarity algorithm e.g. Recommender.EUCLIDEAN_DISTANCE and Recommender.PEARSON_CORRELATION.
size - Size of the neighborhood.
howMany - Specify that how many recommendations have to be found.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); RecommenderSimilarity recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; int size = 2; int howMany = 3; recommenderService.userBasedNeighborhoodBySimilarityForAll(recommenderSimilarity, size, howMany, new App42CallBack() { public void onSuccess(Object response) { Recommender recommender = (Recommender )response; ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("userId is " + recommendedItemList.get(i).getUserId()); System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; int size = 2; int howMany = 3; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); recommenderService.UserBasedNeighborhoodBySimilarityForAll(recommenderSimilarity, size, howMany,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Recommender recommender = (Recommender) response; String jsonResponse = recommender.ToString(); } }int size = 2; int howMany = 3; ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"API_KEY"; api.secretKey = @"SECRET_KEY"; RecommenderService *recommenderService = [api buildRecommenderService]; [recommenderService userBasedNeighborhoodBySimilarityForAll:EUCLIDEAN_DISTANCE size:size howMany:howMany completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Recommender *recommender = (Recommender*)responseObj; NSMutableArray *recommendedItemList = recommender.recommendedItemList; for(RecommendedItem *recommendedItem in recommendedItemList){ NSLog(@"item is = %@",recommendedItem.userId); NSLog(@"value is = %f",recommendedItem.value); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not AvailableApp42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); RecommenderSimilarity recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; int size = 2; int howMany = 3; Recommender recommender = recommenderService.userBasedNeighborhoodBySimilarityForAll(recommenderSimilarity, size, howMany); ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("userId is " + recommendedItemList.get(i).getUserId()); System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } String jsonResponse = recommender.toString();Coming SoonNot AvailableComing SoonComing SoonString recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; int size = 2; int howMany = 3; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); Recommender recommender = recommenderService.UserBasedNeighborhoodBySimilarityForAll(recommenderSimilarity, size, howMany); IList<Recommender.RecommendedItem> recommendedItemList = recommender.GetRecommendedItemList(); for(int i = 0; i < recommendedItemList.Count; i++) { Console.WriteLine("userId is " + recommendedItemList[0].GetUserId()); Console.WriteLine("item is " + recommendedItemList[0].GetItem()); Console.WriteLine("value is " + recommendedItemList[0].GetValue()); } String jsonResponse = recommender.ToString();$recommenderSimilarity = RecommenderSimilarity::EUCLIDEAN_DISTANCE; $size = 2; $howMany = 3; App42API::initialize("API_KEY","SECRET_KEY"); $recommenderService = App42API::buildRecommenderService(); $recommender = $recommenderService->userBasedNeighborhoodBySimilarityForAll($recommenderSimilarity,$size, $howMany); $recommendedItemList = $recommender->getRecommendedItemList(); foreach( $recommendedItemList as $recommendedItem ){ print_r("value is" . $recommendedItem->getValue()); print_r("item is" . $recommendedItem->getItem()); } $jsonResponse = $recommender->toString();Coming SoonComing SoonComing SoonComing SoonString recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; int size = 2; int howMany = 3; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.userBasedNeighborhoodBySimilarityForAll(recommenderSimilarity,size, howMany); Vector recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i< recommendedItemList.size();i++) { Recommender.RecommendedItem recommendedItem = (Recommender.RecommendedItem) recommendedItemList.elementAt(i); System.out.println("userId is " + recommendedItem.getUserId()); System.out.println("item is " + recommendedItem.getItem()); System.out.println("value is " + recommendedItem.getValue()); } String jsonResponse = recommender.toString();
Recommendations are found based on threshold where threshold represents a type of similarity where users are at least similar to a particular level. Threshold values can vary from -1 to 1.
Required Parameters
userId - The user ID for whom recommendations have to be found.
threshold - Threshold size. Values can vary from -1 to 1.
howMany - Specify that how many recommendations have to be found.
long userId = 1; double threshold = 0.5; int howMany = 2; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); recommenderService.userBasedThreshold(userId,threshold, howMany, new App42CallBack() { public void onSuccess(Object response) { Recommender recommender = (Recommender )response; ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });long userId = 1; double threshold = 0.5; int howMany = 2; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); recommenderService.UserBasedThreshold(userId, threshold, howMany,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Recommender recommender = (Recommender) response; String jsonResponse = recommender.ToString(); } }long userId = 3; int size = 4567788 ; int howMany = 2; ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"API_KEY"; api.secretKey = @"SECRET_KEY"; RecommenderService *recommenderService = [api buildRecommenderService]; [recommenderService userBasedNeighborhood:userId size:size howMany:howMany completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Recommender *recommender = (Recommender*)responseObj; NSMutableArray *recommendedItemList = recommender.recommendedItemList; for(RecommendedItem *recommendedItem in recommendedItemList){ NSLog(@"item is = %@",recommendedItem.userId); NSLog(@"value is = %f",recommendedItem.value); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not Availablelong userId = 1; double threshold = 0.5; int howMany = 2; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.userBasedThreshold(userId, threshold, howMany); ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } String jsonResponse = recommender.toString();Coming SoonNot AvailableComing SoonComing SoonInt64 userId = 1; Double threshold = 0.5; int howMany = 2; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); Recommender recommender = recommenderService.UserBasedThreshold(userId, threshold, howMany); IList<Recommender.RecommendedItem> recommendedItemList = recommender.GetRecommendedItemList(); for(int i = 0; i < recommendedItemList.Count; i++) { Console.WriteLine("item is " + recommendedItemList[0].GetItem()); Console.WriteLine("value is " + recommendedItemList[0].GetValue()); } String jsonResponse = recommender.ToString();$userId = 1; $threshold = 0.5; $howMany = 2; App42API::initialize("API_KEY","SECRET_KEY"); $recommenderService = App42API::buildRecommenderService(); $recommender = $recommenderService-> userBasedThreshold($userId, $threshold, $howMany); $recommendedItemList = $recommender-> getRecommendedItemList(); foreach( $recommendedItemList as $recommendedItem ){ print_r("value is" . $recommendedItem->getValue()); print_r("item is" . $recommendedItem->getItem()); } $jsonResponse = $recommender->toString();Coming SoonComing SoonComing SoonComing Soonlong userId = 1; double threshold = 0.5; int howMany = 2; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.userBasedThreshold(userId, threshold, howMany); Vector recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i< recommendedItemList.size();i++) { Recommender.RecommendedItem recommendedItem = (Recommender.RecommendedItem) recommendedItemList.elementAt(i); System.out.println("item is " + recommendedItem.getItem()); System.out.println("value is " + recommendedItem.getValue()); } String jsonResponse = recommender.toString();
Recommendations are found based on threshold where threshold represents a type of similarity where users are at least similar to a particular level. Threshold values can vary from -1 to 1.
Required Parameters
threshold - Threshold size. Values can vary from -1 to 1.
howMany - Specifies that how many recommendations have to be found.
double threshold = 1; int howMany = 3; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); recommenderService.userBasedThresholdForAll(threshold, howMany, new App42CallBack() { public void onSuccess(Object response) { Recommender recommender = (Recommender )response; ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("userId is " + recommendedItemList.get(i).getUserId()); System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });double threshold = 1; int howMany = 3; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); recommenderService.UserBasedThresholdForAll(threshold, howMany,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Recommender recommender = (Recommender) response; String jsonResponse = recommender.ToString(); } }double threshold = 1; int howMany = 3; ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"API_KEY"; api.secretKey = @"SECRET_KEY"; RecommenderService *recommenderService = [api buildRecommenderService]; [recommenderService userBasedThresholdForAll:threshold howMany:howMany completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Recommender *recommender = (Recommender*)responseObj; NSMutableArray *recommendedItemList = recommender.recommendedItemList; for(RecommendedItem *recommendedItem in recommendedItemList){ NSLog(@"item is = %@",recommendedItem.userId); NSLog(@"value is = %f",recommendedItem.value); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not Availabledouble threshold = 1; int howMany = 3; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.userBasedThresholdForAll(threshold, howMany); ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("userId is " + recommendedItemList.get(i).getUserId()); System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } String jsonResponse = recommender.toString();Coming SoonNot AvailableComing SoonComing SoonDouble threshold = 1; int howMany = 3; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); Recommender recommender = recommenderService.UserBasedThresholdForAll(threshold, howMany); IList<Recommender.RecommendedItem> recommendedItemList = recommender.GetRecommendedItemList(); for(int i = 0; i < recommendedItemList.Count; i++) { Console.WriteLine("userId is " + recommendedItemList[0].GetUserId()); Console.WriteLine("item is " + recommendedItemList[0].GetItem()); Console.WriteLine("value is " + recommendedItemList[0].GetValue()); } String jsonResponse = recommender.ToString();$threshold = 1; $howMany = 3; App42API::initialize("API_KEY","SECRET_KEY"); $recommenderService = App42API::buildRecommenderService(); $recommender = $recommenderService->userBasedThresholdForAll($threshold, $howMany); $recommendedItemList = $recommender->getRecommendedItemList(); $success = $recommender->isResponseSuccess(); $jsonResponse = $recommender->toString();Coming SoonComing SoonComing SoonComing Soondouble threshold = 1; int howMany = 3; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.userBasedThresholdForAll(threshold, howMany); Vector recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i< recommendedItemList.size();i++) { Recommender.RecommendedItem recommendedItem = (Recommender.RecommendedItem) recommendedItemList.elementAt(i); System.out.println("userId is " + recommendedItem.getUserId()); System.out.println("item is " + recommendedItem.getItem()); System.out.println("value is " + recommendedItem.getValue()); } String jsonResponse = recommender.toString();
Recommendations are found based on threshold where threshold represents a type of similarity where users are at least similar to a particular level. Threshold values can vary from -1 to 1.
Required Parameters
recommenderSimilarity - Similarity algorithm e.g. Recommender.EUCLIDEAN_DISTANCE and Recommender.PEARSON_CORRELATION.
userId - The user ID for whom recommendations have to be found.
threshold - Threshold size. Values can vary from -1 to 1.
howMany - Specify that how many recommendations have to be found.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); RecommenderSimilarity recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; long userId = 1; double threshold = 0.5; int howMany = 1; recommenderService.userBasedThresholdBySimilarity(recommenderSimilarity, userId, threshold, howMany, new App42CallBack() { public void onSuccess(Object response) { Recommender recommender = (Recommender )response; ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("userId is " + recommendedItemList.get(i).getUserId()); System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; long userId = 1; int size = 2; int howMany = 2; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); recommenderService.UserBasedNeighborhoodBySimilarity(recommenderSimilarity,userId, size, howMany,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Recommender recommender = (Recommender) response; String jsonResponse = recommender.ToString(); } }RecommenderSimilarity recommenderSimilarity = EUCLIDEAN_DISTANCE; long userId = 1; double threshold = 0.5; int howMany = 1; ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"API_KEY"; api.secretKey = @"SECRET_KEY"; RecommenderService *recommenderService = [api buildRecommenderService]; [recommenderService userBasedThresholdBySimilarity:EUCLIDEAN_DISTANCE userId:userId threshold:threshold howMany:howMany completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Recommender *recommender = (Recommender*)responseObj; NSMutableArray *recommendedItemList = recommender.recommendedItemList; for(RecommendedItem *recommendedItem in recommendedItemList){ NSLog(@"item is = %@",recommendedItem.userId); NSLog(@"value is = %f",recommendedItem.value); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not AvailableApp42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); RecommenderSimilarity recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; long userId = 1; double threshold = 0.5; int howMany = 1; Recommender recommender = recommenderService.userBasedThresholdBySimilarity(recommenderSimilarity, userId, threshold, howMany); ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("userId is " + recommendedItemList.get(i).getUserId()); System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } String jsonResponse = recommender.toString();Coming SoonNot AvailableComing SoonComing SoonString recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; Int64 userId = 1; Double threshold = 0.5; int howMany = 1; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); Recommender recommender = recommenderService.UserBasedThresholdBySimilarity(recommenderSimilarity, userId, threshold, howMany); IList<Recommender.RecommendedItem> recommendedItemList = recommender.GetRecommendedItemList(); for(int i = 0; i < recommendedItemList.Count; i++) { Console.WriteLine("item is " + recommendedItemList[0].GetItem()); Console.WriteLine("value is " + recommendedItemList[0].GetValue()); } String jsonResponse = recommender.ToString();recommenderSimilarity = RecommenderSimilarity::EUCLIDEAN_DISTANCE; $userId = 1; $threshold = 0.5; $howMany = 1; App42API::initialize("API_KEY","SECRET_KEY"); $recommenderService = App42API::buildRecommenderService(); $recommender = $recommenderService->userBasedThresholdBySimilarity($recommenderSimilarity,$userId, $threshold, $howMany); $recommendedItemList = $recommender->getRecommendedItemList(); foreach( $recommendedItemList as $recommendedItem ){ print_r("value is" . $recommendedItem->getValue()); print_r("item is" . $recommendedItem->getItem()); } $jsonResponse = $recommender->toString();Coming SoonComing SoonComing SoonComing SoonString recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; long userId = 1; double threshold = 0.5; int howMany = 1; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.userBasedThresholdBySimilarity(recommenderSimilarity,userId, threshold, howMany); Vector recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i< recommendedItemList.size();i++) { Recommender.RecommendedItem recommendedItem = (Recommender.RecommendedItem) recommendedItemList.elementAt(i); System.out.println("item is " + recommendedItem.getItem()); System.out.println("value is " + recommendedItem.getValue()); } String jsonResponse = recommender.toString();
Recommendations for all users are found based on threshold where threshold represents a type of similarity where users are at least similar to a particular level. Threshold values can vary from -1 to 1.
Required Parameters
recommenderSimilarity - Similarity algorithm e.g. Recommender.EUCLIDEAN_DISTANCE and Recommender.PEARSON_CORRELATION.
threshold - Threshold size. Values can vary from -1 to 1.
howMany - Specifies that how many recommendations have to be found.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); RecommenderSimilarity recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; double threshold = 0.5; int howMany = 4; recommenderService.userBasedThresholdBySimilarityForAll(recommenderSimilarity, threshold, howMany, new App42CallBack() { public void onSuccess(Object response) { Recommender recommender = (Recommender )response; ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("userId is " + recommendedItemList.get(i).getUserId()); System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; double threshold = 0.5; int howMany = 4; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); recommenderService.UserBasedThresholdBySimilarityForAll(recommenderSimilarity, threshold, howMany,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Recommender recommender = (Recommender) response; String jsonResponse = recommender.ToString(); } }double threshold = 0.5; int howMany = 4; ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"API_KEY"; api.secretKey = @"SECRET_KEY"; RecommenderService *recommenderService = [api buildRecommenderService]; [recommenderService userBasedThresholdBySimilarityForAll:EUCLIDEAN_DISTANCE threshold:threshold howMany:howMany completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Recommender *recommender = (Recommender*)responseObj; NSMutableArray *recommendedItemList = recommender.recommendedItemList; for(RecommendedItem *recommendedItem in recommendedItemList){ NSLog(@"item is = %@",recommendedItem.userId); NSLog(@"value is = %f",recommendedItem.value); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not AvailableApp42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); RecommenderSimilarity recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; double threshold = 0.5; int howMany = 4; Recommender recommender = recommenderService.userBasedThresholdBySimilarityForAll(recommenderSimilarity, threshold, howMany); ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("userId is " + recommendedItemList.get(i).getUserId()); System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } String jsonResponse = recommender.toString();Coming SoonNot AvailableComing SoonComing SoonString recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; Double threshold = 0.5; int howMany = 4; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); Recommender recommender = recommenderService.UserBasedThresholdBySimilarityForAll(recommenderSimilarity, threshold, howMany); IList<Recommender.RecommendedItem> recommendedItemList = recommender.GetRecommendedItemList(); for(int i = 0; i < recommendedItemList.Count; i++) { Console.WriteLine("userId is " + recommendedItemList[0].GetUserId()); Console.WriteLine("item is " + recommendedItemList[0].GetItem()); Console.WriteLine("value is " + recommendedItemList[0].GetValue()); } String jsonResponse = recommender.ToString();$recommenderSimilarity = RecommenderSimilarity::EUCLIDEAN_DISTANCE; $threshold = 0.5; $howMany = 4; App42API::initialize("API_KEY","SECRET_KEY"); $recommenderService = App42API::buildRecommenderService(); $recommender = $recommenderService->userBasedThresholdBySimilarityForAll($recommenderSimilarity,$threshold, $howMany); $recommendedItemList = $recommender->getRecommendedItemList(); foreach( $recommendedItemList as $recommendedItem ){ print("userId is" . $recommendedItem->getUserId()); print_r("value is" . $recommendedItem->getValue()); print_r("item is" . $recommendedItem->getItem()); } $jsonResponse = $recommender->toString();Coming SoonComing SoonComing SoonComing SoonString recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; double threshold = 0.5; int howMany = 4; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.userBasedThresholdBySimilarityForAll(recommenderSimilarity, preferenceFileName, threshold, howMany); Vector recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i< recommendedItemList.size();i++) { Recommender.RecommendedItem recommendedItem = (Recommender.RecommendedItem) recommendedItemList.elementAt(i); System.out.println("userId is " + recommendedItem.getUserId()); System.out.println("item is " + recommendedItem.getItem()); System.out.println("value is " + recommendedItem.getValue()); } String jsonResponse = recommender.toString();
Recommendations are found based item similarity of the given user. The size of the neighborhood can be entered.
Required Parameters
userId - The user Id for whom recommendations have to be found.
howMany - Specify that how many recommendations have to be found.
long userId = 1; int howMany = 1; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); recommenderService.itemBased(userId, howMany, new App42CallBack() { public void onSuccess(Object response) { Recommender recommender = (Recommender )response; ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });long userId = 1; int howMany = 1; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); recommenderService.ItemBased(preferenceFileName, userId, howMany,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Recommender recommender = (Recommender) response; String jsonResponse = recommender.ToString(); } }long userId = 1; int howMany = 1; ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"API_KEY"; api.secretKey = @"SECRET_KEY"; RecommenderService *recommenderService = [api buildRecommenderService]; [recommenderService itemBased:preferenceFileName userId:userId howMany:howMany completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Recommender *recommender = (Recommender*)responseObj; NSMutableArray *recommendedItemList = recommender.recommendedItemList; for(RecommendedItem *recommendedItem in recommendedItemList){ NSLog(@"item is = %@",recommendedItem.userId); NSLog(@"value is = %f",recommendedItem.value); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not Availablelong userId = 1; int howMany = 1; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.itemBased(userId, howMany); ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } String jsonResponse = recommender.toString();Coming SoonNot AvailableComing SoonComing SoonInt64 userId = 1; int howMany = 1; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); Recommender recommender = recommenderService.ItemBased(userId, howMany); IList<Recommender.RecommendedItem> recommendedItemList = recommender.GetRecommendedItemList(); for(int i = 0; i < recommendedItemList.Count; i++) { Console.WriteLine("item is " + recommendedItemList[0].GetItem()); Console.WriteLine("value is " + recommendedItemList[0].GetValue()); } String jsonResponse = recommender.ToString();$userId = 1; $howMany = 1; $recommender = $recommenderService->itemBased($userId, $howMany); App42API::initialize("API_KEY","SECRET_KEY"); $recommenderService = App42API::buildRecommenderService(); $recommendedItemList = $recommender->getRecommendedItemList(); foreach( $recommendedItemList as $recommendedItem ){ print_r("value is" . $recommendedItem->getValue()); print_r("item is" . $recommendedItem->getItem()); } $jsonResponse = $recommender->toString();Coming SoonComing SoonComing SoonComing Soonlong userId = 1; int howMany = 1; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.itemBased(userId, howMany); Vector recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i< recommendedItemList.size();i++) { Recommender.RecommendedItem recommendedItem = (Recommender.RecommendedItem) recommendedItemList.elementAt(i); System.out.println("item is " + recommendedItem.getItem()); System.out.println("value is " + recommendedItem.getValue()); } String jsonResponse = recommender.toString();
Recommendations are found based on item similarity of the given user. The size of the neighborhood can be entered.
Required Parameters
howMany - Specifies that how many recommendations have to be found.
int howMany = 3; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); recommenderService.itemBasedForAll(howMany, new App42CallBack() { public void onSuccess(Object response) { Recommender recommender = (Recommender )response; ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("userId is " + recommendedItemList.get(i).getUserId()); System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });public class Callback : App42Callback { int howMany = 3; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); recommenderService.ItemBasedForAll(howMany,this); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Recommender recommender = (Recommender) response; String jsonResponse = recommender.ToString(); } }int howMany = 3; ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"API_KEY"; api.secretKey = @"SECRET_KEY"; RecommenderService *recommenderService = [api buildRecommenderService]; [recommenderService itemBasedForAll:howMany completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Recommender *recommender = (Recommender*)responseObj; NSMutableArray *recommendedItemList = recommender.recommendedItemList; for(RecommendedItem *recommendedItem in recommendedItemList){ NSLog(@"item is = %@",recommendedItem.userId); NSLog(@"value is = %f",recommendedItem.value); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not Availableint howMany = 3; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.itemBasedForAll(howMany); ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("userId is " + recommendedItemList.get(i).getUserId()); System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } String jsonResponse = recommender.toString();Coming SoonNot AvailableComing SoonComing Soonint howMany = 3; String recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; int howMany = 5; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); Recommender recommender = recommenderService.ItemBasedForAll(howMany); IList<Recommender.RecommendedItem> recommendedItemList = recommender.GetRecommendedItemList(); for(int i = 0; i < recommendedItemList.Count; i++) { Console.WriteLine("userId is " + recommendedItemList[0].GetUserId()); Console.WriteLine("item is " + recommendedItemList[0].GetItem()); Console.WriteLine("value is " + recommendedItemList[0].GetValue()); } String jsonResponse = recommender.ToString();$howMany = 3; App42API::initialize("API_KEY","SECRET_KEY"); $recommenderService = App42API::buildRecommenderService(); $recommender = $recommenderService->itemBasedForAll($howMany); $recommendedItemList = $recommender->getRecommendedItemList(); foreach( $recommendedItemList as $recommendedItem ){ print("userId is" . $recommendedItem->getUserId()); print_r("value is" . $recommendedItem->getValue()); print_r("item is" . $recommendedItem->getItem()); } $jsonResponse = $recommender->toString();Coming SoonComing SoonComing SoonComing Soonint howMany = 3; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.itemBasedForAll(howMany); Vector recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i< recommendedItemList.size();i++) { Recommender.RecommendedItem recommendedItem = (Recommender.RecommendedItem) recommendedItemList.elementAt(i); System.out.println("userId is " + recommendedItem.getUserId()); System.out.println("item is " + recommendedItem.getItem()); System.out.println("value is " + recommendedItem.getValue()); } String jsonResponse = recommender.toString();
Recommendations are found based on item similarity. Similarity algorithm can be specified of the given user. The size of the neighborhood can be entered.
Required Parameters
recommenderSimilarity - Similarity algorithm e.g. Recommender.EUCLIDEAN_DISTANCE and Recommender.PEARSON_CORRELATION.
userId - The user ID for whom recommendations have to be found.
howMany - Specify that how many recommendations have to be found.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); RecommenderSimilarity recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; long userId = 1; int howMany = 1; recommenderService.itemBasedBySimilarity(recommenderSimilarity, userId, howMany, new App42CallBack() { public void onSuccess(Object response) { Recommender recommender = (Recommender )response; ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; long userId = 1; int howMany = 1; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); recommenderService.ItemBasedBySimilarity(recommenderSimilarity, userId, howMany,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Recommender recommender = (Recommender) response; String jsonResponse = recommender.ToString(); } }long userId = 1; int howMany = 1; ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"API_KEY"; api.secretKey = @"SECRET_KEY"; RecommenderService *recommenderService = [api buildRecommenderService]; [recommenderService itemBased:userId howMany:howMany completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Recommender *recommender = (Recommender*)responseObj; NSMutableArray *recommendedItemList = recommender.recommendedItemList; for(RecommendedItem *recommendedItem in recommendedItemList){ NSLog(@"item is = %@",recommendedItem.userId); NSLog(@"value is = %f",recommendedItem.value); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not AvailableApp42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); RecommenderSimilarity recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; long userId = 1; int howMany = 1; Recommender recommender = recommenderService.itemBasedBySimilarity(recommenderSimilarity, userId, howMany); ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } String jsonResponse = recommender.toString();Coming SoonNot AvailableComing SoonComing SoonString recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; Int64 userId = 1; int howMany = 1; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); Recommender recommender = recommenderService.ItemBasedBySimilarity(recommenderSimilarity, userId, howMany); IList<Recommender.RecommendedItem> recommendedItemList = recommender.GetRecommendedItemList(); for(int i = 0; i < recommendedItemList.Count; i++) { Console.WriteLine("item is " + recommendedItemList[0].GetItem()); Console.WriteLine("value is " + recommendedItemList[0].GetValue()); } String jsonResponse = recommender.ToString();App42API::initialize("API_KEY","SECRET_KEY"); $recommenderService = App42API::buildRecommenderService(); recommenderSimilarity = RecommenderSimilarity::EUCLIDEAN_DISTANCE; $userId = 1; $howMany = 1; $recommender = $recommenderService->itemBasedBySimilarity($recommenderSimilarity,$userId, $howMany); $recommendedItemList = $recommender->getRecommendedItemList(); foreach( $recommendedItemList as $recommendedItem ){ print_r("value is" . $recommendedItem->getValue()); print_r("item is" . $recommendedItem->getItem()); } $jsonResponse = $recommender->toString();Coming SoonComing SoonComing SoonComing SoonString recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; long userId = 1; int howMany = 1; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.itemBasedBySimilarity(recommenderSimilarity, userId, howMany); Vector recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i< recommendedItemList.size();i++) { Recommender.RecommendedItem recommendedItem = (Recommender.RecommendedItem) recommendedItemList.elementAt(i); System.out.println("item is " + recommendedItem.getItem()); System.out.println("value is " + recommendedItem.getValue()); } String jsonResponse = recommender.toString();
Recommendations are found based on item similarity of the given user. The size of the neighborhood can be entered
Required Parameters
howMany - Specify that how many recommendations have to be found.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); RecommenderSimilarity recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; int howMany = 5; recommenderService.itemBasedBySimilarityForAll(recommenderSimilarity, howMany, new App42CallBack() { public void onSuccess(Object response) { Recommender recommender = (Recommender )response; ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("userId is " + recommendedItemList.get(i).getUserId()); System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; int howMany = 5; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); recommenderService.ItemBasedBySimilarityForAll(recommenderSimilarity,howMany,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object obj) { Recommender recommender = (Recommender) obj; IList<Recommender.RecommendedItem> recommendedItemList = recommender.GetRecommendedItemList(); for(int i = 0; i < recommendedItemList.Count; i++) { Console.WriteLine("user Id is " + recommendedItemList[i].GetUserId()); Console.WriteLine("item is " + recommendedItemList[i].GetItem()); Console.WriteLine("value is " + recommendedItemList[i].GetValue()); } String jsonResponse = recommendedItemList.ToString(); } }long userId = 1; int howMany = 1; ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"API_KEY"; api.secretKey = @"SECRET_KEY"; RecommenderService *recommenderService = [api buildRecommenderService]; [recommenderService itemBased:userId howMany:howMany completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Recommender *recommender = (Recommender*)responseObj; NSMutableArray *recommendedItemList = recommender.recommendedItemList; for(RecommendedItem *recommendedItem in recommendedItemList){ NSLog(@"item is = %@",recommendedItem.userId); NSLog(@"value is = %f",recommendedItem.value); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not AvailableApp42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); RecommenderSimilarity recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; int howMany = 5; Recommender recommender = recommenderService.itemBasedBySimilarityForAll(recommenderSimilarity, howMany); ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("userId is " + recommendedItemList.get(i).getUserId()); System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } String jsonResponse = recommender.toString();Coming SoonNot AvailableComing SoonComing SoonString recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; int howMany = 5; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); Recommender recommender = recommenderService.ItemBasedBySimilarityForAll(recommenderSimilarity, howMany); IList<Recommender.RecommendedItem> recommendedItemList = recommender.GetRecommendedItemList(); for(int i = 0; i < recommendedItemList.Count; i++) { Console.WriteLine("userId is " + recommendedItemList[0].GetUserId()); Console.WriteLine("item is " + recommendedItemList[0].GetItem()); Console.WriteLine("value is " + recommendedItemList[0].GetValue()); } String jsonResponse = recommender.ToString();App42API::initialize("API_KEY","SECRET_KEY"); $recommenderService = App42API::buildRecommenderService(); $recommenderSimilarity = RecommenderSimilarity::EUCLIDEAN_DISTANCE; $howMany = 5; $recommender = $recommenderService->itemBasedBySimilarityForAll($recommenderSimilarity,$howMany); $recommendedItemList = $recommender->getRecommendedItemList(); foreach( $recommendedItemList as $recommendedItem ){ print("userId is" . $recommendedItem->getUserId()); print_r("value is" . $recommendedItem->getValue()); print_r("item is" . $recommendedItem->getItem()); } $jsonResponse = $recommender->toString();Coming SoonComing SoonComing SoonComing SoonString recommenderSimilarity = RecommenderSimilarity.EUCLIDEAN_DISTANCE; int howMany = 5; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.itemBasedBySimilarityForAll(recommenderSimilarity,howMany); Vector recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i< recommendedItemList.size();i++) { Recommender.RecommendedItem recommendedItem = (Recommender.RecommendedItem) recommendedItemList.elementAt(i); System.out.println("userId is " + recommendedItem.getUserId()); System.out.println("item is " + recommendedItem.getItem()); System.out.println("value is " + recommendedItem.getValue()); } String jsonResponse = recommender.toString();
Recommendations based on SlopeOne Algorithm for all Users.
Required Parameters
howMany - Specify that how many recommendations have to be found.
int howMany = 3; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); recommenderService.slopeOneForAll(howMany, new App42CallBack() { public void onSuccess(Object response) { Recommender recommender = (Recommender )response; ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });int howMany = 3; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); recommenderService.SlopeOneForAll(howMany,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Recommender recommender = (Recommender) response; String jsonResponse = recommender.ToString(); } }int howMany = 3; ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"API_KEY"; api.secretKey = @"SECRET_KEY"; RecommenderService *recommenderService = [api buildRecommenderService]; [recommenderService slopeOneForAll:howMany completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Recommender *recommender = (Recommender*)responseObj; NSMutableArray *recommendedItemList = recommender.recommendedItemList; for(RecommendedItem *recommendedItem in recommendedItemList){ NSLog(@"item is = %@",recommendedItem.userId); NSLog(@"value is = %f",recommendedItem.value); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not Availableint howMany = 3; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.slopeOneForAll(howMany); ArrayList<Recommender.RecommendedItem> recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i<recommendedItemList.size();i++) { System.out.println("item is " + recommendedItemList.get(i).getItem()); System.out.println("value is " + recommendedItemList.get(i).getValue()); } String jsonResponse = recommender.toString();Coming SoonNot AvailableComing SoonComing Soonint howMany = 3; App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); Recommender recommender = recommenderService.SlopeOneForAll(howMany); IList<Recommender.RecommendedItem> recommendedItemList = recommender.GetRecommendedItemList(); for(int i = 0; i < recommendedItemList.Count; i++) { Console.WriteLine("item is " + recommendedItemList[0].GetItem()); Console.WriteLine("value is " + recommendedItemList[0].GetValue()); } String jsonResponse = recommender.ToString();$howMany = 3; App42API::initialize("API_KEY","SECRET_KEY"); $recommenderService = App42API::buildRecommenderService(); $recommender = $recommenderService->slopeOneForAll($howMany); $recommendedItemList = $recommender->getRecommendedItemList(); foreach( $recommendedItemList as $recommendedItem ){ print_r("value is" . $recommendedItem->getValue()); print_r("item is" . $recommendedItem->getItem()); } $jsonResponse = $recommender->toString();Coming SoonComing SoonComing SoonComing Soonint howMany = 3; App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); Recommender recommender = recommenderService.slopeOneForAll(howMany); Vector recommendedItemList = recommender.getRecommendedItemList(); for(int i=0;i< recommendedItemList.size();i++) { Recommender.RecommendedItem recommendedItem = (Recommender.RecommendedItem) recommendedItemList.elementAt(i); System.out.println("item is " + recommendedItem.getItem()); System.out.println("value is " + recommendedItem.getValue()); } String jsonResponse = recommender.toString();
Delete existing preference file.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); recommenderService.deleteAllPreferences(new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); recommenderService.DeleteAllPreferences(new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object object) { App42Response response = (App42Response) object; String jsonResponse = response.ToString(); } }ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"API_KEY"; api.secretKey = @"SECRET_KEY"; RecommenderService *recommenderService = [api buildRecommenderService]; [recommenderService deleteAllPreferences:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not AvailableApp42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); App42Response app42response = recommenderService.deleteAllPreferences(); System.out.println("response is " + app42response) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();Coming SoonNot AvailableComing SoonComing SoonApp42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); App42Response response = recommenderService.DeleteAllPreferences(); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();App42API::initialize("API_KEY","SECRET_KEY"); $recommenderService = App42API::buildRecommenderService(); $response = $recommenderService->deleteAllPreferences(); $success = $respons->isResponseSuccess(); $jsonResponse = $respons->toString();Coming SoonComing SoonComing SoonComing SoonApp42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); App42Response response = recommenderService.deleteAllPreferences(); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();
Add or Update preference list on the cloud.
Required Parameters
preferenceDataList - List of Preference Data, which contains customerId, itemId, preference.
ArrayList<PreferenceData> preferenceDataList = new ArrayList<PreferenceData>(); PreferenceData preferenceData = new PreferenceData(); preferenceData.setItemId("1"); preferenceData.setPreference("0.5"); preferenceData.setUserId("1"); preferenceDataList.add(preferenceData); App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); recommenderService.addOrUpdatePreference(preferenceDataList, new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });Coming SoonPreferenceData *preferenceData = [[PreferenceData alloc]init]; preferenceData.userId = @"101"; preferenceData.itemId = @"1"; preferenceData.preference = @"0.5"; NSMutableArray *mutableArray = [[NSMutableArray alloc]init]; [mutableArray addObject:preferenceData]; ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"API_KEY"; api.secretKey = @"SECRET_KEY"; RecommenderService *recommenderService = [api buildRecommenderService]; [recommenderService addOrUpdatePreference:mutableArray completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];Not AvailableArrayList<PreferenceData> preferenceDataList = new ArrayList<PreferenceData>(); PreferenceData preferenceData = new PreferenceData(); preferenceData.setItemId("1"); preferenceData.setPreference("0.5"); preferenceData.setUserId("1"); preferenceDataList.add(preferenceData); App42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); App42Response app42response = recommenderService.addOrUpdatePreference(preferenceDataList); System.out.println("response is :" + app42response);Coming SoonNot AvailableComing SoonComing SoonComing SoonComing SoonComing SoonComing SoonApp42Log.setDebug(true); var preferenceDataList:Array = new Array(); var preferenceData:PreferenceData = new PreferenceData(); preferenceData.setItemId("1"); preferenceData.setPreference("0.5"); preferenceData.setUserId("1"); preferenceDataList.push(preferenceData); recommenderService.addOrUpdatePreference(preferenceDataList,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("response is " + app42response) } }Coming SoonComing Soon
The functions available under Recommendation API can throw some exceptions in abnormal conditions. For example, if a developer is uploading the Preference File which does not have any data, the loadPreferenceFile function will throw the App42Exception (as shown below) with message as “Bad Request” and the appErrorCode as “2805” and the details as “Preference Data is not valid.”
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); recommenderService.loadPreferenceFile("Your File Path", new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { App42Exception exception = (App42Exception)ex; int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 2805) { // Handle here for Bad Request (Preference Data is not valid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = ex.getMessage(); /* returns the Exception text in JSON format. (as shown below)*/ } });App42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); recommenderService.loadPreferenceFile("Your File Path",new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 2805) { // Handle here for Bad Request (Preference Data is not valid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.GetMessage(); } public void OnSuccess(Object object) { App42Response response = (App42Response) object; String jsonResponse = response.ToString(); } }ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"API_KEY"; api.secretKey = @"SECRET_KEY"; RecommenderService *recommenderService = [api buildRecommenderService]; [recommenderService loadPreferenceFile:@"Your File Path" completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString]; } else { int appErrorCode = exception.appErrorCode; int httpErrorCode = exception.httpErrorCode; if(appErrorCode == 2805) { // Handle here for Bad Request (Preference Data is not valid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } NSString *jsonText = exception.reason; } }];Not AvailableApp42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); try { App42Response response = recommenderService.loadPreferenceFile("Your File Path"); } catch(App42Exception ex) { int appErrorCode = ex.getAppErrorCode(); int httpErrorCode = ex.getHttpErrorCode(); if(appErrorCode == 2805) { // Handle here for Bad Request (Preference Data is not valid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = ex.getMessage(); /* returns the Exception text in JSON format. (as shown below)*/ }Coming SoonNot AvailableComing SoonComing SoonApp42API.Initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.BuildRecommenderService(); try { App42Response response = recommenderService.LoadPreferenceFile("Your File Path"); } catch(App42Exception ex) { int appErrorCode = ex.GetAppErrorCode(); int httpErrorCode = ex.GetHttpErrorCode(); if(appErrorCode == 2805) { // Handle here for Bad Request (Preference Data is not valid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = ex.GetMessage(); /* returns the Exception text in JSON format. (as shown below)*/ }App42API::initialize("API_KEY","SECRET_KEY"); $recommenderService = App42API::buildRecommenderService(); try { $response = $recommenderService->loadPreferenceFile("Your File Path") } catch(App42Exception $exception) { $appErrorCode =$exception->getAppErrorCode(); $httpErrorCode = $exception->getHttpErrorCode(); if($appErrorCode == 2805) { // Handle here for Bad Request (Preference Data is not valid.) } else if($appErrorCode == 1401) { // handle here for Client is not authorized } else if($appErrorCode == 1500) { // handle here for Internal Server Error } $jsonText = $exception->getMessage(); }Coming SoonComing SoonComing SoonComing SoonApp42API.initialize("API_KEY","SECRET_KEY"); RecommenderService recommenderService = App42API.buildRecommenderService(); try { App42Response response = recommenderService.loadPreferenceFile("Your File Path"); } catch(App42Exception ex) { int appErrorCode = ex.getAppErrorCode(); int httpErrorCode = ex.getHttpErrorCode(); if(appErrorCode == 2805) { // Handle here for Bad Request (Preference Data is not valid.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = ex.getMessage(); /* returns the Exception text in JSON format. (as shown below)*/ }
Functions in User API might throw exceptions with following HTTP and Application Error Codes (along with their descriptions):
1400 - BAD REQUEST - The Request parameters are invalid
1401 - UNAUTHORIZED - Client is not authorized
1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again.
2800 - NOT FOUND - Preferences does not exist.
2801 - NOT FOUND - There are no recommendations for optimize values for 'size' and 'howMany'.
2802 - BAD REQUEST - InvalidArgumentException: '@e.getMessage()'.
2803 - NOT FOUND - There are no recommendations for optimize values for 'threshold' and 'howMany'.
2804 - BAD REQUEST - InvalidArgumentException: NoSuchUserException : UserId '@e.getMessage()'.
2805 - BAD REQUEST - Preference Data is not valid.