You are previewing Bad Data Handbook.

Bad Data Handbook

Cover of Bad Data Handbook by Q. Ethan McCallum Published by O'Reilly Media, Inc.
  1. Bad Data Handbook
  2. About the Authors
  3. Preface
    1. Conventions Used in This Book
    2. Using Code Examples
    3. Safari® Books Online
    4. How to Contact Us
    5. Acknowledgments
  4. 1. Setting the Pace: What Is Bad Data?
  5. 2. Is It Just Me, or Does This Data Smell Funny?
    1. Understand the Data Structure
    2. Field Validation
    3. Value Validation
    4. Physical Interpretation of Simple Statistics
    5. Visualization
    6. Keyword PPC Example
    7. Search Referral Example
    8. Recommendation Analysis
    9. Time Series Data
    10. Conclusion
  6. 3. Data Intended for Human Consumption, Not Machine Consumption
    1. The Data
    2. The Problem: Data Formatted for Human Consumption
      1. The Arrangement of Data
      2. Data Spread Across Multiple Files
    3. The Solution: Writing Code
      1. Reading Data from an Awkward Format
      2. Reading Data Spread Across Several Files
    4. Postscript
    5. Other Formats
    6. Summary
  7. 4. Bad Data Lurking in Plain Text
    1. Which Plain Text Encoding?
    2. Guessing Text Encoding
    3. Normalizing Text
    4. Problem: Application-Specific Characters Leaking into Plain Text
    5. Text Processing with Python
    6. Exercises
  8. 5. (Re)Organizing the Web’s Data
    1. Can You Get That?
    2. General Workflow Example
      1. robots.txt
      2. Identifying the Data Organization Pattern
      3. Store Offline Version for Parsing
      4. Scrape the Information Off the Page
    3. The Real Difficulties
      1. Download the Raw Content If Possible
      2. Forms, Dialog Boxes, and New Windows
      3. Flash
    4. The Dark Side
    5. Conclusion
  9. 6. Detecting Liars and the Confused in Contradictory Online Reviews
    1. Weotta
    2. Getting Reviews
    3. Sentiment Classification
    4. Polarized Language
    5. Corpus Creation
    6. Training a Classifier
    7. Validating the Classifier
    8. Designing with Data
    9. Lessons Learned
    10. Summary
    11. Resources
  10. 7. Will the Bad Data Please Stand Up?
    1. Example 1: Defect Reduction in Manufacturing
    2. Example 2: Who’s Calling?
    3. Example 3: When “Typical” Does Not Mean “Average”
    4. Lessons Learned
    5. Will This Be on the Test?
  11. 8. Blood, Sweat, and Urine
    1. A Very Nerdy Body Swap Comedy
    2. How Chemists Make Up Numbers
    3. All Your Database Are Belong to Us
    4. Check, Please
    5. Live Fast, Die Young, and Leave a Good-Looking Corpse Code Repository
    6. Rehab for Chemists (and Other Spreadsheet Abusers)
    7. tl;dr
  12. 9. When Data and Reality Don’t Match
    1. Whose Ticker Is It Anyway?
    2. Splits, Dividends, and Rescaling
    3. Bad Reality
    4. Conclusion
  13. 10. Subtle Sources of Bias and Error
    1. Imputation Bias: General Issues
    2. Reporting Errors: General Issues
    3. Other Sources of Bias
      1. Topcoding/Bottomcoding
      2. Seam Bias
      3. Proxy Reporting
      4. Sample Selection
    4. Conclusions
    5. References 
  14. 11. Don’t Let the Perfect Be the Enemy of the Good: Is Bad Data Really Bad?
    1. But First, Let’s Reflect on Graduate School …
    2. Moving On to the Professional World
    3. Moving into Government Work
    4. Government Data Is Very Real
    5. Service Call Data as an Applied Example
    6. Moving Forward
    7. Lessons Learned and Looking Ahead
  15. 12. When Databases Attack: A Guide for When to Stick to Files
    1. History
      1. Building My Toolset
      2. The Roadblock: My Datastore
    2. Consider Files as Your Datastore
      1. Files Are Simple!
      2. Files Work with Everything
      3. Files Can Contain Any Data Type
      4. Data Corruption Is Local
      5. They Have Great Tooling
      6. There’s No Install Tax
    3. File Concepts
      1. Encoding
      2. Text Files
      3. Binary Data
      4. Memory-Mapped Files
      5. File Formats
      6. Delimiters
    4. A Web Framework Backed by Files
      1. Motivation
      2. Implementation
    5. Reflections
  16. 13. Crouching Table, Hidden Network
    1. A Relational Cost Allocations Model
    2. The Delicate Sound of a Combinatorial Explosion…
    3. The Hidden Network Emerges
    4. Storing the Graph
    5. Navigating the Graph with Gremlin
    6. Finding Value in Network Properties
    7. Think in Terms of Multiple Data Models and Use the Right Tool for the Job
    8. Acknowledgments
  17. 14. Myths of Cloud Computing
    1. Introduction to the Cloud
    2. What Is “The Cloud”?
    3. The Cloud and Big Data
    4. Introducing Fred
    5. At First Everything Is Great
    6. They Put 100% of Their Infrastructure in the Cloud
    7. As Things Grow, They Scale Easily at First
    8. Then Things Start Having Trouble
    9. They Need to Improve Performance
    10. Higher IO Becomes Critical
    11. A Major Regional Outage Causes Massive Downtime
    12. Higher IO Comes with a Cost
    13. Data Sizes Increase
    14. Geo Redundancy Becomes a Priority
    15. Horizontal Scale Isn’t as Easy as They Hoped
    16. Costs Increase Dramatically
    17. Fred’s Follies
    18. Myth 1: Cloud Is a Great Solution for All Infrastructure Components
      1. How This Myth Relates to Fred’s Story
    19. Myth 2: Cloud Will Save Us Money
      1. How This Myth Relates to Fred’s Story
    20. Myth 3: Cloud IO Performance Can Be Improved to Acceptable Levels Through Software RAID
      1. How This Myth Relates to Fred’s Story
    21. Myth 4: Cloud Computing Makes Horizontal Scaling Easy
      1. How This Myth Relates to Fred’s Story
    22. Conclusion and Recommendations
  18. 15. The Dark Side of Data Science
    1. Avoid These Pitfalls
    2. Know Nothing About Thy Data
      1. Be Inconsistent in Cleaning and Organizing the Data
      2. Assume Data Is Correct and Complete
      3. Spillover of Time-Bound Data
    3. Thou Shalt Provide Your Data Scientists with a Single Tool for All Tasks
      1. Using a Production Environment for Ad-Hoc Analysis
      2. The Ideal Data Science Environment
    4. Thou Shalt Analyze for Analysis’ Sake Only
    5. Thou Shalt Compartmentalize Learnings
    6. Thou Shalt Expect Omnipotence from Data Scientists
      1. Where Do Data Scientists Live Within the Organization?
    7. Final Thoughts
  19. 16. How to Feed and Care for Your Machine-Learning Experts
    1. Define the Problem
    2. Fake It Before You Make It
    3. Create a Training Set
    4. Pick the Features
    5. Encode the Data
    6. Split Into Training, Test, and Solution Sets
    7. Describe the Problem
    8. Respond to Questions
    9. Integrate the Solutions
    10. Conclusion
  20. 17. Data Traceability
    1. Why?
    2. Personal Experience
      1. Snapshotting
      2. Saving the Source
      3. Weighting Sources
      4. Backing Out Data
      5. Separating Phases (and Keeping them Pure)
      6. Identifying the Root Cause
      7. Finding Areas for Improvement
    3. Immutability: Borrowing an Idea from Functional Programming
    4. An Example
      1. Crawlers
      2. Change
      3. Clustering
      4. Popularity
    5. Conclusion
  21. 18. Social Media: Erasable Ink?
    1. Social Media: Whose Data Is This Anyway?
    2. Control
    3. Commercial Resyndication
    4. Expectations Around Communication and Expression
    5. Technical Implications of New End User Expectations
    6. What Does the Industry Do?
      1. Validation API
      2. Update Notification API
    7. What Should End Users Do?
    8. How Do We Work Together?
  22. 19. Data Quality Analysis Demystified: Knowing When Your Data Is Good Enough
    1. Framework Introduction: The Four Cs of Data Quality Analysis
    2. Complete
    3. Coherent
    4. Correct
    5. aCcountable
    6. Conclusion
  23. Index
  24. About the Author
  25. Colophon
  26. Copyright

Chapter 6. Detecting Liars and the Confused in Contradictory Online Reviews

Jacob Perkins

Did you know that people lie for their own selfish reasons? Even if this is totally obvious to you, you may be surprised at how blatant this practice has become online, to the point where some people will explain their reasons for lying immediately after doing so.

I knew unethical people would lie in online reviews in order to inflate ratings or attack competitors, but what I didn’t know, and only learned by accident, is that individuals will sometimes write reviews that completely contradict their associated rating, without any regard to how it affects a business’s online reputation. And often this is for businesses that an individual likes.

How did I learn this? By using ratings and reviews to create a sentiment corpus, I trained a sentiment analysis classifier that could reliably determine the sentiment of a review. While evaluating this classifier, I discovered that it could also detect discrepancies between the review sentiment and the corresponding rating, thereby finding liars and confused reviewers. Here’s the whole story of how I used text classification to identify an unexpected source of bad data...


At my company, Weotta,[8] we produce applications and APIs for navigating local data in ways that people actually care about, so we can answer questions like: Is there a kid-friendly restaurant nearby? What’s the nearest hip yoga studio? What concerts are happening this weekend?

To do ...

The best content for your career. Discover unlimited learning on demand for around $1/day.