Data Science

Guide to AI and Data Courses · Part IV: Data
Question and dataData wranglingExploratory analysisVisualizationInference and storyNeighboring courses
Sercan KÜLCÜ · Giresun University · Computer Engineering

Introduction

What Question Does It Ask?

How do we ask the right questions of data and turn the answers into decisions?

Data science is the process that starts with a question and covers finding, cleaning and analyzing data, then communicating the result so that it leads to a decision. It combines statistics, programming and domain knowledge; data mining and machine learning are its tools.

At a glance

Approach

question, data, analysis, story

Input

raw, messy data

Output

report, visualization, model

Success measure

impact on decisions, accuracy

Math load

medium: statistics

Data needs

moderate to large

Introduction

A Short History

1962

In "The Future of Data Analysis", Tukey argues for data analysis as a science separate from statistics.

1977

Tukey publishes "Exploratory Data Analysis": look first, then model.

2001

Cleveland proposes "data science" as an academic field that extends statistics.

2010

Kaggle is founded; data science competitions and open datasets spread.

2012

Harvard Business Review calls data scientist "the sexiest job of the 21st century".

2014

Project Jupyter splits from IPython; code, plots and text meet in one notebook.

The Course

Core Concepts

Defining the question

What do we want to know, and what decision will follow?

Tidy data

Each row an observation, each column a variable.

Data cleaning

Fixing missing, wrong and inconsistent records.

Exploratory analysis

Getting to know data with summaries and plots.

Visualization

Showing the pattern and result with the right chart.

Hypothesis testing

Checking whether a difference is due to chance.

A/B testing

Comparing two options with a randomized experiment.

Reproducibility

Getting the same result again with code, data and versions.

The Course

A Typical Workflow

Askdecision andmetricGet dataSQL, files,APICleanmissing, wrong,inconsistentExplore andmodelplots, tests,regressionCommunicatereport,dashboard
Example: A city council asks, "Should we add more bus trips?" Card tap records are collected, bad timestamps removed, occupancy by line and hour explored with plots, demand estimated with regression, and the result presented to the decision maker in a one-page report.

The Course

What Does the Course Cover?

  1. The data science process and asking good questions
  2. Reading data in Python or R; tidy data
  3. Data cleaning: missing values and outliers
  4. Exploratory data analysis
  5. Principles of visualization
  6. Sampling and descriptive statistics
  7. Confidence intervals and hypothesis tests
  8. A/B testing and experimental design
  9. Regression and predictive models
  10. Correlation, causation, confounders
  11. Getting data from a database: SQL
  12. Reproducible reports and telling the story

Skills you will gain

pandas or the tidyverseSQLMatplotlib and seaborninterpreting hypothesis and A/B testsreproducible reports in Jupyter

A typical semester; the order and coverage vary between universities.

Try It

What Drives Grades?

The school asks: “Which habit should we advise students on?” We have survey and grade data for 26 students. Pick variables to see the relationship; click a point to drop it from the analysis.

Data science starts with a question and ends in a decision: exploratory analysis, cleaning, measuring relationships and communicating the result. Correlation is not causation: students who study more also attend more; separate the two before giving advice.

Context

Prerequisites

Courses worth knowing before this one, and why they are needed.

CourseWhy it is needed
Probability and Statisticshypothesis testing, regression, visualization
Programmingreading files, loops and functions in Python or R
Databases and SQLquerying, joining and grouping data

Context

Are You Ready for This Course?

Ask yourself; for every "no", the right-hand column shows where to start.

Ask yourselfIf not, start with
Can you explain the mean, median, standard deviation and the normal distribution?Probability and Statistics
Can you read a table in Python or R and group it by a column?An intro programming course, then a short pandas or dplyr tutorial
Can you write a simple SQL query with SELECT, WHERE and GROUP BY?The SQL part of a database course, or online SQL exercises
Can you tell when a chart is misleading?Not required, the course teaches it; if curious, Tufte's book
If you can say "yes" to most of these, you are ready; one or two gaps can be closed during the semester.

Context

Neighbouring Courses

subfieldbuilds onshares methodsapplication

Overlap

Overlapping Courses

RelationCourseShared ground
builds onThis course builds on Probability and Statisticshypothesis testing, regression, visualization
shares methodsShares methods with Machine Learningpredictive models
shares methodsShares methods with Explainable AI and AI Ethicsdata bias, fairness metrics
shares methodsShares methods with Data Miningexploratory data analysis
shares methodsShares methods with Machine Learning Systems and MLOpsexperiment tracking, data versioning

