Ruby Client for the Rcmmndr platform
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
Gemfile
LICENSE
README.md
Rakefile
RubyRcmmndr.gemspec

README.md

RubyRcmmndr

Ruby Client for the Rcmmndr platform. It is using rest-client for communicating with the server

Installation

Add this line to your application's Gemfile:

gem 'RubyRcmmndr', '0.0.1', :git => 'https://github.com/Rcmmndr/RubyRcmmndr.git'

And then execute:

$ bundle

###Creating a Client Instance

client = RubyRcmmndr::Client.new("API_KEY")

###Adding Preferences

client.create_preference(1,102,2.5)

###Making Recommendations recs=client.get_recommendation(1) the Ruby Data Structure 'recs' contains the recommendation results as itemid,value pairs

###Usage Statistics You can check the usage statistics for your account as follows:

client.get_usage_stats()["total_preferences"]
client.get_usage_stats()["distinct_keys"]

###Deleting Preferences

####Deleting Preferences for specific user client.delete_preferences_of_user(1)

####Deleting All Preferences client.delete_all_preferences

###Bulk API Bulk API is a better way of inserting many number of preference values. It is done by posting a text file (comma or tab separated) to the server.

client.bulk_update_preferences("preferences.tsv")

where the contents of preferences.tsv are similar to the following: (userID,itemID,preference)

196,242,3
186,302,3
22,377,1
244,51,2
166,346,1

###Settings API

Using the settings API, you can finetune your recommender and try different recommendation algorithms. Please refer to the Restful API documentation for detailed usage of the Settings API.

####Getting Current Settings

client.get_settings()

Returns the current settings.

####Updating Settings

    rec = '
    {
         "recommender": {
              "impl":"GenericUserBasedRecommender",
              "params":{
                   "UserSimilarity" : {
                        "impl":"PearsonCorrelationSimilarity"
                   },
                   "UserNeighborhood":{
                        "impl":"NearestNUserNeighborhood",
                        "params": {
                             "n":2
                        }
                   }
              }
         }
    	}
     '

	client.update_settings(rec.to_json)

###Additional Notes You can also check the unit test which shows the basic usage scenario.