PCEI-30-01 Cheat Sheet

Cheat sheet: AI, ML, Python, data, and model evaluation reference for Python Institute PCEI-30-01 candidates.

Use the tables for a quick pre-exam check. Expand a topic’s notes for explanations, examples, and additional distinctions.

Scope and study context
ItemReference
Vendor/providerPython Institute
Official exam titlePython Institute PCEI - Certified Entry-Level AI Specialist with Python (PCEI-30-01)
Exam codePCEI-30-01
Page purposeIndependent quick review for AI concepts, Python patterns, data workflows, model selection, and evaluation basics
Best useReview terms, choose algorithms from scenarios, read short Python snippets, and identify common AI/ML mistakes

Focus on practical distinctions: classification vs regression, training vs inference, parameter vs hyperparameter, feature vs label, accuracy vs precision/recall, and model performance vs responsible AI risk.

For the PCEI-30-01 exam, use original practice questions to test recognition and reasoning, not memorization alone.

A strong practice sequence is:

  1. Start with short topic drills on AI terminology, Python basics, data handling, and evaluation metrics.
  2. Review detailed explanations for every missed or guessed question.
  3. Create a mistake log grouped by topic: Python, data, workflow, models, metrics, ethics.
  4. Re-drill weak areas until you can explain why each wrong option is wrong.
  5. Move to mixed question bank sessions to practice switching topics.
  6. Finish with mock exams under timed conditions.
  7. Use the final review to target only the areas still causing errors.

Practice is most useful when explanations force you to compare close choices: classification vs regression, precision vs recall, validation vs test, overfitting vs underfitting, and AI vs ML vs deep learning.

AI and machine learning concept map

TermCompact meaningExam-use distinction
Artificial intelligence, AISystems that perform tasks associated with human intelligenceBroad umbrella: may include rules, search, ML, robotics, NLP, vision
Machine learning, MLModels learn patterns from data instead of being explicitly programmed for every ruleML is a subset of AI
Deep learning, DLML using multi-layer neural networksStrong for images, speech, text, and large unstructured data
Data scienceExtracting insights from data using statistics, programming, and domain knowledgeMay include analytics without predictive AI
ModelLearned or designed function that maps inputs to outputsTrained model is used for inference
TrainingProcess of fitting model parameters using dataUses training data and a loss/objective
InferenceUsing a trained model to make predictionsShould not update learned parameters unless online learning is intended
FeatureInput variable used by the modelExample: age, pixel values, token counts
Label / targetOutput the model should learn to predictPresent in supervised learning
ParameterLearned internal valueWeights in linear models or neural networks
HyperparameterChosen before or during training controlLearning rate, tree depth, number of clusters
Loss functionQuantity minimized during trainingCross-entropy for classification; MSE often for regression
GeneralizationPerformance on unseen dataBetter exam answer than “memorizes training set”
OverfittingModel fits training data too closely and performs poorly on new dataOften high train score, low validation/test score
UnderfittingModel is too simple or poorly trained to capture patternsLow train and validation performance
BiasIn ML error: simplifying assumptions; in responsible AI: unfair systematic harmRead the scenario carefully; the word has two contexts
VarianceSensitivity to training data changesHigh variance often means overfitting
Notes and examples

Machine learning workflow

A typical ML workflow is iterative. The first model is rarely the final model.

    flowchart TD
	    A[Define problem] --> B[Collect data]
	    B --> C[Explore and clean data]
	    C --> D[Split data]
	    D --> E[Preprocess features]
	    E --> F[Train model]
	    F --> G[Evaluate model]
	    G --> H{Good enough?}
	    H -- No --> C
	    H -- Yes --> I[Deploy or use model]
	    I --> J[Monitor performance]
	    J --> C

Workflow decision points

StepKey questionTrap to avoid
Define problemWhat exactly should be predicted or automated?Building a model before defining success
Collect dataIs the data relevant and representative?Using convenient but biased data
Explore dataWhat patterns, gaps, and anomalies exist?Skipping visualization and summary statistics
Split dataHow will generalization be measured?Testing on data used in training
PreprocessWhat transformations are needed?Fitting preprocessing on all data before splitting
TrainWhich model is appropriate?Choosing complexity without a reason
EvaluateWhich metric matches the goal?Using accuracy for imbalanced problems
MonitorDoes performance remain stable?Assuming deployment ends the project

Learning paradigms and task selection

ParadigmData availableOutputCommon examplesChoose whenCommon trap
Supervised classificationFeatures plus class labelsCategory/classSpam/not spam, disease/no disease, image classTarget is discretePredicting a number does not automatically mean regression if the number is a class code
Supervised regressionFeatures plus numeric targetContinuous valuePrice, temperature, demandTarget is numeric and ordered/continuousDo not use accuracy for regression
Unsupervised clusteringFeatures without labelsGroups/segmentsCustomer segments, document groupsNeed structure discoveryClusters are not automatically “correct labels”
Unsupervised dimensionality reductionFeatures without labelsFewer transformed featuresPCA, visualization, compressionNeed simplify high-dimensional dataTransformed components may be hard to interpret
Reinforcement learningAgent, environment, rewardsPolicy/actionsGame agent, robotics controlSequential decisions with feedbackReward design is critical; not the default for normal labeled datasets
Semi-supervised learningFew labels plus many unlabeled samplesImproved supervised modelLabel-scarce image/text tasksLabels are expensiveUnlabeled data must be relevant to the same problem
Self-supervised learningLabels generated from data itselfRepresentations/pretrainingMasked words, contrastive learningLarge unlabeled text/image dataNot the same as manually labeled supervised learning

