Giter Club home page Giter Club logo

winerama-recommender-tutorial's Introduction

Winerama

A web recommender tutorial tutorial using Python technologies such as Django, Pandas, or Scikit-learn, and others such as Bootstrap.

Join the chat at https://gitter.im/jadianes/winerama-recommender-tutorial

This repository contains the code for a wine reviews and recommendations web application, in different stages as git tags. The idea is that you can follow the tutorials through the tags listed below, and learn the different concepts explained in them. The tutorials include instructions on how to deploy the web using a Koding account. However, Koding recently moved from solo to team accounts and the link provided to my Koding account deployment of the tutorial result is not working anymore. The tutorial can still be followed with no problem at all.

Tutorials

The following tutorials will guide you through each of the previous Git tags while learning different concepts of data product development with Python.

Tags

  • stage-0: an empty repo.
  • stage-0.1: a Django project with one app called reviews. The app defines model entities.
  • stage-0.2: admin site up and running for our model entitities Wine and Review.
  • stage-0.3: views and templates are available.
  • stage-0.4: add review form added.
  • stage-0.5: template reuse.
  • stage-1: added Bootstrap 3 for Django.
  • stage-1.1: add_review now requires login. Added login templates and menu sesion links.
  • stage-1.2: a user reviews page created.
  • stage-2: user management done.
  • stage-2.1: Scripts to load CSV available + data loaded.
  • stage-2.2: An empty wine suggestions view has been added.
  • stage-2.3: Suggestions view now shows wines not reviewed by the user.
  • stage-2.4: Added cluster model object and manually created three clusters.
  • stage-2.5: Suggestions view now makes use of cluster information.
  • stage-3: K-means clustering based recommendations provided.

Contact

Feel free to contact me to discuss any issues, questions, or comments.

License

This repository contains a variety of content; some developed by Jose A. Dianes, and some from third-parties. The third-party content is distributed under the license provided by those parties.

The content developed by Jose A. Dianes is distributed under the following license:

Copyright 2016 Jose A Dianes

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

winerama-recommender-tutorial's People

Contributors

bitdeli-chef avatar gitter-badger avatar jadianes 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

winerama-recommender-tutorial's Issues

unsupported operand type(s) for /: 'map' and 'int'

Great demo for Django.

I ran the demo and came across with an error: unsupported operand type(s) for /: 'map' and 'int' which is related to these two lines:

all_ratings = map(lambda x: x.rating, self.review_set.all())
return np.mean(all_ratings)

It is for calculating the avarage rating by using numpy. But numpy is not in favor of map. So a possible solution is to turn the map object to a list.

np.mean(list(all_ratings))

Just in case that anyone out there happened to meet with the problem.

self.review_set

Could you please describe where the review_set is defined? In the models.py file, under the wine table, you've used this, self.review_set

Clustering Models:error

(wine) root@hal:~/Projects/Wine-Shop/wine/winerama# python3 manage.py migrate
SystemCheckError: System check identified some issues:

ERRORS:
reviews.Cluster.users: (fields.E300) Field defines a relation with model 'User', which is either not installed
, or is abstract.
reviews.Cluster.users: (fields.E307) The field reviews.Cluster.users was declared with a lazy reference to 're

views.user', but app 'reviews' doesn't provide model 'user'.
reviews.Cluster_users.user: (fields.E307) The field reviews.Cluster_users.user was declared with a lazy refere
nce to 'reviews.user', but app 'reviews' doesn't provide model 'user'.

Error in views.py - user_recommendation_list

@Vijeta141 please help.

TypeError at /reviews/recommendation/

'<' not supported between instances of 'method' and 'method'

then get a wine list including the previous IDs, order by rating

wine_list = sorted(list(Wine.objects.filter(id__in=other_users_reviews_wine_ids)),
    key=lambda x:x.average_rating,
    reverse=True

)

Vagueness and skipping of sections

In your section titled "Adding Web Views", you go from defining the views in reviews/views.py to talking about templates and giving sample code for the reviews_list view template. There is no mention of where this code goes and where this file exists. I can follow through what the code means, but have no idea where it lives or will leave. At this point, there is no templates folder nor file. It would be clearer if you gave more info as to where this code goes and where that file lives:

<h2>Latest reviews</h2>

{% if latest_review_list %}
<div>
    {% for review in latest_review_list %}
    <div>
        <h4><a href="{% url 'reviews:review_detail' review.id %}">
        {{ review.wine.name }}
        </a></h4>
        <h6>rated {{ review.rating }} of 5 by {{ review.user_name }}</h6>
        <p>{{ review.comment }}</p>
    </div>
    {% endfor %}
</div>
{% else %}
<p>No reviews are available.</p>
{% endif %} 

Because of this lack of clarity, the tutorial from here onwards just becomes confusing. And when I check out stage-0.3 I look around the files to see where it might exist, and I find it in some templates folder along with some 3 other templates which are never mentioned in the tutorial or how the come about. I know it might simplistic of me to ask this, but that's the part I gave up. Tried it a few times and still could not reproduce your work other than just copying and pasting, which is useless.

'NoneType' object has no attribute 'name'

Everything is working at stage, except i get an error on recommendation page.
Line causing the error :
user_cluster_name =
User.objects.get(username=request.user.username).cluster_set.first().name

'NoneType' object has no attribute 'name'

Request Method: GET
Request URL: http://192.168.99.100:8000/reviews/recommendation/
Django Version: 1.11
Exception Type: AttributeError
Exception Value:
'NoneType' object has no attribute 'name'
Exception Location: /code/reviews/views.py in user_recommendation_list, line 92
Python Executable: /opt/conda/bin/python
Python Version: 3.6.0

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.