I was working on Recommender System and had a problem when i tried importing

from scikits.crab.recommenders.knn import UserBasedRecommender.

I encountered the following error

ImportError: No module named learn.base

no module named learn.base crab

I did research on the web and found one good solution but it was in Chinese. Here is the link and credit to the original fixer : i_with_u

http://blog.csdn.net/i_with_u/article/details/45460661

From the error trace you can see that the last import statement was “from sklearn.learn.base import BaseEstimator” or it can be “from scikit.learn.base import BaseEstimator”.

 

What you have to do is to go into the crab installation package and open the base.py file

no module named crab python base py

From the first import statement in the file, replace the whole of “scikits.learn” with “sklearn”

scikit learn sklearn crab python

Now save the file and run import again and that should fix the issue.

However, if you get a further error as below:

 

No Attribute named _set_params

 

as the original fixer got, you can follow his  direction as below:

However, this error, I found a foreigner solution on github: Open the error mentioned scikits \ Crab \ Recommenders \ KNN \ class.py , the first 138 and 600 lines ” self._set_params (** params ) “replaced” self.set_params (** params) . ”

Run again

To illustrate fixes worked fine and code runs fine, check the crab example code here:

Crab Recommender System installation error fix example code

 

Watch a quick video walk through here:

Hope this helps.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *