O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Machine Learning for the Web

Book Description

Explore the web and make smarter predictions using Python

About This Book

  • Targets two big and prominent markets where sophisticated web apps are of need and importance.

  • Practical examples of building machine learning web application, which are easy to follow and replicate.

  • A comprehensive tutorial on Python libraries and frameworks to get you up and started.

  • Who This Book Is For

    The book is aimed at upcoming and new data scientists who have little experience with machine learning or users who are interested in and are working on developing smart (predictive) web applications. Knowledge of Django would be beneficial. The reader is expected to have a background in Python programming and good knowledge of statistics.

    What You Will Learn

  • Get familiar with the fundamental concepts and some of the jargons used in the machine learning community

  • Use tools and techniques to mine data from websites

  • Grasp the core concepts of Django framework

  • Get to know the most useful clustering and classification techniques and implement them in Python

  • Acquire all the necessary knowledge to build a web application with Django

  • Successfully build and deploy a movie recommendation system application using the Django framework in Python

  • In Detail

    Python is a general purpose and also a comparatively easy to learn programming language. Hence it is the language of choice for data scientists to prototype, visualize, and run data analyses on small and medium-sized data sets. This is a unique book that helps bridge the gap between machine learning and web development. It focuses on the difficulties of implementing predictive analytics in web applications. We focus on the Python language, frameworks, tools, and libraries, showing you how to build a machine learning system. You will explore the core machine learning concepts and then develop and deploy the data into a web application using the Django framework. You will also learn to carry out web, document, and server mining tasks, and build recommendation engines. Later, you will explore Python’s impressive Django framework and will find out how to build a modern simple web app with machine learning features.

    Style and approach

    Instead of being overwhelmed with multiple concepts at once, this book provides a step-by-step approach that will guide you through one topic at a time.

    An intuitive step-by step guide that will focus on one key topic at a time. Building upon the acquired knowledge in each chapter, we will connect the fundamental theory and practical tips by illustrative visualizations and hands-on code examples.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. Machine Learning for the Web
      1. Table of Contents
      2. Machine Learning for the Web
      3. Credits
      4. Foreword
      5. About the Author
      6. About the Reviewers
      7. www.PacktPub.com
        1. eBooks, discount offers, and more
          1. Why subscribe?
      8. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      9. 1. Introduction to Practical Machine Learning Using Python
        1. General machine-learning concepts
          1. Machine-learning example
            1. Installing and importing a module (library)
        2. Preparing, manipulating and visualizing data – NumPy, pandas and matplotlib tutorials
          1. Using NumPy
            1. Arrays creation
            2. Array manipulations
            3. Array operations
            4. Linear algebra operations
            5. Statistics and mathematical functions
          2. Understanding the pandas module
            1. Exploring data
            2. Manipulate data
          3. Matplotlib tutorial
        3. Scientific libraries used in the book
        4. When to use machine learning
        5. Summary
      10. 2. Unsupervised Machine Learning
        1. Clustering algorithms
          1. Distribution methods
            1. Expectation maximization
            2. Mixture of Gaussians
          2. Centroid methods
            1. k-means
          3. Density methods
            1. Mean – shift
          4. Hierarchical methods
            1. Training and comparison of the clustering methods
        2. Dimensionality reduction
          1. Principal Component Analysis (PCA)
            1. PCA example
        3. Singular value decomposition
        4. Summary
      11. 3. Supervised Machine Learning
        1. Model error estimation
        2. Generalized linear models
          1. Linear regression
          2. Ridge regression
          3. Lasso regression
          4. Logistic regression
          5. Probabilistic interpretation of generalized linear models
          6. k-nearest neighbours (KNN)
        3. Naive Bayes
          1. Multinomial Naive Bayes
          2. Gaussian Naive Bayes
        4. Decision trees
        5. Support vector machine
          1. Kernel trick
        6. A comparison of methods
          1. Regression problem
          2. Classification problem
        7. Hidden Markov model
          1. A Python example
        8. Summary
      12. 4. Web Mining Techniques
        1. Web structure mining
          1. Web crawlers (or spiders)
          2. Indexer
          3. Ranking – PageRank algorithm
        2. Web content mining
          1. Parsing
        3. Natural language processing
          1. Information retrieval models
            1. TF-IDF
            2. Latent Semantic Analysis (LSA)
            3. Doc2Vec (word2vec)
            4. Word2vec – continuous bag of words and skip-gram architectures
            5. Mathematical description of the CBOW model
            6. Doc2Vec extension
            7. Movie review query example
        4. Postprocessing information
          1. Latent Dirichlet allocation
            1. Model
            2. Example
          2. Opinion mining (sentiment analysis)
        5. Summary
      13. 5. Recommendation Systems
        1. Utility matrix
        2. Similarities measures
        3. Collaborative Filtering methods
          1. Memory-based Collaborative Filtering
            1. User-based Collaborative Filtering
            2. Item-based Collaborative Filtering
            3. Simplest item-based Collaborative Filtering – slope one
          2. Model-based Collaborative Filtering
            1. Alternative least square (ALS)
            2. Stochastic gradient descent (SGD)
            3. Non-negative matrix factorization (NMF)
            4. Singular value decomposition (SVD)
        4. CBF methods
          1. Item features average method
          2. Regularized linear regression method
        5. Association rules for learning recommendation system
        6. Log-likelihood ratios recommendation system method
        7. Hybrid recommendation systems
        8. Evaluation of the recommendation systems
          1. Root mean square error (RMSE) evaluation
          2. Classification metrics
        9. Summary
      14. 6. Getting Started with Django
        1. HTTP – the basics of the GET and POST methods
          1. Installation and server creation
          2. Settings
        2. Writing an app – most important features
          1. Models
          2. URL and views behind HTML web pages
            1. HTML pages
          3. URL declarations and views
        3. Admin
          1. Shell interface
          2. Commands
          3. RESTful application programming interfaces (APIs)
        4. Summary
      15. 7. Movie Recommendation System Web Application
        1. Application setup
        2. Models
        3. Commands
        4. User sign up login/logout implementation
        5. Information retrieval system (movies query)
        6. Rating system
        7. Recommendation systems
        8. Admin interface and API
        9. Summary
      16. 8. Sentiment Analyser Application for Movie Reviews
        1. Application usage overview
        2. Search engine choice and the application code
        3. Scrapy setup and the application code
          1. Scrapy settings
          2. Scraper
          3. Pipelines
          4. Crawler
        4. Django models
        5. Integrating Django with Scrapy
          1. Commands (sentiment analysis model and delete queries)
          2. Sentiment analysis model loader
          3. Deleting an already performed query
          4. Sentiment reviews analyser – Django views and HTML
        6. PageRank: Django view and the algorithm code
        7. Admin and API
        8. Summary
      17. Index