Code Monkey home page Code Monkey logo

crab's Introduction

python-recsys

A python library for implementing a recommender system.

Installation

Dependencies

python-recsys is build on top of Divisi2, with csc-pysparse (Divisi2 also requires NumPy).

python-recsys also requires SciPy.

To install the dependencies do something like this (Ubuntu):

sudo apt-get install python-scipy
sudo apt-get install python-numpy
sudo pip install csc-pysparse
sudo pip install divisi2

# If you don't have pip installed then do:
# sudo easy_install csc-pysparse
# sudo easy_install divisi2

Download

Download python-recsys from github.

Install

tar xvfz python-recsys.tar.gz
cd python-recsys
sudo python setup.py install

Documentation

Documentation and examples available here.

To create the HTML documentation files from doc/source do:

cd doc
make html

HTML files are created here:

doc/build/html/index.html

crab's People

Contributors

fcurella avatar irgmedeiros avatar larsmans avatar marcelcaraciolo avatar vinigracindo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

crab's Issues

Implement the pairwise metrics

It will be implemented the pairwise metrics with new signatures in order to get the same code for several functions.

For instance consider the pearson correlation which can be expressed as cosine pairwise metric changing the inputs. (Follow the link: http://pt.wikipedia.org/wiki/Coeficiente_de_correla%C3%A7%C3%A3o_de_Pearson)

The mahantan and euclidean metrics can be considered a Lp-norm changing the p = {1,2,3 ...}

Before commiting I recommend you test without optimizations to check those assertives and post the gist so we can disccuss.

Implement the pairwise similarities module.

In this task we need to implement the most used pairwise similarities provided in this source-code:

https://github.com/muricoca/crab/blob/master/scikits/crab/metrics/pairwise.py

We need check each one as also optimize them individually.

I think some of them are not optimized.

For inspiration check this:

https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/metrics/pairwise.py
http://svn.apache.org/repos/asf/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/similarity/

Implement the BaseRecommender

The goal is to implement the base recommender that will be an abstract class that any recommender implemented in crab will derive.

It must include an internal structure for storing the parameters and attributes accordingly to the derived recommender needs.

Restart?

Hi,
Is this package actively being maintained?
If it's not, I'm looking to start something similar using the structure available.
Can I go ahead?

Create a BaseModel

Create a BaseModel for DataHolders:

Following the patterns::

def UserIDs(self):
    '''
    Return all user IDs in the model, in order
    '''
    raise NotImplementedError("cannot instantiate Abstract Base Class")

def PreferencesFromUser(self,userID,orderByID=True):
    '''
    Return user's preferences, ordered by user ID (if orderByID is True) 
    or by the preference values (if orderById is False), as an array.
    '''
    raise NotImplementedError("cannot instantiate Abstract Base Class")

def ItemIDsFromUser(self,userID):
    '''
    Return IDs of items user expresses a preference for 
    '''
    raise NotImplementedError("cannot instantiate Abstract Base Class")

def ItemIDs(self):
    '''
    Return a iterator of all item IDs in the model, in order
    '''
    raise NotImplementedError("cannot instantiate Abstract Base Class")

def PreferencesForItem(self,itemID,orderByID=True):
    '''
    Return all existing Preferences expressed for that item, 
    ordered by user ID (if orderByID is True) or by the preference values 
    (if orderById is False), as an array.
    '''
    raise NotImplementedError("cannot instantiate Abstract Base Class")

def PreferenceValue(self,userID,itemID):
    '''
    Retrieves the preference value for a single user and item.
    '''
    raise NotImplementedError("cannot instantiate Abstract Base Class")

def PreferenceTime(self,userID,itemID):
    '''
    Retrieves the time at which a preference value from a user and item was set, if known.
    Time is expressed in the usual way, as a number of milliseconds since the epoch.
    '''
    raise NotImplementedError("cannot instantiate Abstract Base Class")

def NumUsers(self):
    '''
    Return total number of users known to the model.
    '''
    raise NotImplementedError("cannot instantiate Abstract Base Class")

def NumItems(self):
    '''
    Return total number of items known to the model.
    '''
    raise NotImplementedError("cannot instantiate Abstract Base Class")

def NumUsersWithPreferenceFor(self,*itemIDs):
    '''
    Return the number of users who have expressed a preference for all of the items
    '''
    raise NotImplementedError("cannot instantiate Abstract Base Class")

def setPreference(self,userID,itemID,value):
    '''
    Sets a particular preference (item plus rating) for a user.
    '''
    raise NotImplementedError("cannot instantiate Abstract Base Class")

def removePreference(self,userID, itemID):
    '''
    Removes a particular preference for a user.
    '''
    raise NotImplementedError("cannot instantiate Abstract Base Class")

def convertItemID2name(self, itemID):
    """Given item id number return item name"""
    raise NotImplementedError("cannot instantiate Abstract Base Class")

def convertUserID2name(self, userID):
    """Given user id number return user name"""
    raise NotImplementedError("cannot instantiate Abstract Base Class") 


def hasPreferenceValues(self):
    '''
    Return True if this implementation actually it is not a 'boolean' DataModel.
    Otherwise returns False.
    '''
    raise NotImplementedError("cannot instantiate Abstract Base Class")


def MaxPreference(self):
    '''
    Return the maximum preference value that is possible in the current problem domain being evaluated.
    For example, if the domain is movie ratings on a scale of 1 to 5, this should be 5. While  a recommender
    may estimate a preference value above 5.0, it isn't "fair" to consider that the system is actually
    suggesting an impossible rating of, say, 5.4 stars.
    In practice the application would cap this estimate to 5.0. Since evaluators evaluate
    the difference between estimated and actual value, this at least prevents this effect from unfairly
    penalizing a Recommender.
    '''
    raise NotImplementedError("cannot instantiate Abstract Base Class")


def MinPreference(self):
    '''
    Returns the minimum preference value that is possible in the current problem domain being evaluated
    '''
    raise NotImplementedError("cannot instantiate Abstract Base Class")

Problems with nose tests with hierarchy of directories

We are facing problems with the hierarchy structure of directories when running the python test.py

So if we have:

crab
   crab/
      __init__.py.
      ...
      test.py

Running python test.py from crab/crab we get several errors in the tests.

However renaming the first directory to another name we get:

recsys/
     crab/
         __init__.py
         ...
        test.py

Running python test.py from recsys/crab we have success in the tests.

Investigate the problem why we are facing those errrors.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.