ML and Data Science Foundations
Introduction to Data Science and ML
Data science extracts insight from data; machine learning (ML) is the part that learns patterns from data to make predictions or decisions without being explicitly programmed for each case.
Types of learning
| Type | Data | Goal | Examples |
|---|---|---|---|
| Supervised | Inputs with labels | Predict labels | Spam detection, house prices |
| Unsupervised | Inputs only | Find structure | Customer segments, anomaly detection |
| Reinforcement | Rewards from actions | Learn a policy | Game playing, robotics |
Supervised problems are regression (predict a number) or classification (predict a category).
The ML workflow
- Define the problem and success metric.
- Collect and clean data.
- Explore the data (EDA) and engineer features.
- Split into train, validation and test sets.
- Train and tune models.
- Evaluate on unseen data.
- Deploy and monitor (data drift, performance).
The Python toolkit
| Library | Purpose |
|---|---|
| NumPy | Fast numerical arrays |
| pandas | Tabular data |
| Matplotlib / seaborn | Visualisation |
| scikit-learn | Classic ML algorithms |
| PyTorch / TensorFlow | Deep learning |
| Jupyter | Interactive notebooks |
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42
)
model = KNeighborsClassifier(n_neighbors=3).fit(X_train, y_train)
print("accuracy:", model.score(X_test, y_test))
Key vocabulary
- Feature: an input variable. Label / target: what we predict.
- Overfitting: the model memorises training data and fails on new data.
- Underfitting: the model is too simple to capture the pattern.
- Bias-variance trade-off: simple models have high bias, complex models have high variance.
Finished reading?
Mark it complete to track your progress across the docs.
Questions and discussion
Stuck on something here, or found a clearer way to explain it? Start a thread.
- Ask a question or share what helped
- React to useful answers
- Sign in with GitHub to post
Comments are stored in GitHub Discussions and shown here by giscus. PrepVerse never sees your GitHub password.