Docsity

Summary Data Science, Exams of Data Structures and Algorithms

Toggle sidebar
bg1
Data Science — Comprehensive Summary
1. What Is Data Science?
Data science is the process of using data, statistics, programming, mathematics, and domain knowledge
to extract useful information, discover patterns, make predictions, and support decision-making.
Core idea
Raw data → Cleaning → Analysis → Modeling → Insights → Decision
Data science combines:
Statistics — understanding patterns and uncertainty
Programming — manipulating and analyzing data
Mathematics — algorithms and quantitative reasoning
Machine learning — learning patterns from data
Data visualization — communicating findings
Domain knowledge — understanding what the data means
2. Types of Data
Quantitative data
Numerical data that can be measured.
Examples:
Age
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download Summary Data Science and more Exams Data Structures and Algorithms in PDF only on Docsity!

Data Science — Comprehensive Summary

  1. What Is Data Science? Data science is the process of using data, statistics, programming, mathematics, and domain knowledge to extract useful information, discover patterns, make predictions, and support decision-making. Core idea Raw data → Cleaning → Analysis → Modeling → Insights → Decision Data science combines: Statistics — understanding patterns and uncertainty Programming — manipulating and analyzing data Mathematics — algorithms and quantitative reasoning Machine learning — learning patterns from data Data visualization — communicating findings Domain knowledge — understanding what the data means
  2. Types of Data Quantitative data Numerical data that can be measured. Examples: Age

Height Income Temperature Number of patients Qualitative/Categorical data Describes categories or characteristics. Examples: Gender/category Blood type Department Education level Product type Discrete data Countable values. Example: Number of employees = 25 Continuous data

Example: All university students in Kenya. Sample A subset selected from the population. Example: 500 students selected from Kenyan universities. Parameter A numerical characteristic of a population. Statistic A numerical characteristic calculated from a sample. Memory trick: Parameter = Population Statistic = Sample

  1. Data Science Workflow A typical data-science project follows: Step 1 — Define the problem Determine what question needs answering. Step 2 — Collect data Sources include: Surveys Databases Sensors Websites/APIs Experiments Transaction systems Step 3 — Clean data Identify: Missing values Duplicate records

Determine whether the model performs adequately. Step 7 — Communicate Translate results into understandable conclusions. Step 8 — Deploy and monitor Use the model in the real environment and monitor performance.

  1. Data Cleaning Common problems include: Missing data Example: Age Income 25 40, 31 — 28 55, Possible approaches:

Remove observations Replace with mean Replace with median Predict missing values Use a model-based method The appropriate method depends on why data are missing and the analysis objective.

  1. Outliers An outlier is an observation substantially different from the rest of the data. Example: 22, 24, 25, 26, 27, 150 The value 150 may be an outlier. Important An outlier is not automatically an error. It may represent: A measurement error

For an even number of observations, average the two middle values. Mode The most frequently occurring value. Example: 2, 3, 3, 4, 5 Mode = 3

  1. Mean vs Median The mean is sensitive to extreme values. Example: 10, 11, 12, 13, 100 The mean is pulled upward by 100. The median better represents the center when a distribution is strongly skewed. Exam rule

Skewed distribution → median often preferred as a measure of central tendency.

  1. Range $$ Range=Maximum-Minimum $$ Example: 5, 10, 15, 20 $$ Range=20-5=15 $$
  2. Variance Variance measures how spread out observations are around the mean. Population variance: $$ \sigma^2=\frac{\sum(x-\mu)^2}{N} $$ Sample variance: $$ s^2=\frac{\sum(x-\bar{x})^2}{n-1} $$
  3. Standard Deviation Standard deviation is the square root of variance.
  1. Conditional Probability Probability of A given B: $$ P(A|B)=\frac{P(A\cap B)}{P(B)} $$ The phrase "given that" usually signals conditional probability.
  2. Correlation Correlation measures the strength and direction of a linear relationship between two variables. The correlation coefficient (r) ranges from: $$ - 1 \leq r\leq1 $$ Interpretation r Interpretation +1 Perfect positive relationship 0 No linear relationship − 1 Perfect negative relationship Important Correlation does not prove causation.

If ice-cream sales and drowning incidents increase together, that does not mean ice cream causes drowning. A third variable, such as temperature, may influence both.

  1. Regression Regression estimates relationships between variables. Simple linear regression $$ Y=\beta_0+\beta_1X+\epsilon $$ Where: (Y) = dependent/outcome variable (X) = predictor (\beta_0) = intercept (\beta_1) = slope (\epsilon) = error Interpretation of slope If: $$ \beta_1=3 $$ then a one-unit increase in (X) is associated with an estimated 3-unit increase in Y, holding other modeled factors constant.
  1. Supervised Learning The model learns from data containing known outcomes/labels. Examples: Linear regression Logistic regression Decision trees Random forests Neural networks for labeled prediction Example: Input: patient characteristics Target: readmission yes/no
  2. Unsupervised Learning The data do not have predefined target labels. Common applications: Clustering Dimensionality reduction

Pattern discovery Example: A retailer groups customers into five purchasing-behavior clusters without specifying the groups beforehand.

  1. Clustering Clustering groups observations based on similarity. A common algorithm is K-means. The algorithm attempts to assign observations to (K) clusters so observations within clusters are relatively similar.
  2. Training, Validation & Test Data A dataset can be divided into: Training set Used to fit the model. Validation set

More training data Early stopping for applicable algorithms

  1. Underfitting Underfitting occurs when the model is too simple to capture important patterns. Typical pattern: Poor training performance + poor test performance.
  2. Bias and Variance High bias Model is overly simplistic. Often associated with underfitting. High variance Model is highly sensitive to training data. Often associated with overfitting. Memory

High bias → too simple High variance → too sensitive

  1. Cross-Validation Cross-validation repeatedly divides data into training and validation portions to estimate model performance. K-fold cross-validation The data are divided into (K) folds. The model trains on (K- 1 ) folds and validates on the remaining fold. This process repeats until every fold has served as validation data.
  2. Classification Metrics For binary classification: Actual Positive Actual Negative Predicted Positive TP FP Predicted Negative FN TN Accuracy $$ Accuracy=\frac{TP+TN}{TP+TN+FP+FN} $$ Precision