Total Pageviews

Monday, August 31, 2026

ANN Credit Card Approval — Weight & Bias Update

๐Ÿ’ณ ANN Credit Card Approval — Weight & Bias Update

Step-by-step example showing how an Artificial Neural Network uses Age, Salary and Credit Score to predict credit-card approval and then updates its weights and biases using loss.

1. Problem Statement

Suppose an ANN has to predict whether a person should be approved for a credit card.

x₁ = Age x₂ = Salary x₃ = Credit Score

Target: y = 1 → Approved y = 0 → Not Approved
Educational example: The numbers below are deliberately simplified so that the mathematics can be calculated by hand. A real credit model would require properly scaled data, many training examples, validation, fairness checks, and appropriate regulatory controls.

2. Input Data

Consider one applicant:

Feature Symbol Value
Age x₁ 30
Salary x₂ 50,000
Credit Score x₃ 700

Because salary and credit score have much larger numerical scales than age, we first normalize the inputs for this classroom example.

3. Normalize the Inputs

We will use simple normalized values:

Age: x₁ = 30 / 100 = 0.30

Salary: x₂ = 50,000 / 100,000 = 0.50

Credit Score: x₃ = 700 / 850 ≈ 0.824

Therefore the ANN receives:

X = [0.30, 0.50, 0.824]

4. ANN Architecture

INPUT
x₁ = Age
x₂ = Salary
x₃ = Credit Score
OUTPUT
Approval
Age + Salary + Credit Score ↓ Hidden Neuron ↓ Output Neuron ↓ Approval Probability

5. Initial Weights and Biases

Assume the ANN initially has:

Parameter Initial Value
Age Weight w₁ 0.20
Salary Weight w₂ 0.40
Credit Score Weight w₃ 0.50
Hidden Bias bโ‚• -0.30
Hidden → Output Weight w₄ 0.60
Output Bias bโ‚’ -0.20
Learning Rate ฮท 0.10

1 Forward Propagation — Hidden Neuron

The hidden neuron first calculates the weighted sum.

zโ‚• = x₁w₁ + x₂w₂ + x₃w₃ + bโ‚•

Substitute the values:

zโ‚• = (0.30 × 0.20) + (0.50 × 0.40) + (0.824 × 0.50) - 0.30

zโ‚• = 0.060 + 0.200 + 0.412 - 0.300

zโ‚• = 0.372

6. Hidden Neuron Activation

Apply the sigmoid activation function:

ฯƒ(z) = 1 / (1 + e⁻แถป)

h = 1 / (1 + e⁻⁰·³⁷²)

h ≈ 0.592
Hidden Neuron Output ≈ 0.592

2 Hidden → Output

zโ‚’ = h × w₄ + bโ‚’

Substitute:

zโ‚’ = (0.592 × 0.60) - 0.20

zโ‚’ = 0.3552 - 0.20

zโ‚’ = 0.1552

Now apply sigmoid:

ลท = 1 / (1 + e⁻⁰·¹⁵⁵²)

ลท ≈ 0.539
Predicted Approval Probability ≈ 53.9%

7. Actual Answer

Suppose the training dataset says that this applicant was approved.

Actual Target: y = 1

ANN Prediction: ลท = 0.539

The ANN is predicting only about 53.9%, while the target is 1. Therefore the network needs to learn.

3 Calculate Loss

For this educational example, use Mean Squared Error for one example:

L = ½(y - ลท)²

Substitute:

L = ½(1 - 0.539)²

= ½(0.461)²

= ½(0.2125)

L ≈ 0.1063

4 Backpropagation — Output Error

First calculate:

∂L/∂ลท = ลท - y

= 0.539 - 1

= -0.461

For sigmoid:

ฯƒ'(z) = ฯƒ(z)(1 - ฯƒ(z))

Therefore:

ฯƒ'(zโ‚’) = 0.539(1 - 0.539)

= 0.539 × 0.461

≈ 0.2485

Output error signal:

ฮดโ‚’ = (ลท - y) × ฯƒ'(zโ‚’)

= (-0.461)(0.2485)

ฮดโ‚’ ≈ -0.1146

5 Update Hidden → Output Weight

The gradient is:

∂L/∂w₄ = ฮดโ‚’ × h
∂L/∂w₄ = (-0.1146)(0.592)

≈ -0.06784

Now apply gradient descent:

w₄(new) = w₄(old) - ฮท × ∂L/∂w₄

= 0.60 - (0.10 × -0.06784)

= 0.60 + 0.006784

w₄(new) ≈ 0.60678

6 Update Output Bias

∂L/∂bโ‚’ = ฮดโ‚’

= -0.1146

Therefore:

bโ‚’(new) = bโ‚’(old) - ฮท × ∂L/∂bโ‚’

= -0.20 - (0.10 × -0.1146)

= -0.20 + 0.01146

bโ‚’(new) = -0.18854

7 Send the Error Back to Hidden Layer

The hidden neuron also contributed to the error.

ฮดโ‚• = ฮดโ‚’ × w₄ × ฯƒ'(zโ‚•)

First calculate hidden sigmoid derivative:

ฯƒ'(zโ‚•) = h(1-h)

= 0.592(1 - 0.592)

= 0.592 × 0.408

≈ 0.2415

Therefore:

ฮดโ‚• = (-0.1146)(0.60)(0.2415)

ฮดโ‚• ≈ -0.01660

8 Update Age Weight

∂L/∂w₁ = ฮดโ‚• × x₁

= (-0.01660)(0.30)

≈ -0.00498
w₁(new) = 0.20 - (0.10 × -0.00498)

= 0.20 + 0.000498

w₁(new) ≈ 0.20050

9 Update Salary Weight

∂L/∂w₂ = ฮดโ‚• × x₂

= (-0.01660)(0.50)

≈ -0.00830
w₂(new) = 0.40 - (0.10 × -0.00830)

= 0.40 + 0.000830

w₂(new) ≈ 0.40083

10 Update Credit Score Weight

∂L/∂w₃ = ฮดโ‚• × x₃

= (-0.01660)(0.824)

≈ -0.01368
w₃(new) = 0.50 - (0.10 × -0.01368)

= 0.50 + 0.001368

w₃(new) ≈ 0.50137

11 Update Hidden Bias

∂L/∂bโ‚• = ฮดโ‚•

= -0.01660
bโ‚•(new) = bโ‚•(old) - ฮท × gradient

= -0.30 - (0.10 × -0.01660)

= -0.30 + 0.001660

bโ‚•(new) ≈ -0.29834

12. Weight & Bias Before and After Learning

Parameter Before Gradient After
Age Weight w₁ 0.20000 -0.00498 0.20050
Salary Weight w₂ 0.40000 -0.00830 0.40083
Credit Score Weight w₃ 0.50000 -0.01368 0.50137
Hidden Bias bโ‚• -0.30000 -0.01660 -0.29834
Output Weight w₄ 0.60000 -0.06784 0.60678
Output Bias bโ‚’ -0.20000 -0.11460 -0.18854

12 Run the ANN Again

Now use the updated weights and biases.

w₁ = 0.20050
w₂ = 0.40083
w₃ = 0.50137
bโ‚• = -0.29834
w₄ = 0.60678
bโ‚’ = -0.18854

New Hidden Weighted Sum:

zโ‚•(new) = (0.30 × 0.20050) + (0.50 × 0.40083) + (0.824 × 0.50137) - 0.29834

≈ 0.3737

New Hidden Activation:

h(new) = Sigmoid(0.3737)

≈ 0.5924

New Output:

zโ‚’(new) = (0.5924 × 0.60678) - 0.18854

≈ 0.1709

ลท(new) = Sigmoid(0.1709)

≈ 0.5426
Old Prediction ≈ 0.539

New Prediction ≈ 0.543

The prediction moved closer to the target 1.

13. New Loss

New Loss = ½(1 - 0.5426)²

= ½(0.4574)²

≈ 0.1046
Old Loss ≈ 0.1063

New Loss ≈ 0.1046

✅ LOSS DECREASED

14. What Actually Happened?

Age = 30 Salary = ₹50,000 Credit Score = 700 ↓ ANN calculates weighted sum ↓ Hidden neuron activation ↓ Output prediction = 0.539 ↓ Actual target = 1 ↓ Loss = 0.1063 ↓ Backpropagation ↓ Calculate gradients ↓ Update weights ↓ Update biases ↓ Prediction ≈ 0.543 ↓ Loss ≈ 0.1046

The network has completed one learning step.

During actual training, this process is repeated for many training examples and many epochs.

15. General Weight Update Formula

Weight Update:

w(new) = w(old) - ฮท × ∂L/∂w

Bias Update:

b(new) = b(old) - ฮท × ∂L/∂b

Where:

w = Weight
b = Bias
ฮท = Learning Rate
L = Loss
∂L/∂w = Weight Gradient
∂L/∂b = Bias Gradient

16. Why Is the Credit Score Weight Updated?

The gradient tells the ANN how strongly a particular input affects the loss.

Credit Score: x₃ = 0.824

Gradient: ∂L/∂w₃ ≈ -0.01368

Therefore: w₃(new) ≈ 0.50137

The weight does not mean that credit score alone determines approval. It is simply a learned parameter within this toy neural network.

17. Interactive Step-by-Step Learning

① Input

Age = 0.30
Salary = 0.50
Credit Score = 0.824

② Forward Pass

zโ‚• = x₁w₁ + x₂w₂ + x₃w₃ + bโ‚•

zโ‚• = 0.372
h ≈ 0.592

③ Prediction

ลท ≈ 0.539

④ Loss

L = ½(y - ลท)²

L ≈ 0.1063

⑤ Backpropagation

Loss ↓ Output Gradient ↓ Hidden Gradient ↓ Weight Gradients

⑥ Update Weights

w(new) = w(old) - ฮท × gradient

⑦ Update Biases

b(new) = b(old) - ฮท × gradient

⑧ New Loss

Old Loss ≈ 0.1063

New Loss ≈ 0.1046
๐ŸŽฏ The ANN learned from the error.

18. Complete Learning Formula

Age + Salary + Credit Score ↓ Weighted Sum
z = x₁w₁ + x₂w₂ + x₃w₃ + b ↓ Sigmoid ↓ Prediction ↓ Compare with Actual Target ↓ Loss ↓ Backpropagation ↓ Gradient ↓ Weight Update
w(new) = w(old) - ฮท × gradient ↓ Bias Update
b(new) = b(old) - ฮท × gradient ↓ New Prediction ↓ New Loss ↓ Repeat
๐Ÿ’ณ Forward Propagation + Loss + Backpropagation = ANN Learning

19. Important Terms

Age Salary Credit Score Input Weight Bias Neuron Sigmoid Prediction Target Loss Gradient Backpropagation Learning Rate Gradient Descent

No comments:

Post a Comment