Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Events
Videos
Audiobooks
Packt Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
The Unsupervised Learning Workshop

You're reading from   The Unsupervised Learning Workshop Get started with unsupervised learning algorithms and simplify your unorganized data to help make future predictions

Arrow left icon
Product type Paperback
Published in Jul 2020
Publisher Packt
ISBN-13 9781800200708
Length 550 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (10):
Arrow left icon
Aaron Jones Aaron Jones
Author Profile Icon Aaron Jones
Aaron Jones
Christopher Kruger Christopher Kruger
Author Profile Icon Christopher Kruger
Christopher Kruger
Benjamin Johnston Benjamin Johnston
Author Profile Icon Benjamin Johnston
Benjamin Johnston
Richard Brooker Richard Brooker
Author Profile Icon Richard Brooker
Richard Brooker
John Wesley Doyle John Wesley Doyle
Author Profile Icon John Wesley Doyle
John Wesley Doyle
Priyanjit Ghosh Priyanjit Ghosh
Author Profile Icon Priyanjit Ghosh
Priyanjit Ghosh
Sani Kamal Sani Kamal
Author Profile Icon Sani Kamal
Sani Kamal
Ashish Pratik Patil Ashish Pratik Patil
Author Profile Icon Ashish Pratik Patil
Ashish Pratik Patil
Philip Solomon Philip Solomon
Author Profile Icon Philip Solomon
Philip Solomon
Geetank Raipuria Geetank Raipuria
Author Profile Icon Geetank Raipuria
Geetank Raipuria
+6 more Show less
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface
1. Introduction to Clustering 2. Hierarchical Clustering FREE CHAPTER 3. Neighborhood Approaches and DBSCAN 4. Dimensionality Reduction Techniques and PCA 5. Autoencoders 6. t-Distributed Stochastic Neighbor Embedding 7. Topic Modeling 8. Market Basket Analysis 9. Hotspot Analysis Appendix

7. Topic Modeling

Activity 7.01: Loading and Cleaning Twitter Data

Solution:

  1. Import the necessary libraries:
    import warnings
    warnings.filterwarnings('ignore')
    import langdetect 
    import matplotlib.pyplot 
    import nltk
    nltk.download('wordnet')
    nltk.download('stopwords')
    import numpy 
    import pandas 
    import pyLDAvis 
    import pyLDAvis.sklearn 
    import regex 
    import sklearn 
  2. Load the LA Times health Twitter data (latimeshealth.txt) from https://packt.live/2Xje5xF.

    Note

    Pay close attention to the delimiter (it is neither a comma nor a tab) and double-check the header status.

    The code looks as follows:

    path = 'latimeshealth.txt' 
    df = pandas.read_csv(path, sep="|", header=None)
    df.columns = ["id", "datetime", "tweettext"]
  3. Run a quick exploratory analysis to ascertain the data size and structure:
    def dataframe_quick_look(df, nrows):
        print("SHAPE:\n{shape}\n".format(shape...
lock icon The rest of the chapter is locked
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
The Unsupervised Learning Workshop
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 $19.99/month. Cancel anytime
Modal Close icon
Modal Close icon