Skip to main content
MahiDev — Learn. Build. Become AI-ready.

Lesson 01

Arithmetic & Number Systems for AI

Build AI-ready number sense with integers, floats, fractions, percentages, ratios, scientific notation, and logarithms.

Beginner45 min

Integers

1. Definition

An integer is a whole number without a decimal point. It can be positive, negative, or zero.

Integer number line showing negative zero and positive whole numbers

2. Principle

Integers represent countable quantities.

If something can be counted as a whole item, it is usually stored as an integer.

Quantity Integer Example
Epochs 10
Batch Size 32
Number of GPUs 4
Number of Features 128
Token Count 512

Rule: Counts = Integers

3. Properties of Integers

Property Example
Positive 8
Negative -5
Zero 0
No decimal 25 ✓
Decimal is not integer 25.5 ✗

4. Visual Number Line

The diagram above is the number line for integers:

  • Left side → Negative integers
  • Middle → Zero
  • Right side → Positive integers
  • The dots … mean the line continues forever in both directions

5. Mathematical Operations

Integer operations

6. Python Implementation

python
# Integers
epochs = 10
batch_size = 32
gpu_count = 4
max_tokens = 512

print(type(epochs))      # <class 'int'>
print(type(batch_size))  # <class 'int'>

Arithmetic

python
epochs = 10
extra_epochs = 5

total = epochs + extra_epochs
print(total)  # 15

7. AI & Machine Learning Use Cases

Example 1 — Training Epochs

python
epochs = 20

The model will learn from the dataset 20 times.

Example 2 — Batch Size

python
batch_size = 64

The neural network processes 64 images at once.

Example 3 — Vocabulary Size

python
vocab_size = 50000

The tokenizer contains 50,000 words/tokens.

Example 4 — Token Limit

python
max_tokens = 2048

An LLM can generate up to 2048 tokens.

8. Real-World AI Examples

AI System Integer Used
ChatGPT Max Tokens = 4096
CNN Batch Size = 32
BERT Sequence Length = 512
YOLO Number of Classes = 80
Training Epochs = 100

9. Common Mistakes

Wrong

python
batch_size = 32.5

Batch size cannot be half a sample.

Correct

python
batch_size = 32

Wrong

python
epochs = 10.0

Correct

python
epochs = 10

10. Interview Questions

Q1. What is an integer?

A whole number without a decimal point.

Q2. Why is batch size an integer?

Because it represents the number of training samples processed together, and samples are countable.

Q3. Is zero an integer?

Yes. Zero belongs to the integer set.

Q4. Is 7.0 an integer?

Mathematically it represents 7, but in programming 7.0 is a float, not an integer.

11. Practice Questions

  1. Is -12 an integer?
  2. Is 0 an integer?
  3. Is 18.5 an integer?
  4. Which is correct for epochs: 20 or 20.0?
  5. Why can't batch size be 16.5?

Answers: 1. Yes · 2. Yes · 3. No · 4. 20 · 5. Samples cannot be fractional.

12. One-Line Revision

Integers are whole numbers used to represent countable values such as epochs, batch size, GPUs, features, and token counts in AI systems.

Formula Sheet

Set of integers Z

Memory Rule: Count = Integer

Floats

1. Definition

A float (floating-point number) is a number that contains a decimal point. It is used to represent values that are not whole numbers.

Set of real numbers R

Examples: 0.5, 3.14, 0.001, -2.75

2. Principle

Floats represent measurements, probabilities, and continuous values.

If a value can vary smoothly (instead of being counted), it is usually a float.

Quantity Float Example
Learning Rate 0.001
Dropout 0.25
Temperature 0.8
Confidence Score 0.97
Loss Value 0.142

Rule: Measurements = Floats

3. Properties of Floats

Property Example
Decimal number 3.14
Positive 0.75
Negative -1.25
Zero can be float 0.0
Can represent fractions 0.5

Integer vs Float

Integer Float
5 5.0
32 32.5
-7 -7.25
0 0.0

Although 5 and 5.0 have the same value, they are different data types.

4. Visual Number Line

Float number line with decimal values

5. Mathematical Operations

Float operations

6. Python Implementation

python
# Float variables
learning_rate = 0.001
dropout = 0.25
temperature = 0.8
loss = 0.142

print(type(learning_rate))   # <class 'float'>

Arithmetic