Differences

Where It Differs (1/2)

CriterionData ScienceData MiningMachine Learning
Core questionHow do we ask the right questions of data and turn the answers into decisions?How are hidden, useful patterns found in large piles of data?How does a program generalize from examples?
Approachquestion, data, analysis, storydiscovery-driven analysisstatistical learning
Inputraw, messy datalarge tables or transaction datalabeled or unlabeled examples
Outputreport, visualization, modelrules, clusters, outliersa model that makes predictions
Success measureimpact on decisions, accuracyinterestingness, support, confidenceerror on unseen data
Math loadmedium: statisticsmediumhigh: linear algebra, probability, optimization
Data needsmoderate to largelargemoderate to large
  • Data Mining: Data mining focuses on finding patterns in large data; data science covers the whole path from question to decision.
  • Machine Learning: ML builds models that predict well on new examples; data science uses a model as one tool for answering a question.

Differences

Where It Differs (2/2)

CriterionData ScienceProbability & StatisticsBig Data
Core questionHow do we ask the right questions of data and turn the answers into decisions?How is uncertainty measured, and how do we draw reliable conclusions from limited data?How is data that does not fit on one machine stored and processed?
Approachquestion, data, analysis, storyprobability models and inferencedistributed storage and computation
Inputraw, messy datasample datahuge, fast-flowing data
Outputreport, visualization, modelestimate, confidence interval, test resultprocessed data, query results
Success measureimpact on decisions, accuracyunbiasedness, power, significancescalability, latency, cost
Math loadmedium: statisticsthe theory itselflow
Data needsmoderate to largea samplevery large
  • Probability & Statistics: Statistics provides the theory of inference; data science combines it with programming, messy real data and storytelling.
  • Big Data: Big data systems store and process the data; data science draws meaning and decisions from it.

Practice

Applications

A/B testing

Is the new design really better?

Marketing analytics

Which campaign brings customers?

Public health

Tracking outbreaks and disease trends.

Sports analytics

Measuring player and team performance.

Public policy

Evaluating services with open data.

Product metrics

What keeps users, and what drives them away?

Practice

Risks and Ethics

Confusing correlation with causation

Reading causes into correlations leads to wrong decisions: ice cream sales and drownings rise together because both happen in summer.

p-hacking

Run enough tests and something will come out "significant"; the hypothesis must be fixed before looking at the data.

Re-identification

In data with names removed, ZIP code, birth date and sex are enough to re-identify most people.

Misleading charts

A truncated axis or a cherry-picked time window can tell the opposite story with the same data.

In depth: Explainable AI and AI Ethics.

Practice

Tools and Datasets

Tools and libraries

PythonpandasJupyterR and tidyverseMatplotlib and seabornSQLstatsmodels

Well-known datasets

Titanic (Kaggle)GapminderNYC taxi tripsPalmer PenguinsHouse Prices (Kaggle)Anscombe's quartet

Practice

Common Misconceptions

Common beliefIn fact
Data science is training models.Most of the time goes into sharpening the question, finding and cleaning data, and communicating results.
Data speaks for itself.Without a question, context and domain knowledge, the same data can lead to wrong conclusions.
A significant p-value is an important result.Statistical significance says nothing about effect size; many tests produce misleading results.
A chart is decoration for the result.Anscombe's quartet shows it: data with identical summaries look completely different when plotted.

Next Steps

After This Course

Courses that build on or extend this one

This course is mostly an end point: it builds on the others.

Related careers

Data scientistData analystProduct analystBusiness intelligence specialistResearch analyst
Data science is the umbrella of the data courses. From here you can move to machine learning to deepen predictive modeling, to data mining for discovery, to big data systems for scale, or to explainable AI and ethics for questions of fairness and bias.

Next Steps

Further Reading

  • Wickham, Çetinkaya-Rundel and Grolemund, R for Data Science, 2nd ed., O'Reilly, 2023.
  • McKinney, Python for Data Analysis, 3rd ed., O'Reilly, 2022.
  • James, Witten, Hastie and Tibshirani, An Introduction to Statistical Learning, 2nd ed., Springer, 2021.
  • Tukey, Exploratory Data Analysis, Addison-Wesley, 1977.

The End

Chapter 26: Data Science
← Previous chapter · Map of the field · Next chapter →
1 / 1 Sercan KÜLCÜ. All rights reserved.