# Topic 26: AI and Machine Learning Foundations

**Fictional Northstar case · self-paced · 45–90 minutes plus optional setup**

## Opening question
What does a confident model prediction actually establish?

## Explain
Machine learning fits patterns from data; inference applies a trained model. Different tasks need different evaluation: classification, numerical prediction and generation cannot share one simplistic accuracy claim. Training data and evaluation data should be separated to reduce misleading results. A model output is evidence about its behavior under tested conditions, not a guarantee about an individual or future setting.

## Supporting technologies
- **Training and inference:** Learning parameters versus using them.
- **Features and labels:** Inputs and target outcomes require careful definitions.
- **Evaluation:** Test on separate suitable examples and inspect error types.
- **Generalization:** Performance can change with populations and conditions.

## Scenario
Northstar evaluates a fictional classifier for routing synthetic support messages. Missing an urgent request has a different consequence than over-escalating a routine one.

```text
actual,predicted,count
urgent,urgent,8
urgent,routine,2
routine,urgent,3
routine,routine,17
```

## Hands-on procedure
1. Build a confusion matrix and label false negatives and false positives.
2. Calculate accuracy, urgent recall and urgent precision.
3. Explain why one metric cannot express all business consequences.
4. Describe how data leakage could inflate the result if evaluation examples appeared in training.
5. Propose a human review path for uncertain or high-impact cases.
6. Write an evaluation card stating data size, synthetic origin, metrics, limitations and deployment restrictions.

## Expected reasoning and limits
Accuracy is 25/30, about 83.3%; urgent recall is 8/10=80%; urgent precision is 8/11, about 72.7%. The two missed urgent cases need contextual review. No model has been trained by the paper exercise.

## Best practices
- Separate training and evaluation examples.
- Choose metrics linked to error consequences.
- Document data origin and limitations.
- Retain human oversight for consequential decisions.

## Vendors, projects and learning
- [Google](https://developers.google.com/machine-learning/crash-course): Machine Learning Crash Course
- [Microsoft](https://learn.microsoft.com/en-us/training/browse/?terms=artificial%20intelligence): AI learning documentation
- [scikit-learn](https://scikit-learn.org/stable/): Open-source model evaluation tools

## Optional technical extension
Implement the matrix calculations with plain Python before using any library. If training a small classifier, retain a distinct evaluation split and document synthetic-data limits.

## Career practice
Relevant role families to investigate: AI support analyst, Junior data analyst, ML operations trainee. No current vacancy or hiring requirement is asserted.

Interview: Why can a high accuracy score hide unacceptable mistakes?

## Sources
- [Scikit-learn model evaluation](https://scikit-learn.org/stable/modules/model_evaluation.html)

## Portfolio evidence
Use the [portfolio guide](../guides/portfolio.md). Submit original input, decisions, tests, actual results, limitations and source attribution. Clearly label modeled, planned and performed work.

## Suggested prerequisites
Topic 25