python
loss1 = 0.45
loss2 = 0.32

total_loss = loss1 + loss2
average_loss = total_loss / 2

print(average_loss)

7. AI & Machine Learning Use Cases

Example 1 — Learning Rate

python
learning_rate = 0.001

Controls how much the model updates its weights during training.

Example 2 — Dropout

python
dropout = 0.3

30% of neurons are randomly disabled during training to reduce overfitting.

Example 3 — Temperature

python
temperature = 0.7

Controls randomness in LLM responses.

  • Low = More deterministic
  • High = More creative

Example 4 — Confidence Score

python
confidence = 0.98

Model is 98% confident in its prediction.

8. Real-World AI Examples

AI System Float Used
Adam Optimizer 0.001
GPT Temperature 0.7
CNN Dropout 0.5
BERT Learning Rate 2e-5
Model Confidence 0.96

9. Common Mistakes

Wrong

python
learning_rate = 1

A learning rate of 1 is usually too large and causes unstable training.

Correct

python
learning_rate = 0.001

Wrong

python
temperature = 7

Correct

python
temperature = 0.7

10. Interview Questions

Q1. What is a float?

A decimal number used to represent continuous values.

Q2. Why is learning rate always a float?

Because weight updates require very small decimal values for stable optimization.

Q3. Difference between 5 and 5.0?

5 5.0
Integer Float
Count Measurement
int float

Q4. Give three AI parameters that are floats.

  • Learning Rate
  • Dropout
  • Temperature

11. Practice Questions

  1. Is 0.25 a float?
  2. Is 7.0 a float?
  3. Which data type should learning rate use?
  4. Is 32.5 suitable for batch size?
  5. Why is 0.001 better than 1 for learning rate?

Answers

  1. Yes
  2. Yes
  3. Float
  4. No
  5. It provides small, stable weight updates.

12. One-Line Revision

Floats are decimal numbers used to represent continuous values such as learning rates, probabilities, loss values, dropout, and temperature in AI systems.

Formula Sheet

Parameter Typical Value
Learning Rate 0.001
Dropout 0.25
Temperature 0.7
Confidence 0.98

Memory Rule: Measure = Float

Fractions

1. Definition

A fraction represents a part of a whole. It consists of two integers separated by a horizontal line.

Fraction parts — numerator over denominator

Examples:

Equation 1/2, 3/4, 4/5, 2/5
  • Numerator → Top number (parts selected)
  • Denominator → Bottom number (total equal parts)

2. Principle

Fractions represent proportions or portions of a complete set.

In AI, fractions are commonly used for dataset splitting, probabilities, and sampling.

Fraction Meaning
1/2 Half
1/4 One quarter
3/4 Three quarters
4/5 Four parts out of five

Rule: Part of a whole = Fraction

3. Parts of a Fraction

Diagram

Example:

Fraction 3 over 4
  • Numerator = 3
  • Denominator = 4

Meaning: 3 of the 4 equal parts are selected.

4. Visual Representation

1/2

Visual bar for one half

3/4

Visual bar for three quarters

5. Converting Fractions

Fraction → Decimal

Equation 4/5 = 0.8

Fraction → Percentage

Equation 4/5 × 100 = 80%

Table

Fraction Decimal Percentage
1/2 0.50 50%
1/4 0.25 25%
3/4 0.75 75%
4/5 0.80 80%

6. Mathematical Operations

Fraction operations

7. Python Implementation

python
from fractions import Fraction

train_split = Fraction(4, 5)
print(train_split)

# Output: 4/5

Decimal conversion

python
train_split = 4 / 5
print(train_split)

# Output: 0.8

8. AI & Machine Learning Use Cases

Example 1 — Train/Test Split

Suppose a dataset has 1000 images.

Equation 4/5 × 1000 = 800
  • Training = 800
  • Testing = 200
python
total_images = 1000

train = int(total_images * (4/5))
test = total_images - train

print(train, test)

Output:

text
800 200

Example 2 — Validation Split

Dataset = 10,000 samples

Fraction Samples
7/10 7000
2/10 2000
1/10 1000

This is a 70/20/10 dataset split.

Example 3 — Probability

A model predicts:

  • Cat = 3/4
  • Dog = 1/4

Converted to percentages:

  • Cat = 75%
  • Dog = 25%

9. Real-World AI Examples

AI Task Fraction
Dataset Split 4/5
Validation 1/10
Sampling 1/100
Mini Dataset 1/20
Train Ratio 7/10

10. Common Mistakes

Wrong

Writing dataset split as:

python
train = 4
test = 5

This is not a fraction.

Correct

python
train_ratio = 4 / 5

Wrong

Using fractions that don't total 1.

  • Train = 3/4
  • Test = 1/2

Total = 1.25 ❌

Correct

  • Train = 4/5
  • Test = 1/5

Total = 1 ✅

11. Interview Questions

Q1. What is a fraction?

A number representing a part of a whole.

Q2. What are numerator and denominator?

  • Numerator → Selected parts
  • Denominator → Total parts

Q3. Why are fractions used in ML?

To divide datasets into training, validation, and testing portions.

Q4. Convert 3/4 into decimal and percentage.

  • Decimal = 0.75
  • Percentage = 75%

12. Practice Questions

  1. Convert 1/2 to decimal.
  2. Convert 3/5 to percentage.
  3. A dataset has 500 samples. Find the training size using 4/5.
  4. Which is larger: 2/3 or 3/5?
  5. Why must train + test fractions equal 1?

Answers

  1. 0.5
  2. 60%
  3. 400
  4. 2/3
  5. Because they must represent the entire dataset.

13. One-Line Revision

Fractions represent parts of a whole and are used in AI for dataset splitting, probabilities, sampling, and proportional calculations.

Formula Sheet

Fraction parts — numerator over denominator
Equation Percentage = Fraction × 100

Memory Rule: Part of Whole = Fraction

Percentages

1. Definition

A percentage means "per hundred". It expresses a value as a fraction of 100.

Equation 25% = (25)/(100) = 0.25

Examples: 10%, 50%, 80%, 95%, 99.8%

2. Principle

Percentages measure performance, proportions, and probabilities.

In AI, percentages are used to evaluate how well a model performs.

AI Metric Example
Accuracy 95%
Precision 92%
Recall 88%
Confidence 97%

Rule: Performance = Percentage

3. Percentage Formula

Percentage from part over total

Example

A model correctly predicts 95 images out of 100.

Equation (95)/(100) × 100 = 95%

4. Visual Representation

80%

Visual bar for 80 percent

5. Convert Between Formats

Percentage Fraction Decimal
25% 1/4 0.25
50% 1/2 0.50
75% 3/4 0.75
80% 4/5 0.80
95% 95/100 0.95

Conversion Formula

Percentage → Decimal

Convert percentage to decimal

Example:

Equation 80% = 0.8

Decimal → Percentage

Equation Percentage = Decimal × 100

Example:

Equation 0.92 = 92%

6. Python Implementation

Calculate Percentage

python
correct = 95
total = 100

accuracy = (correct / total) * 100
print(accuracy)

Output:

text
95.0

Convert Decimal to Percentage

python
confidence = 0.97

print(confidence * 100)

Output:

text
97.0

7. AI & Machine Learning Use Cases

Example 1 — Accuracy

Suppose a classifier predicts:

  • Correct = 980
  • Total = 1000
Equation (980)/(1000) × 100 = 98%
python
correct = 980
total = 1000

accuracy = (correct / total) * 100
print(f"Accuracy: {accuracy}%")

Example 2 — Confidence Score

python
confidence = 0.93

Displayed to users as:

text
93%

Example 3 — Dataset Split

1000 images

  • Train = 80%
  • Test = 20%
Equation 1000 × 0.8 = 800
Split Samples
Train 800
Test 200

8. Real-World AI Examples

AI Application Percentage
Image Classifier Accuracy 96%
Spam Detection Precision 91%
Face Recognition Confidence 99%
OCR Accuracy 98.5%
LLM Evaluation Score 87%

9. Common Mistakes

Wrong

python
accuracy = 95 / 100
print(accuracy)

Output:

text
0.95

This is a decimal, not a percentage.

Correct

python
accuracy = (95 / 100) * 100
print(accuracy)

Output:

text
95.0

Wrong

Treating 95 as a decimal.

python
confidence = 95

Correct

python
confidence = 0.95

10. Interview Questions

Q1. What does percentage mean?

A value expressed per hundred.

Q2. Write the percentage formula.

Percentage from part over total

Q3. Difference between 0.95 and 95%?

Value Meaning
0.95 Decimal
95% Percentage

Both represent the same quantity.

Q4. Why are percentages important in ML?

They communicate model performance in an easily understandable way.

11. Practice Questions

  1. Convert 60% to decimal.
  2. Convert 0.85 to percentage.
  3. A model predicts 180 correct out of 200. Find accuracy.
  4. Which is larger: 92% or 0.87?
  5. Why is confidence usually shown as a percentage?

Answers

  1. 0.60
  2. 85%
  3. 90%
  4. 92%
  5. It is easier for humans to interpret.

12. One-Line Revision

Percentages express values per hundred and are used in AI to measure accuracy, precision, recall, confidence, and overall model performance.

Formula Sheet

Percentage from part over total
Convert percentage to decimal
Equation Percentage = Decimal × 100

Memory Rule: Performance = Percentage

Ratios

1. Definition

A ratio compares two or more quantities and shows their relationship.

Equation a : b

Examples: 1:1, 2:1, 4:5, 16:9, 80:20

Key idea: A ratio compares values; it does not represent a part of a whole by itself.

2. Principle

Ratios express comparison between quantities.

In AI, ratios are used for dataset splits, image dimensions, class balance, and model evaluation.

Ratio Meaning
80:20 Train : Test
70:15:15 Train : Validation : Test
16:9 Image aspect ratio
3:1 Majority vs minority class

Rule: Comparison = Ratio

3. Ratio Formula

If two quantities are A and B:

Equation Ratio = A : B

Example:

  • Apples = 8
  • Oranges = 2
Equation 8 : 2 = 4 : 1

This is called simplifying a ratio.

4. Visual Representation

Train : Test = 80 : 20

Visual bar for 80:20 train test split

5. Simplifying Ratios

Example

Equation 12 : 4

Divide both sides by 4:

Equation 3 : 1

Another example:

Equation 100 : 25 = 4 : 1
Original Simplified
12:4 3:1
80:20 4:1
100:50 2:1

6. Ratio vs Fraction vs Percentage

Type Example Purpose
Ratio 80:20 Compare
Fraction 4/5 Part of whole
Percentage 80% Per hundred

Conversion

Ratio → Fraction

Equation 80 : 20 = 4/5

Ratio → Percentage

Equation 4/5 × 100 = 80%

7. Python Implementation

Dataset Ratio

python
train = 80
test = 20

ratio = train / test

print(ratio)

Output:

text
4.0

Convert Ratio to Samples

python
total = 1000

train = int(total * (80/100))
test = total - train

print(train, test)

Output:

text
800 200

8. AI & Machine Learning Use Cases

Example 1 — Dataset Split

Dataset = 5000 images

Ratio = 80:20

Split Samples
Train 4000
Test 1000

Example 2 — Train / Validation / Test

Ratio = 70:15:15

Dataset = 10,000

Split Samples
Train 7000
Validation 1500
Test 1500

Example 3 — Image Aspect Ratio

A monitor has:

  • Width = 1920
  • Height = 1080
Equation 1920 : 1080 = 16 : 9

This is the standard widescreen ratio.

Example 4 — Imbalanced Dataset

Suppose:

  • Cats = 900
  • Dogs = 100
Equation 900 : 100 = 9 : 1

This tells us the dataset is imbalanced.

9. Real-World AI Examples

AI Task Ratio
Train/Test 80:20
Train/Val/Test 70:15:15
Image Resolution 16:9
Class Imbalance 9:1
Sampling 1:10

10. Common Mistakes

Wrong

Confusing ratio with percentage.

text
80:20 = 80%

Incorrect.

Correct

  • Ratio = 80:20
  • Fraction = 4/5
  • Percentage = 80%

Wrong

Using ratios that don't match the total.

Example:

Train = 70

Validation = 20

Test = 20

Total = 110 ❌

Correct

Equation 70 + 15 + 15 = 100

11. Interview Questions

Q1. What is a ratio?

A comparison between two or more quantities.

Q2. Difference between ratio and fraction?

Ratio Fraction
Compares values Represents part of whole
80:20 4/5

Q3. Why is 80:20 commonly used in ML?

It provides a good balance between training data and evaluation data.

Q4. What does 16:9 represent?

An image or screen aspect ratio.

12. Practice Questions

  1. Simplify 40:20.
  2. Convert 80:20 into a fraction.
  3. Convert 3:1 into a percentage of the first value.
  4. A dataset has 600 samples using 4:1 ratio. Find train and test samples.
  5. Which represents comparison: Ratio or Fraction?

Answers

  1. 2:1
  2. 4/5
  3. 75%
  4. Train = 480, Test = 120
  5. Ratio

13. One-Line Revision

A ratio compares two or more quantities and is used in AI for dataset splits, aspect ratios, class balance, and proportional comparisons.

Formula Sheet

Equation Ratio = A : B
Equation 80 : 20 = 4/5 = 80%

Memory Rule: Compare = Ratio

Scientific Notation

1. Definition

Scientific notation is a compact way to write very large or very small numbers using powers of 10.

Equation a × 10n

Where:

  • a = coefficient (1 ≤ a < 10)
  • 10 = base
  • n = exponent (positive or negative)

Examples

Scientific Decimal
1 × 10³ 1,000
5 × 10² 500
1 × 10⁻³ 0.001
1 × 10⁻⁵ 0.00001

Rule: Very small or very large numbers = Scientific Notation

2. Principle

Instead of writing long decimals like:

Equation 0.00000001

AI engineers write:

Equation 1 × 10⁻⁸

or in Python:

python
1e-8

This improves readability, precision, and consistency.

3. Formula

General Formula

Equation Number = a × 10n

Positive Exponent

Move the decimal right.

Equation 2.5 × 10³ = 2500

Negative Exponent

Move the decimal left.

Equation 2.5 × 10⁻³ = 0.0025

4. Visual Representation

Positive Exponents

Diagram

Negative Exponents

Diagram

Memory Rule

  • Positive exponent → Move decimal Right
  • Negative exponent → Move decimal Left

5. Conversion Table

Scientific Decimal
1e1 10
1e2 100
1e3 1,000
1e6 1,000,000
1e-1 0.1
1e-2 0.01
1e-3 0.001
1e-5 0.00001
1e-8 0.00000001

Note: In Python, 1e-5 means 1 × 10⁻⁵.

6. Python Implementation

Writing Scientific Notation

python
learning_rate = 1e-3
epsilon = 1e-8
weight_decay = 5e-4

print(learning_rate)
print(epsilon)

Output:

text
0.001
1e-08

Verify Values

python
print(1e-5)
print(2.5e3)

Output:

text
0.00001
2500.0

7. AI & Machine Learning Use Cases

Example 1 — Learning Rate

python
learning_rate = 1e-3

Equivalent to:

Equation 0.001

This controls how much weights are updated during training.

Example 2 — Adam Optimizer

python
epsilon = 1e-8

Used to prevent division by zero in optimization algorithms.

Example 3 — Weight Decay

python
weight_decay = 5e-4

Equivalent to:

Equation 0.0005

Used for regularization to reduce overfitting.

Example 4 — BERT Fine-Tuning

Typical learning rates:

Scientific Decimal
5e-5 0.00005
3e-5 0.00003
2e-5 0.00002

These values appear in almost every Transformer training script.

8. Real-World AI Examples

Parameter Value
CNN Learning Rate 1e-3
BERT LR 2e-5
GPT Fine-Tuning LR 5e-5
Adam Epsilon 1e-8
Weight Decay 5e-4

9. Common Mistakes

Wrong

python
learning_rate = 0.0000000001

Hard to read.

Correct

python
learning_rate = 1e-10

Wrong

Confusing 1e-3 with 10^-3.

1e-3 means:

Equation 1 × 10⁻³ = 0.001

Not:

Equation -1000

10. Interview Questions

Q1. What is scientific notation?

A compact way to represent very large or very small numbers using powers of 10.

Q2. What does 1e-5 mean?

Equation 1 × 10⁻⁵ = 0.00001

Q3. Why do AI engineers prefer 1e-5?

Because it is easier to read, less error-prone, and commonly used in ML frameworks.

Q4. Where is scientific notation used in AI?

  • Learning rates
  • Adam optimizer
  • Weight decay
  • Numerical stability constants

11. Practice Questions

  1. Convert 1e3 to decimal.
  2. Convert 5e-4 to decimal.
  3. Write 0.00001 in scientific notation.
  4. Which is larger: 1e-3 or 1e-5?
  5. Why is 1e-8 used in Adam?

Answers

  1. 1000
  2. 0.0005
  3. 1e-5
  4. 1e-3
  5. To improve numerical stability and avoid division by zero.

12. One-Line Revision

Scientific notation represents extremely large and small numbers using powers of 10 and is widely used in AI for learning rates, optimizers, and numerical stability.

Formula Sheet

Equation a × 10n
Equation 1e{-3} = 0.001
Equation 1e{-5} = 0.00001
Equation 1e{-8} = 0.00000001

Memory Rule: Positive exponent → Right · Negative exponent → Left

Logarithms

1. Definition

A logarithm answers one question:

"To what power must the base be raised to produce a number?"

Equation log_b(x) = y ⇔ by = x

Where:

  • b = Base
  • x = Number
  • y = Exponent

Example

Equation log_2(8) = 3

Because:

Equation 2³ = 8
Logarithm Answer
log₂(8) 3
log₁₀(100) 2
log₂(16) 4
ln(e) 1

2. Principle

Logarithms measure exponential growth, information, and uncertainty.

In AI they are fundamental to:

  • Cross-Entropy Loss
  • Information Theory
  • Decision Trees
  • Language Models
  • Entropy

Rule: Information = Logarithm

3. Relationship Between Exponents & Logarithms

They are inverse operations.

Diagram
Exponential Logarithm
2³ = 8 log₂(8) = 3
10² = 100 log₁₀(100) = 2

4. Types of Logarithms

Base 2

Equation log_2(x)

Used in:

  • Entropy
  • Information theory
  • Decision trees

Base 10

Equation log_10(x)

Used in:

  • Scientific calculations
  • Orders of magnitude

Natural Log

Equation ln(x) = log_e(x)

Used in:

  • Machine learning optimization
  • Cross-entropy
  • Probability distributions

5. Logarithm Graph

Diagram

As x increases, the logarithm grows slowly.

Example:

x log₂(x)
2 1
4 2
8 3
16 4
32 5

6. Python Implementation

Natural Log

python
import math

print(math.log(10))

Base 2

python
import math

print(math.log2(8))

Output:

text
3.0

Base 10

python
import math

print(math.log10(1000))

Output:

text
3.0

7. AI & Machine Learning Use Cases

Example 1 — Cross-Entropy Loss

The most important loss function in classification.

Equation L = -Σ y log(ŷ)

Where:

  • y = True label
  • ŷ = Predicted probability

Suppose:

  • True = 1
  • Prediction = 0.9
Equation -log(0.9) = 0.105

Smaller loss = Better prediction.

Example 2 — Decision Tree Entropy

Entropy measures disorder.

Equation H = -Σ p log_2 p

Example:

  • Cat = 50%
  • Dog = 50%
Equation H = 1

Higher entropy = More uncertainty.

Example 3 — Language Models

LLMs predict token probabilities.

Token Probability
cat 0.70
dog 0.20
bird 0.10

The loss is calculated using log probabilities.

8. Real-World AI Examples

AI System Logarithm Used
GPT Cross-Entropy
BERT Log Loss
Decision Trees Entropy
CNN Classifier Negative Log Likelihood
Reinforcement Learning Log Probability

9. Common Mistakes

Wrong

Thinking:

Equation log(100) = 100

Correct

Equation log_10(100) = 2

Wrong

Ignoring the base.

Equation log(8) = 3

Incorrect unless the base is 2.

Correct

Equation log_2(8) = 3

10. Interview Questions

Q1. What is a logarithm?

A logarithm finds the exponent required to produce a number.

Q2. Why are logarithms important in ML?

Because they measure information and are used in loss functions like Cross-Entropy.

Q3. Difference between log₂ and ln?

log₂ ln
Base 2 Base e
Entropy Optimization

Q4. Where is logarithm used in GPT?

During Cross-Entropy Loss for next-token prediction.

11. Practice Questions

  1. Find log₂(16).
  2. Find log₁₀(1000).
  3. Which log is used in entropy?
  4. Which loss function uses logarithms?
  5. Why does a correct prediction produce lower log loss?

Answers

  1. 4
  2. 3
  3. Base 2
  4. Cross-Entropy
  5. Because high predicted probability gives a smaller negative log value.

12. One-Line Revision

Logarithms measure exponents, information, and uncertainty, making them essential for Cross-Entropy Loss, entropy, and language model training.

Formula Sheet

Equation log_b(x) = y ⇔ by = x
Equation H = -Σ p log_2 p
Equation L = -Σ y log(ŷ)

Memory Rule: Information = Logarithm