End-to-end AI/ML workflow

    flowchart LR
	    A[Define problem] --> B[Collect data]
	    B --> C[Explore and clean]
	    C --> D[Split data]
	    D --> E[Preprocess and engineer features]
	    E --> F[Train model]
	    F --> G[Validate and tune]
	    G --> H[Test once]
	    H --> I[Deploy or report]
	    I --> J[Monitor drift, errors, bias]
Notes and examples
StepKey questionsArtifactsHigh-yield trap
Define problemClassification, regression, clustering, generation, ranking?Objective, success metric, constraintsPicking an algorithm before defining the target
Collect dataIs data representative, legal to use, and relevant?Raw datasets, metadataMore data is not useful if it is biased or mislabeled
Explore dataMissing values, outliers, class balance, correlations?Summary stats, plotsAssuming correlation proves causation
Split dataTrain/validation/test or cross-validation?Reproducible splitLetting test data influence preprocessing or tuning
PreprocessScale, encode, tokenize, impute, normalize?Pipeline or transformation codeFitting preprocessors on all data causes leakage
TrainWhich model family and hyperparameters?Fitted modelHigh training score alone is not evidence of success
Validate/tuneWhich hyperparameters improve validation metric?Scores, selected modelRepeatedly tuning on test data invalidates test result
TestFinal unbiased performance estimate?Test metricsTesting before final model selection
Deploy/monitorIs performance stable in production?Model service, logs, dashboardsData drift can degrade a once-good model

Data types, features, and preprocessing choices

Data / issueCommon handlingChoose / rememberTrap
Numeric continuousScaling, normalization, outlier checksImportant for kNN, SVM, logistic regression, neural networksTrees usually need less scaling
Categorical nominalOne-hot encoding, embeddings for high-cardinality dataNo inherent orderLabel encoding may imply false order
Categorical ordinalOrdered integer mapping or ordinal encodingKeep meaningful orderTreating ordinal values as purely nominal can lose signal
TextTokenization, vectorization, embeddingsConvert words/tokens to numbersRaw strings cannot be directly used by most numeric models
ImagesPixel arrays, normalization, augmentation, CNNsPreserve spatial patternsFlattening may discard useful locality for vision tasks
Time seriesTime-aware split, lag features, rolling statsFuture data must not leak into pastRandom split can leak future information
Missing valuesImputation, missingness indicators, row removalStrategy depends on why data is missingDropping rows can bias the dataset
OutliersInvestigate, cap, transform, robust modelsSome outliers are valid signalsBlind removal can discard rare but important cases
Imbalanced classesStratified split, class weights, resampling, precision/recall/F1Use metrics beyond accuracyA model predicting only majority class can look accurate
Duplicate recordsDeduplicate before split where appropriatePrevent same entity in train and testDuplicates inflate test performance
Data leakageKeep target/future/test information out of trainingUse pipelines fitted on training onlyLeakage often creates unrealistically high metrics

Python essentials for AI code questions

Python featureRememberCommon mistake
IndentationDefines code blocksMisreading nested if, for, def, or class blocks
ListsOrdered, mutable sequencesAssignment copies references, not deep copies
TuplesOrdered, immutable sequencesTuple can contain mutable objects
DictionariesKey-value mappingsKeys must be hashable
SetsUnordered unique elementsNo index-based access
Slicingseq[start:stop:step], stop is excludedOff-by-one errors
Negative indexseq[-1] is last itemseq[-0] equals seq[0]
List comprehensionCompact transformation/filterSide effects are less readable
Functionsreturn sends value backPrinting is not returning
LambdaSmall anonymous functionBest for simple expressions only
Exceptionstry / except handles runtime errorsCatching broad exceptions can hide bugs
ModulesImported with import or from ... import ...Namespace changes depending on import style
RandomnessUse seeds for reproducibilitySeed does not make a poor split representative
Boolean logicand, or, not; truthy/falsy valuesConfusing bitwise & with logical and outside array contexts
Notes and examples

Core Python patterns

values = [3, 1, 4, 1, 5]

squares = [x * x for x in values if x > 1]
unique_values = set(values)
counts = {x: values.count(x) for x in unique_values}

def normalize_minmax(x, min_x, max_x):
    return (x - min_x) / (max_x - min_x)

Read snippets for data flow: what is created, transformed, fitted, predicted, or measured.

NumPy and pandas quick reference

LibraryUsed forHigh-yield objects / methods
NumPyNumeric arrays, vectorized operations, linear algebra basicsarray, shape, reshape, mean, sum, argmax, dot, broadcasting
pandasTabular data loading, cleaning, explorationDataFrame, Series, read_csv, head, info, describe, isna, value_counts, groupby, loc, iloc
matplotlib / plotting toolsBasic visualizationHistograms, scatter plots, line plots, confusion matrix display
scikit-learn-style APIsClassical ML workflowsfit, transform, predict, score, train/test split, metrics, pipelines
Notes and examples
import numpy as np

x = np.array([[1, 2, 3],
              [4, 5, 6]])

x.shape          # (2, 3)
x.mean(axis=0)   # column means
x.mean(axis=1)   # row means
import pandas as pd

df = pd.read_csv("data.csv")
df.head()
df.info()
df["target"].value_counts()
df.isna().sum()
pandas selectorMeaning
df["col"]Select one column as a Series
df[["a", "b"]]Select multiple columns as a DataFrame
df.loc[row_label, col_label]Label-based selection
df.iloc[row_index, col_index]Position-based selection
df.drop(columns=["x"])Remove column x
df.groupby("class").mean()Aggregate by group

Model selection matrix

Model / methodBest fitPreprocessing needsStrengthsWatch for
Linear regressionNumeric regression with roughly linear relationshipsEncoding, often scalingSimple, interpretable baselinePoor fit for strong nonlinearity unless features are engineered
Logistic regressionBinary or multiclass classificationEncoding, often scalingStrong baseline, probabilistic outputsDespite name, used for classification
k-nearest neighbors, kNNClassification/regression based on similar examplesScaling is very importantSimple concept; no complex trainingSlow on large data; sensitive to irrelevant features
Naive BayesText classification, simple probabilistic classificationText vectorization for NLPFast, works well for bag-of-words text“Naive” independence assumption may be unrealistic
Decision treeClassification/regression with nonlinear rulesLittle scaling neededInterpretable if smallEasily overfits if unconstrained
Random forestEnsemble of decision treesLittle scaling neededReduces variance, strong general-purpose modelLess interpretable than one tree
Gradient boostingSequential ensemble improving errorsDepends on implementation/dataHigh predictive performanceSensitive to tuning; can overfit
Support vector machine, SVMClassification with clear margins; can use kernelsScaling usually importantEffective in many medium-size problemsKernel choice and tuning matter
k-meansUnsupervised clustering into k groupsScaling importantSimple clustering baselineMust choose k; assumes roughly spherical clusters
PCADimensionality reductionScaling often importantCompresses features, removes correlationComponents may not map to human-readable features
Neural networkComplex nonlinear patterns, unstructured dataScaling/normalization; more data often neededFlexible, supports deep learningMore parameters, less interpretability, compute needs

Neural networks and deep learning

ConceptMeaningExam cue
Neuron/unitComputes weighted input plus bias, then activationBasic building block
WeightLearned coefficientParameter, not hyperparameter
Bias termLearned offsetLets activation shift
Activation functionAdds nonlinearityWithout nonlinear activations, stacked layers act like a linear model
Forward passInputs flow through network to outputPrediction computation
LossDifference between prediction and desired outputTraining minimizes loss
BackpropagationComputes gradients through networkUsed to update weights
Gradient descentOptimization method moving parameters to reduce lossLearning rate controls step size
EpochOne pass over training dataMore epochs can overfit
Batch / mini-batchSubset used for one updateCommon in neural network training
CNNConvolutional neural networkStrong for images and spatial patterns
RNNRecurrent neural networkDesigned for sequences; less central than transformers in modern NLP
TransformerAttention-based architectureCommon in modern language models
EmbeddingDense vector representationUsed for words, documents, images, users/items
Notes and examples

Common activations:

ActivationTypical useKey behavior
ReLUHidden layersOutputs zero for negative input and linear positive values
SigmoidBinary probability output or gatingOutputs between 0 and 1
SoftmaxMulticlass outputConverts class scores into probabilities that sum to 1
TanhHidden layers in some networksOutputs between -1 and 1

Metrics and evaluation

Confusion matrix terms

TermMeaning
True positive, TPPredicted positive and actually positive
True negative, TNPredicted negative and actually negative
False positive, FPPredicted positive but actually negative
False negative, FNPredicted negative but actually positive
Notes and examples\[ \begin{aligned} \text{Accuracy} &= \frac{TP + TN}{TP + TN + FP + FN} \\ \text{Precision} &= \frac{TP}{TP + FP} \\ \text{Recall} &= \frac{TP}{TP + FN} \\ \text{F1} &= 2 \cdot \frac{\text{Precision} \cdot \text{Recall}}{\text{Precision} + \text{Recall}} \end{aligned} \]
MetricUse whenTrap
AccuracyClasses are reasonably balanced and error costs are similarMisleading with class imbalance
PrecisionFalse positives are costlyHigh precision can still miss many positives
Recall / sensitivityFalse negatives are costlyHigh recall can create many false positives
SpecificityTrue-negative performance mattersOften paired with sensitivity
F1 scoreNeed balance between precision and recallHides trade-off between the two
ROC AUCRanking ability across thresholdsCan look good even when precision is poor in rare-positive tasks
PR AUCPositive class is rareMore informative than ROC in many imbalanced cases
Confusion matrixNeed error type breakdownMust know which class is “positive”

Regression metrics:

\[ \begin{aligned} \text{MAE} &= \frac{1}{n}\sum_{i=1}^{n}|y_i - \hat{y}_i| \\ \text{MSE} &= \frac{1}{n}\sum_{i=1}^{n}(y_i - \hat{y}_i)^2 \\ \text{RMSE} &= \sqrt{\text{MSE}} \end{aligned} \]
MetricUse whenTrap
MAENeed average absolute error in target unitsLess sensitive to large errors
MSEPenalize larger errors moreUnits are squared
RMSEPenalize large errors while keeping target unitsSensitive to outliers
R-squaredExplain variance relative to baselineHigh value does not prove causation or fairness

Train, validation, test, and cross-validation

Dataset partPurposeShould be used for
Training setFit model parametersTraining model and preprocessing fitted within training workflow
Validation setTune hyperparameters and compare modelsModel selection
Test setFinal estimate of generalizationOne-time final evaluation
Cross-validationRepeated train/validation splitsMore stable model comparison on limited data
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import classification_report

X_train, X_test, y_train, y_test = train_test_split(
    X, y, test_size=0.25, stratify=y, random_state=42
)

model = make_pipeline(
    StandardScaler(),
    LogisticRegression()
)

model.fit(X_train, y_train)
pred = model.predict(X_test)

print(classification_report(y_test, pred))

Key point: the scaler inside the pipeline is fitted on X_train, not the full dataset. That helps avoid data leakage.

Overfitting, underfitting, and fixes

SymptomLikely issuePractical fixes
High training score, low validation scoreOverfitting / high varianceMore data, regularization, simpler model, pruning, dropout, early stopping, cross-validation
Low training and validation scoreUnderfitting / high biasMore expressive model, better features, train longer, reduce excessive regularization
Validation score unstable across splitsHigh variance or small datasetCross-validation, more data, simpler model
Great test score during development but poor production performanceLeakage, distribution shift, or over-tuningRecheck split, monitor drift, use realistic validation
Model performs well overall but fails subgroupBias/fairness issue or unrepresentative dataSubgroup evaluation, better data coverage, fairness review
Notes and examples
TechniqueWhat it doesCommon use
RegularizationPenalizes model complexityReduce overfitting
DropoutRandomly disables neural units during trainingNeural network regularization
Early stoppingStops training when validation stops improvingAvoid overtraining
PruningLimits decision tree complexityReduce tree overfitting
Data augmentationCreates modified training examplesImages, text, audio robustness
Cross-validationTests performance across multiple splitsModel selection on limited data

Generative AI, NLP, and embeddings

ConceptMeaningExam-use distinction
TokenizationSplits text into tokensTokens may be words, subwords, or characters
VocabularySet of tokens known to a model/vectorizerUnknown or rare words need handling
Bag of wordsCounts token occurrencesIgnores word order
TF-IDFWeights words by frequency and rarityUseful classical text representation
EmbeddingDense numeric vector representing meaning/featuresSimilar items should be close in vector space
Language modelPredicts or generates textCan be used for completion, classification, summarization
Generative modelProduces new contentText, image, audio, code, or synthetic data
PromptInput instruction/context for a generative modelPrompt wording affects output
HallucinationPlausible but incorrect generated outputRequires verification and guardrails
RAGRetrieval-augmented generationRetrieves external context before generation
Fine-tuningFurther training a model on task-specific dataChanges model behavior more deeply than prompting
TemperatureSampling randomness controlHigher generally means more varied output; lower more deterministic
GuardrailsControls to reduce unsafe or invalid outputsCan include filtering, validation, human review
Notes and examples

Cosine similarity is commonly used to compare embeddings:

\[ \text{cosine similarity} = \frac{A \cdot B}{\lVert A \rVert \lVert B \rVert} \]
import numpy as np

def cosine_similarity(a, b):
    a = np.array(a)
    b = np.array(b)
    return np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))

Responsible AI, ethics, and risk controls

RiskExampleMitigation idea
Bias / unfairnessLower performance for a demographic subgroupRepresentative data, subgroup metrics, fairness review
Privacy exposureSensitive data included in training or promptsData minimization, anonymization, access control
Lack of explainabilityUser cannot understand why a decision was madeSimpler model, feature importance, documentation
HallucinationGenerated answer invents factsRetrieval, validation, citations, human review
Data poisoningMalicious or corrupted training dataData provenance, validation, monitoring
Adversarial inputsSmall input changes cause wrong predictionsRobust testing, input validation, monitoring
Automation biasUsers overtrust AI outputHuman-in-the-loop review and clear uncertainty
Model driftProduction data changes over timeMonitoring, retraining triggers, performance checks
Security leakageModel or API reveals sensitive informationAuthentication, authorization, logging, rate controls
MisuseModel used outside intended scopeClear documentation, constraints, governance
Notes and examples

High-yield distinction: model accuracy is not the same as model acceptability. A model can score well and still be unsafe, unfair, nontransparent, or inappropriate for deployment.

Responsible AI and ethics

For the Python Institute PCEI - Certified Entry-Level AI Specialist with Python (PCEI-30-01) exam, responsible AI concepts are important because entry-level AI specialists must understand that technical work has human impact.

TopicPractical meaning
FairnessAvoid unjust performance differences across groups
BiasData, labels, or design choices can disadvantage groups
TransparencyUsers and stakeholders should understand system behavior at an appropriate level
ExplainabilityAbility to describe why a model made a prediction
PrivacyProtect personal or sensitive data
SecurityPrevent misuse, tampering, or data exposure
AccountabilityHumans remain responsible for system design and use
SafetyReduce harmful outputs or decisions
Human oversightCritical systems should not rely blindly on automation

Responsible AI decision rules

  • Do not deploy a model just because it has a good metric.
  • Check who benefits and who may be harmed.
  • Consider whether the data was collected with appropriate consent and safeguards.
  • Evaluate performance across meaningful subgroups when relevant.
  • Use human review for high-impact decisions.
  • Document assumptions, limitations, and intended use.
  • Monitor for drift, misuse, and unexpected failures.

Scenario decision rules

If the question says…Think…
“Predict whether” / “classify as” / “which category”Classification
“Predict price/amount/temperature”Regression
“Find natural groups without labels”Clustering
“Reduce many features while preserving information”Dimensionality reduction
“Agent learns by reward and penalty”Reinforcement learning
“Images with spatial patterns”CNN or image-focused preprocessing
“Text meaning or semantic search”Embeddings, language models, NLP
“Rare positive class”Precision, recall, F1, PR AUC; not accuracy alone
“False negative is dangerous”Prioritize recall/sensitivity
“False positive is expensive”Prioritize precision
“Very high training score, weak validation score”Overfitting
“Preprocessing used before split”Data leakage risk
“New data no longer matches training data”Drift / distribution shift
“Need human-understandable rules”Simpler interpretable model or explanation method

Common traps to eliminate

  • Logistic regression is for classification, not ordinary numeric regression.
  • Accuracy can be a poor metric when classes are imbalanced.
  • Test data is not for tuning. Use validation or cross-validation for model selection.
  • Fit preprocessing only on training data; transform validation/test using training-fitted steps.
  • Correlation does not prove causation.
  • Hyperparameters are chosen, while parameters are learned.
  • Scaling matters for distance-based and gradient-based methods; it is usually less critical for tree-based models.
  • Unsupervised learning has no labels during training.
  • A larger model is not automatically better; it can overfit and be harder to explain.
  • A seed improves reproducibility, not necessarily model quality.
  • Good average performance can hide subgroup failure.
  • Generative AI output must be verified when correctness matters.

Last-pass checklist for PCEI-30-01 review

Use this checklist before practice questions for the Python Institute PCEI - Certified Entry-Level AI Specialist with Python (PCEI-30-01):

  • Identify the ML task from the target: category, number, cluster, sequence action, or generated content.
  • Name the correct data split and what each split is allowed to influence.
  • Match metric to business error: false positive, false negative, continuous error, ranking, or imbalance.
  • Recognize leakage in preprocessing, feature creation, duplicates, and time-based data.
  • Distinguish AI, ML, deep learning, NLP, computer vision, and generative AI.
  • Read Python code for mutability, slicing, function return values, array shape, and fit/predict flow.
  • Know when scaling, encoding, imputation, tokenization, and embeddings are needed.
  • Recognize overfitting and underfitting from train/validation patterns.
  • Include responsible AI risks when a scenario mentions privacy, fairness, safety, transparency, or misuse.

High-yield exam mindset

The PCEI-30-01 exam is entry-level, so expect emphasis on whether you understand the role of AI and Python in practical workflows, not whether you can derive advanced research-level models from scratch.

Focus your final review on four skills:

  1. Vocabulary precision — AI, machine learning, deep learning, model, feature, label, training, inference, bias, variance.
  2. Workflow reasoning — how data moves from collection to preprocessing, training, evaluation, deployment, and monitoring.
  3. Python fluency for AI tasks — variables, data structures, functions, modules, arrays, tabular data, plotting, and library usage patterns.
  4. Model evaluation judgment — choosing the right metric, spotting overfitting, avoiding data leakage, and interpreting results cautiously.

Big-picture map

AreaKnow this quicklyCommon exam trap
Artificial intelligenceBroad field of systems that perform tasks associated with human intelligenceThinking AI always means machine learning
Machine learningModels learn patterns from data rather than being explicitly programmed for every ruleAssuming more data or a more complex model always improves results
Deep learningNeural-network-based ML, often useful for images, audio, language, and large datasetsTreating deep learning as the best choice for every problem
Data preparationCleaning, encoding, scaling, splitting, and checking data qualityPreprocessing test data using information from training data incorrectly
Supervised learningUses labeled examples: features plus target labelsConfusing classification and regression
Unsupervised learningFinds structure without target labelsExpecting unsupervised learning to “know” the correct answer
EvaluationMeasures whether the model generalizes to unseen dataReporting training accuracy as proof of real-world performance
Responsible AIFairness, transparency, privacy, safety, and accountabilityTreating technical accuracy as the only success criterion

AI, ML, and deep learning

Core distinctions

TermMeaningExample
AIAny system designed to perform intelligent behaviorA planning system, chatbot, recommendation engine
Machine learningAI approach where patterns are learned from dataPredicting house prices from past sales
Deep learningML using neural networks with many layersImage classification using a convolutional neural network
Generative AIModels that create new content such as text, images, code, or audioText generation, image generation
Expert systemRule-based system using human-coded knowledgeIf-then diagnostic rules
Notes and examples

A useful decision rule:

  • If the system follows fixed rules written by humans, it may be AI but not necessarily ML.
  • If the system improves by learning patterns from data, it is ML.
  • If the learning system uses multilayer neural networks, it is deep learning.
  • If the system creates new outputs resembling learned examples, it may be generative AI.

Common misconceptions

  • AI does not “understand” in the human sense just because it produces fluent output.
  • A model can be accurate on one dataset and fail on another.
  • Correlation in data does not prove causation.
  • Automation does not remove the need for human oversight.
  • Training a model is different from using a trained model for inference.

Neural network vocabulary

TermMeaning
Neuron/node/unitComputes a weighted combination of inputs and applies an activation
LayerGroup of neurons
Input layerReceives features
Hidden layerIntermediate transformation layer
Output layerProduces final prediction
WeightLearned parameter controlling connection strength
Bias termLearned offset parameter
Activation functionNonlinear function that helps networks learn complex patterns
Loss functionMeasures prediction error during training
BackpropagationComputes how weights should change to reduce loss
EpochOne pass through the training data
BatchSubset of training examples processed together

Where deep learning is commonly useful

DomainWhy deep learning is common
Computer visionLearns patterns from pixels and spatial structure
Natural language processingLearns patterns in sequences and meaning-related representations
Speech/audioLearns time-based signal patterns
Generative AILearns data distributions to generate new content
Large-scale predictionCan model complex nonlinear relationships with enough data

Deep learning traps

  • More layers do not automatically mean better performance.
  • Neural networks can overfit.
  • Deep learning often needs more data and compute than simpler models.
  • Interpretability can be harder than with simple models.
  • A neural network prediction is not a guarantee of truth.

Python foundations for AI

Python concepts to review

ConceptWhat to rememberAI-related use
VariablesNames bound to objectsStore data, parameters, model outputs
Numeric typesIntegers and floats behave differently in some operationsCalculations, metrics, feature values
StringsText sequences with indexing and methodsLabels, text data, file paths
ListsOrdered, mutable collectionsSmall datasets, batches, feature lists
TuplesOrdered, immutable collectionsFixed coordinate-like values, shape pairs
DictionariesKey-value mappingsConfiguration, label mappings, JSON-like data
SetsUnordered unique valuesUnique labels, duplicate checks
ConditionalsBranching with if/elif/elseData validation, decision logic
LoopsRepetition over items or rangesPreprocessing records, iterating samples
FunctionsReusable blocks with parameters and return valuesClean training, evaluation, preprocessing code
Modules/packagesReusable libraries imported into programsNumPy, pandas, scikit-learn, visualization tools
Notes and examples

Python mistakes that often appear in AI code

MistakeWhy it matters
Confusing assignment and comparisonAssignment stores a value; comparison tests a condition
Mutating a list unexpectedlyShared references can alter data unintentionally
Off-by-one indexingPython indexing starts at 0
Ignoring indentationIndentation defines blocks in Python
Reusing variable names carelesslyCan overwrite data, models, or metrics
Treating missing values as normal numbersCan distort statistics and training
Mixing strings and numbersCauses type errors or incorrect comparisons
Forgetting reproducibilityRandom splits and initialization can change results

Python libraries in an AI workflow

Library/tool typeTypical purposeWhat to know at entry level
NumPyArrays, vectorized numeric operationsArrays are faster and more convenient than many manual loops
pandasTables, data frames, cleaning, groupingColumns are features; rows are observations
Matplotlib or similarCharts and plotsVisualization helps detect patterns and outliers
scikit-learn style toolsClassical ML models and preprocessingFit on training data, evaluate on test data
Jupyter notebooksInteractive experimentationUseful for exploration, but results should be reproducible
Python standard libraryFiles, math, randomization, pathsMany support tasks do not need heavy AI libraries

Data fundamentals

Data terms

TermMeaning
Observation/sample/instanceOne row or example in the dataset
Feature/input/predictorA variable used to make a prediction
Target/label/outputThe value the model is trained to predict
DatasetCollection of examples
Training setData used to fit the model
Validation setData used to tune choices during development
Test setData held back for final evaluation
InferenceUsing a trained model to produce predictions
Ground truthThe correct known answer used for evaluation
Notes and examples

Data types and preprocessing

Data typeExamplesCommon preprocessing
NumericAge, price, temperatureScaling, imputation, outlier review
CategoricalColor, country, product typeOne-hot encoding, label encoding where appropriate
TextReviews, emails, documentsTokenization, normalization, vectorization
ImagePixels, channels, dimensionsResizing, normalization, augmentation
Time seriesSensor readings, prices over timeOrdering, lag features, careful split by time
BooleanTrue/false flagsOften usable directly or as 0/1 values

Data quality checklist

Before trusting a model, ask:

  • Are there missing values?
  • Are there duplicate rows?
  • Are labels correct and consistent?
  • Are units consistent?
  • Are categories spelled consistently?
  • Are there impossible values, such as negative ages?
  • Are outliers real, errors, or rare but valid cases?
  • Does the training data represent the real use case?
  • Is sensitive information handled appropriately?
  • Is there leakage from the target into the features?

Arrays, tables, and shapes

ConceptMeaningCandidate reminder
ScalarSingle valueExample: one temperature
VectorOne-dimensional arrayExample: one row of features or one column
MatrixTwo-dimensional arrayExample: rows by columns
TensorGeneral multidimensional arrayCommon in deep learning
ShapeDimensions of an arrayMany errors come from shape mismatch
BroadcastingAutomatic alignment of array operationsPowerful but can create unexpected results

A dot product is a common operation in linear models and neural networks:

\[ \mathbf{x} \cdot \mathbf{w} = \sum_{i=1}^{n} x_i w_i \]

The model combines inputs and weights, often adds a bias term, then applies a function.

Data frame habits

When reviewing pandas-style tabular work, remember:

  • Rows usually represent observations.
  • Columns usually represent features or labels.
  • Missing values must be detected and handled.
  • Categorical columns often need encoding.
  • Numeric columns may need scaling depending on the model.
  • Summary statistics can reveal impossible values.
  • Grouping can reveal class imbalance or biased representation.
  • The target column should be separated from input features before training.

Supervised learning

Supervised learning uses examples with known labels.

Classification vs regression

TaskTarget typeExampleTypical metric
ClassificationCategory/classSpam or not spamAccuracy, precision, recall, F1
Binary classificationTwo classesFraud or not fraudPrecision, recall, F1, ROC-AUC
Multiclass classificationMore than two classesAnimal speciesAccuracy, macro/micro F1
RegressionContinuous numberHouse priceMAE, MSE, RMSE, R-squared
Notes and examples

Common supervised algorithms

Algorithm familyBasic ideaGood to recognize
Linear regressionFits a line or hyperplane for numeric predictionSimple, interpretable baseline
Logistic regressionEstimates class probability for classificationDespite the name, used for classification
Decision treeSplits data using feature-based rulesEasy to visualize; can overfit
Random forestEnsemble of decision treesOften stronger than one tree
k-nearest neighborsPredicts from nearby examplesSensitive to scaling and distance choice
Support vector machineFinds a boundary between classesCan work well but may need scaling
Naive BayesProbabilistic classifier with simplifying independence assumptionCommon for text classification
Neural networkLayers transform inputs into predictionsPowerful but requires tuning and data

Supervised learning traps

  • Logistic regression is a classification method, not a regression method in the usual ML task sense.
  • High training accuracy with low test accuracy suggests overfitting.
  • A model trained on biased labels can reproduce bias.
  • If the target value is accidentally included as a feature, evaluation becomes misleading.
  • Random train/test split may be inappropriate for time series data.
  • Class imbalance can make accuracy look better than it is.

Unsupervised learning

Unsupervised learning looks for structure without labeled targets.

TaskGoalExample
ClusteringGroup similar observationsCustomer segments
Dimensionality reductionReduce feature count while preserving important structureVisualization or compression
Association discoveryFind items or events that occur togetherMarket basket patterns
Anomaly detectionIdentify unusual observationsFraud, equipment faults

Clustering review

ConceptMeaning
ClusterGroup of similar data points
CentroidCenter of a cluster in algorithms such as k-means
Distance metricRule for measuring similarity or difference
Number of clustersOften a modeling choice, not known automatically
ScalingImportant because large numeric ranges can dominate distances

Common trap: clustering can create groups even when the groups are not meaningful. Always interpret clusters in context.

Model evaluation essentials

Confusion matrix terms

For binary classification:

TermMeaning
True positiveModel predicts positive, actual is positive
True negativeModel predicts negative, actual is negative
False positiveModel predicts positive, actual is negative
False negativeModel predicts negative, actual is positive
Notes and examples

Classification metrics

\[ \text{Accuracy} = \frac{TP + TN}{TP + TN + FP + FN} \]\[ \text{Precision} = \frac{TP}{TP + FP} \]\[ \text{Recall} = \frac{TP}{TP + FN} \]\[ \text{F1} = 2 \cdot \frac{\text{Precision} \cdot \text{Recall}}{\text{Precision} + \text{Recall}} \]

Use the metric that matches the cost of mistakes:

SituationMetric focusWhy
Balanced classes, similar error costsAccuracy may be acceptableCorrect overall proportion is meaningful
False positives are costlyPrecisionPositive predictions must be reliable
False negatives are costlyRecallNeed to catch as many actual positives as possible
Imbalanced classesPrecision, recall, F1, ROC-AUC, PR-AUCAccuracy may hide poor minority-class performance
Medical screening-style scenarioOften recall-sensitiveMissing a true case can be costly
Spam filteringOften precision-sensitiveBlocking legitimate messages is harmful

Regression metrics

\[ \text{MAE} = \frac{1}{n}\sum_{i=1}^{n} |y_i - \hat{y}_i| \]\[ \text{MSE} = \frac{1}{n}\sum_{i=1}^{n} (y_i - \hat{y}_i)^2 \]\[ \text{RMSE} = \sqrt{\text{MSE}} \]
MetricMeaningWatch out
MAEAverage absolute errorEasy to interpret in target units
MSEAverage squared errorPenalizes large errors more strongly
RMSESquare root of MSESame units as target
R-squaredProportion of variance explained, in a simplified interpretationCan be misleading if used alone

Bias, variance, and generalization

Key ideas

ConceptMeaningSymptom
UnderfittingModel is too simple or poorly trainedPoor training and test performance
OverfittingModel memorizes training data instead of generalizingStrong training performance, weak test performance
BiasError from overly simple assumptionsMisses important patterns
VarianceError from being too sensitive to training dataPerformance changes greatly across samples
GeneralizationPerformance on new, unseen dataMeasured with validation/test data
Notes and examples

Ways to reduce overfitting

  • Use more representative training data.
  • Use a simpler model.
  • Regularize the model.
  • Prune a decision tree.
  • Use cross-validation where appropriate.
  • Stop training earlier for iterative models.
  • Remove noisy or leakage-prone features.
  • Evaluate on data not used for fitting or tuning.

Ways to reduce underfitting

  • Use more relevant features.
  • Use a more expressive model.
  • Train longer if the model is not converged.
  • Reduce excessive regularization.
  • Improve preprocessing.
  • Reconsider whether the chosen model family fits the problem.

Data splitting and leakage

Split types

SplitPurpose
Training setFit model parameters
Validation setTune model choices and compare candidates
Test setEstimate final generalization after decisions are made
Cross-validationRepeatedly train/evaluate across folds to get more stable estimates

Data leakage examples

Leakage patternWhy it is wrong
Scaling using all data before splittingTest-set information influences training transformation
Including a future value as a featureModel uses information unavailable at prediction time
Duplicate records in train and testModel may effectively see test examples during training
Target-derived featureFeature directly or indirectly reveals the answer
Tuning repeatedly on the test setTest set becomes part of model selection

A reliable rule: anything learned from data during preprocessing should be learned only from the training data, then applied to validation/test data.

Natural language processing basics

ConceptMeaning
TokenizationSplitting text into words, subwords, or tokens
Stop wordsCommon words sometimes removed, depending on task
Stemming/lemmatizationReducing words to base-like forms
Bag of wordsRepresents text by word counts, often ignoring order
TF-IDFWeights words by frequency and distinctiveness
EmbeddingNumeric vector representation of text meaning or usage patterns
Sentiment analysisPredicting positive, negative, or neutral sentiment
Language modelModel trained to predict or generate language-like sequences

Common NLP traps:

  • Text must be converted to numeric features before most ML models can use it.
  • Removing stop words is not always helpful; it depends on the task.
  • Bag-of-words models often ignore word order.
  • Generated text can be plausible but false.
  • Training text may contain social, cultural, or factual bias.

Computer vision basics

ConceptMeaning
PixelSmallest image element
ChannelColor or intensity component, such as red, green, blue
ResolutionImage width and height
ConvolutionOperation that detects local patterns using filters
PoolingReduces spatial size while retaining important information
Data augmentationCreates transformed versions of images to improve robustness
ClassificationAssigns an image-level label
DetectionLocates and classifies objects
SegmentationLabels image regions or pixels

Common computer vision traps:

  • Image size and channel order matter.
  • Normalization can affect model performance.
  • Training on clean images may not generalize to real-world images.
  • Augmentation should reflect realistic variation.
  • A high-performing model can still fail on underrepresented conditions.

Generative AI review

ConceptMeaning
PromptInput instruction or context given to a generative model
Completion/outputGenerated response
HallucinationPlausible-sounding but incorrect or unsupported output
TemperatureSetting that can influence randomness in generation
Context windowAmount of input/output context the model can consider
Fine-tuningFurther training a model for a specific task or style
Retrieval-augmented generationSupplying external retrieved information to support generation
GuardrailsControls to reduce harmful, unsafe, or off-task outputs

Common traps:

  • Generative output should be verified, especially for facts, code, legal, medical, or financial content.
  • A confident tone is not evidence of correctness.
  • Sensitive data should not be casually entered into AI tools.
  • Prompting can guide output, but it does not guarantee truth.
  • Evaluation of generative AI may require human judgment as well as automated metrics.

Statistics and probability essentials

Concepts to recognize

ConceptMeaning
MeanAverage value
MedianMiddle value when sorted
ModeMost frequent value
RangeDifference between maximum and minimum
VarianceAverage squared spread from the mean
Standard deviationTypical spread from the mean
DistributionPattern of values
OutlierUnusually extreme value
CorrelationDegree to which variables move together
ProbabilityLikelihood of an event
Random variableQuantity with uncertain outcome

Correlation warning

Correlation is useful for exploring relationships, but it does not prove causation. A model may exploit correlations that are unstable, biased, or not meaningful in the real world.

Fast decision tables

Which task is this?

ScenarioLikely task
Predict tomorrow’s temperatureRegression
Predict whether an email is spamBinary classification
Sort news articles into topics without labelsClustering
Reduce 500 features to 2 for visualizationDimensionality reduction
Detect unusual credit-card transactionsAnomaly detection
Generate a summary of a documentGenerative AI or NLP
Identify cats in imagesComputer vision classification or detection
Notes and examples

Which metric is most appropriate?

ScenarioBetter metric focus
Fraud detection with rare fraud casesRecall, precision, F1, PR-AUC
Medical screening where missing cases is costlyRecall
Search results where returned positives must be relevantPrecision
Balanced image classificationAccuracy plus per-class metrics
Predicting sale priceMAE, RMSE, R-squared
Comparing models during tuningValidation performance, not test performance

Which preprocessing step?

ProblemLikely response
Missing numeric valuesImpute, remove if justified, or investigate source
Text categoriesEncode categories
Very different numeric scalesScale or normalize for distance/gradient-sensitive models
Duplicated observationsRemove or investigate
High-cardinality categoriesUse careful encoding strategy
Text dataTokenize/vectorize
Image dataResize/normalize
Time-ordered dataPreserve chronology when splitting

Common candidate mistakes

Concept mistakes

  • Saying AI, ML, and deep learning are identical.
  • Calling every automated system “machine learning.”
  • Forgetting that labels are required for supervised learning.
  • Confusing validation data with test data.
  • Treating accuracy as universally best.
  • Assuming unsupervised clusters are automatically meaningful.
  • Ignoring class imbalance.
  • Assuming generated AI content is reliable without verification.
Notes and examples

Python mistakes

  • Misreading Python indexing and slicing.
  • Forgetting that many operations return new objects rather than modifying in place, or the reverse.
  • Confusing a list of lists with a two-dimensional numeric array.
  • Ignoring data types in columns.
  • Treating missing values as ordinary strings.
  • Reusing the same variable for different meanings.
  • Not separating features from the target.
  • Applying transformations inconsistently between training and test data.

Workflow mistakes

  • Building a model before defining the problem.
  • Training and testing on the same data.
  • Tuning based on test results repeatedly.
  • Failing to document preprocessing.
  • Ignoring deployment conditions.
  • Not monitoring for data drift.
  • Choosing the most complex model first.
  • Forgetting ethical and privacy considerations.

Mini review scenarios

Scenario 1: High accuracy but poor minority detection

A model predicts “not fraud” for nearly every transaction and reports high accuracy because fraud is rare.

What to think:

  • This is likely class imbalance.
  • Accuracy is misleading.
  • Review precision, recall, F1, and minority-class performance.
  • Consider resampling, class weights, threshold tuning, or better features.
Notes and examples

Scenario 2: Excellent training score, weak test score

A decision tree performs almost perfectly on training data but poorly on unseen data.

  • This suggests overfitting.
  • Try pruning, limiting depth, using more data, or using cross-validation.
  • Compare with simpler baselines.

Scenario 3: Test data used during preprocessing

A dataset is scaled before splitting into train and test sets.

  • This may leak information.
  • Split first.
  • Fit preprocessing on training data only.
  • Apply the learned transformation to validation/test data.

Scenario 4: Text model produces fluent false answer

A generative AI system writes a confident but incorrect explanation.

  • This is a hallucination or unsupported generation.
  • Verify against trusted sources.
  • Use retrieval, constraints, review, and guardrails where appropriate.

Final-day review checklist

Before you move into practice questions, make sure you can answer these quickly:

  • What is the difference between AI, ML, and deep learning?
  • What makes a problem supervised, unsupervised, or reinforcement-based?
  • How do classification and regression differ?
  • What are features, labels, training data, validation data, and test data?
  • Why is data leakage dangerous?
  • When is accuracy misleading?
  • How do precision and recall differ?
  • What does overfitting look like?
  • Why do many models require numeric feature representations?
  • What does scaling do, and when can it matter?
  • What are common uses of NumPy and pandas in AI workflows?
  • What are tokenization, embeddings, and image channels?
  • Why is responsible AI part of technical AI practice?
  • Why must generative AI outputs be checked?
  • How does Python support reproducible, structured AI work?

Put the review into practice