Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Interactive Dashboards and Data Apps with Plotly and Dash

You're reading from  Interactive Dashboards and Data Apps with Plotly and Dash

Product type Book
Published in May 2021
Publisher Packt
ISBN-13 9781800568914
Pages 364 pages
Edition 1st Edition
Languages
Author (1):
Elias Dabbas Elias Dabbas
Profile icon Elias Dabbas
Toc

Table of Contents (18) Chapters close

Preface 1. Section 1: Building a Dash App
2. Chapter 1: Overview of the Dash Ecosystem 3. Chapter 2: Exploring the Structure of a Dash App 4. Chapter 3: Working with Plotly's Figure Objects 5. Chapter 4: Data Manipulation and Preparation, Paving the Way to Plotly Express 6. Section 2: Adding Functionality to Your App with Real Data
7. Chapter 5: Interactively Comparing Values with Bar Charts and Dropdown Menus 8. Chapter 6: Exploring Variables with Scatter Plots and Filtering Subsets with Sliders 9. Chapter 7: Exploring Map Plots and Enriching Your Dashboards with Markdown 10. Chapter 8: Calculating the Frequency of Your Data with Histograms and Building Interactive Tables 11. Section 3: Taking Your App to the Next Level
12. Chapter 9: Letting Your Data Speak for Itself with Machine Learning 13. Chapter 10: Turbo-charge Your Apps with Advanced Callbacks 14. Chapter 11: URLs and Multi-Page Apps 15. Chapter 12: Deploying Your App 16. Chapter 13: Next Steps 17. Other Books You May Enjoy

Understanding clustering

So, what exactly is clustering and when might it be helpful? Let's start with a very simple example. Imagine you have a group of people for whom we want to make T-shirts. We can make a T-shirt for each one of them, in whatever size required. The main restriction is that we can only make one size. The sizes are as follows: [1, 2, 3, 4, 5, 7, 9, 11]. Think how you might tackle this problem. We will use the KMeans algorithm for that, so let's start right away, as follows:

  1. Import the required packages and models. NumPy will be imported as a package, but from sklearn we will import the only model that we will be using for now, as illustrated in the following code snippet:
    import numpy as np
    from sklearn.cluster import KMeans
  2. Create a dataset of sizes in the required format. Note that each observation (person's size) should be represented as a list, so we use the reshape method of NumPy arrays to get the data in the required format, as follows...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime