AI, ML, DL, Data Science β€” Notes + Turing Test & Evaluation

Objectives: AI, ML, DL, Data Science β€” Notes + Turing Test & Evaluation

AI, ML, DL, Data Science β€” Notes + Turing Test & Evaluation (English / Kiswahili)

AI, ML, DL & Data Science β€” Deep Notes + Turing Test & Evaluation

1. Quick conceptual map (Overview)

Artificial Intelligence (AI) is the broad field: systems that perform tasks that normally require human intelligence. Machine Learning (ML) is a subset of AI: systems that learn from data. Deep Learning (DL) is a subset of ML that uses multi-layer neural networks. Data Science is an interdisciplinary field that extracts insights from data; it uses ML/DL as tools but also covers domain knowledge, visualization, statistics.

Swahili: AI = Inteligensia ya Bandia, ML = Kujifunza kwa Mashine, DL = Kujifunza kwa Kina, Data Science = Sayansi ya Takwimu.

2. Visual β€” Venn diagram

AI (Artificial Intelligence) ML (Machine Learning) DL (Deep Learning) Data Science (uses statistics, data engineering, visualization, ML/DL) β€” Sayansi ya Takwimu

3. Artificial Intelligence (AI) β€” deep notes

Definition: AI means designing agents (software or robots) that perceive an environment, reason, learn, and act to achieve goals. (Agent = wakala / programu inayofanya kazi kwa niaba ya mtu au mfumo.)

Key components
  • Perception (sensing): cameras, audio, sensors.
  • Knowledge representation: logic, ontologies, embeddings.
  • Reasoning & planning: search algorithms, optimization.
  • Learning: ML techniques to update behaviour from data.
Example (environment):

Autonomous taxi: sensors (LIDAR, camera), perception module (detect pedestrians), planner (route), decision module (stop/drive), safety layer.

When to call something "AI"?

When system replaces or amplifies tasks that typically required human cognitive capabilities: understanding language, recognising objects, planning complex actions.

4. Machine Learning (ML)

Definition: ML is the study of algorithms that improve performance at tasks with experience (data). (Experience = data, uzoefu = data)

Types of ML
  1. Supervised learning β€” input x, label y. Example: predict house price. (Kujifunza kwa Uongozi)
  2. Unsupervised learning β€” discover structure without labels. Example: clustering customer segments. (Kujifunza Bila Lezo)
  3. Semi-supervised β€” mix of labeled and unlabeled data.
  4. Reinforcement learning (RL) β€” agent learns by trial-and-error using rewards. Example: game-playing agents. (Kujifunza kwa Malipo)
Common algorithms
  • Linear regression, Logistic regression
  • Decision trees, Random forests, Gradient boosting
  • K-means, PCA (Principal Component Analysis)
  • Support Vector Machines (SVM)
Mathematical core (example: linear regression)

Model: \(\hat{y} = w^T x + b\)

Loss (MSE): \(L(w,b) = \frac{1}{n}\sum_{i=1}^n (y_i - (w^T x_i + b))^2\)

Symbols: \(x_i\) = feature vector for sample i; \(y_i\) = true label; \(w\) = weight vector; \(b\) = bias/offset; \(n\) = number of samples.

Practical example

Predict salary from years-of-experience: x = [years], y = salary. Train linear regression, compute MSE on test set.

5. Deep Learning (DL)

Definition: DL are methods using deep (many-layered) neural networks. They learn hierarchical representations from raw data (e.g., pixels -> edges -> shapes -> objects).

Neural network (simple feedforward) β€” formula & symbols

For layer \(\ell\): \(z^{(\ell)} = W^{(\ell)} a^{(\ell-1)} + b^{(\ell)}\); activation: \(a^{(\ell)} = f(z^{(\ell)})\).

Symbols: \(W^{(\ell)}\) = weight matrix for layer \(\ell\); \(b^{(\ell)}\) = bias vector; \(a^{(\ell)}\) = activations (outputs) of layer; \(f\) = activation function (ReLU, sigmoid, tanh).

Backpropagation (brief)

Algorithm to compute gradients of loss w.r.t weights using chain rule. Update weights using gradient descent: \(W \leftarrow W - \eta \frac{\partial L}{\partial W}\) where \(\eta\) is learning rate.

Common architectures
  • Convolutional Neural Networks (CNNs) β€” images
  • Recurrent Neural Networks / Transformers β€” sequences & language
  • Autoencoders β€” representation learning
Example (image classifier):

Input: image pixels. CNN extracts features, fully-connected head outputs class probabilities via softmax: \(p_k = \frac{e^{z_k}}{\sum_j e^{z_j}}\).

6. Data Science β€” role and workflow

Definition: Data Science (Sayansi ya Takwimu) combines domain expertise, programming, statistics, and ML to extract insights and build data products.

Typical workflow
  1. Define question / business problem.
  2. Data collection and engineering (ETL).
  3. Exploratory Data Analysis (EDA) β€” visualizations, summary stats.
  4. Modeling (ML/DL) and validation.
  5. Deployment and monitoring (MLOps).
Example:

Retail chain wants to forecast product demand. Data scientists merge sales data, holidays, promotions, train forecasting model, evaluate, and deploy.

7. Interactive: small neural network (click nodes)

Click a node to see meaning.

Input Hidden Output
Click a node above to see description.

8. Model evaluation β€” core metrics and formulas

Evaluation depends on task (classification, regression, ranking). Below are core metrics with formulas and Swahili translations for complex terms.

Classification β€” confusion matrix
Confusion matrix:
            | Pred Positive | Pred Negative
    ------------+---------------+--------------
    Actual Pos  |     TP        |     FN
    Actual Neg  |     FP        |     TN

    TP = True Positive (sahihi +)
    FP = False Positive (kiongozi wa uzushi)
    FN = False Negative
    TN = True Negative
        

Common metrics:

  • Accuracy: \(\frac{TP + TN}{TP + TN + FP + FN}\). (Usahihi)
  • Precision (Positive Predictive Value): \(\frac{TP}{TP+FP}\). (Usahihi wa Utabiri Chanya)
  • Recall (Sensitivity, True Positive Rate): \(\frac{TP}{TP+FN}\). (Urejesho / Uwazi wa Kugundua)
  • F1-score: harmonic mean \(F1 = 2 \cdot \frac{precision \cdot recall}{precision + recall}\).
Regression metrics
  • Mean Squared Error (MSE): \(\frac{1}{n} \sum (y_i - \hat{y}_i)^2\).
  • Root MSE (RMSE): \(\sqrt{MSE}\).
  • Mean Absolute Error (MAE): \(\frac{1}{n} \sum |y_i - \hat{y}_i|\).
Ranking / probabilistic metrics
  • AUC-ROC: area under curve of TPR vs FPR (False Positive Rate = \(\frac{FP}{FP+TN}\)).
Cross-validation

k-fold CV: split data into k disjoint folds, train on k-1, test on 1, repeat. Use average metric across folds to estimate generalization.

Practical tips
  • Choose metrics matching business objective (e.g., recall matters for medical diagnosis).
  • Beware of imbalanced classes β€” use precision/recall or AUC instead of accuracy.
  • Use calibration checks for probabilistic models (e.g., reliability diagrams).

9. Turing Test & AI Evaluation Methods

Alan Turing's Imitation Game (Turing Test)

Original idea: Proposed by Alan Turing (1950). An evaluator interacts via text with a human and a machine without knowing which is which. If the evaluator cannot reliably distinguish the machine from the human, the machine is said to "pass" the Turing Test.

Why it's important: It reframes the question "Can machines think?" to an operational test about indistinguishability in conversation.

Limitations of the Turing Test
  • Focuses on linguistic imitation rather than understanding or consciousness.
  • Can be gamed by superficial tricks (chatbots using evasive answers).
  • Not quantitative β€” binary pass/fail doesn't measure capability depth or safety.
Modern AI evaluation methods (complementary approaches)
  1. Benchmark datasets: GLUE, SuperGLUE (NLP), ImageNet (vision). Evaluate on held-out test sets to compare models.
  2. Task-based evaluation: Measure performance on specific tasks (translation BLEU score, detection mAP).
  3. Human evaluation: Humans judge outputs for quality, fluency, helpfulness β€” used for text, summarization, generative systems.
  4. Adversarial evaluation: Test with inputs designed to break models (adversarial examples).
  5. Robustness & stress tests: distribution shift tests, out-of-distribution detection, noisy inputs.
  6. Safety and alignment checks: measures for bias, fairness (e.g., disparate impact), toxicity detection.
  7. Explainability and interpretability tests: feature importance, saliency maps, counterfactual explanations.
  8. Operational metrics: latency, memory footprint, throughput β€” important for deployment.
Evaluation matrix β€” recommended practice

Combine automatic metrics (e.g., BLEU, F1, RMSE) + human judgements + adversarial/robustness tests + safety checks.

Example: evaluating a chatbot for customer support
  • Automatic: intent classification accuracy, entity extraction F1.
  • Human: helpfulness scores from raters, conversational naturalness.
  • Robustness: typos, mixed-language, adversarial queries.
  • Safety: ensure no harmful/offensive responses, check bias across demographics.

10. Formula summary & symbol glossary

SymbolMeaningSwahili
\(x_i\)Feature vector for sample iVektor ya vipengele
\(y_i\)True label / targetLezo / lengo
\(\hat{y}\)Model predictionUtabiri wa mfano
\(w, b\)Weights and bias (parameters)Uzito na upendeleo (vigezo)
\(L(\theta)\)Loss function parameterized by \(\theta\)Kifuniko cha hasara
\(\eta\)Learning rateKiwango cha kujifunza
Common formula examples (LaTeX displayed by MathJax)

Linear regression predictor: \(\hat{y} = w^T x + b\)

Logistic sigmoid: \(\sigma(z) = \frac{1}{1+e^{-z}}\)

Softmax for class k: \(p_k = \frac{e^{z_k}}{\sum_j e^{z_j}}\)

11. Practical checklist for building/evaluating an AI system

  1. Define clear objective & success metrics (business KPIs).
  2. Prepare and clean data; check biases; split train/val/test.
  3. Select baseline models and strong baselines.
  4. Use cross-validation and proper hyperparameter search (grid, random, Bayesian).
  5. Evaluate with metrics aligned to objective; run human eval if needed.
  6. Test robustness, fairness, and safety properties before deployment.
  7. Monitor online (drift detection, performance metrics) and have rollback strategies.

Notes prepared with practical examples, formulas and simple visualizations. Swahili translations are added inline for complex terms; if you want a complete Swahili version only, tell me and I will produce a dedicated Swahili HTML file.

Reference Book: N/A

Author name: SIR H.A.Mwala Work email: biasharaboraofficials@gmail.com
#MWALA_LEARN Powered by MwalaJS #https://mwalajs.biasharabora.com
#https://educenter.biasharabora.com

:: 1::

β¬… ➑