🏠 ANN Example: House Price Prediction
Use House Size, Number of Bedrooms and House Age to predict the price of a house using an Artificial Neural Network.
1. What is ANN?
An Artificial Neural Network (ANN) is a machine-learning model consisting of interconnected neurons.
Each neuron receives inputs, multiplies them by weights, adds a bias, and processes the result using an activation function.
In this example, the ANN performs a regression task. Instead of predicting YES or NO, it predicts a numerical value: house price.
House Size Bedrooms House Age Predicted Price2. Example House Data
| Feature | Actual Value | Normalized Value |
|---|---|---|
| House Size | 1500 sq.ft | 0.75 |
| Bedrooms | 3 | 0.60 |
| House Age | 10 years | 0.20 |
Different features can have very different numerical ranges. Normalization puts them on a comparable scale before the ANN processes them.
X₂ = Bedrooms = 0.60
X₃ = House Age = 0.20
3. ANN Architecture
X₁ = 0.75
X₂ = 0.60
X₃ = 0.20
House Price
The input features move through the hidden layer and finally reach the output neuron.
4. Step-by-Step Mathematical Calculation
Click each button to understand how the ANN calculates the predicted house price.
1 Identify the Inputs
The ANN receives three normalized input values:
X₂ = Bedrooms = 0.60
X₃ = House Age = 0.20
These inputs are passed to the hidden neuron.
2 Assign Weights and Bias
Suppose the hidden neuron H₁ has the following learned parameters:
W₂ = 0.30
W₃ = -0.20
Bias = 0.10
Notice that the weight for house age is negative. In this simplified example, this means increasing house age contributes negatively to the neuron's calculation.
3 Calculate the Weighted Sum
The basic neuron equation is:
Substitute the values:
Calculate each multiplication:
0.60 × 0.30 = 0.180
0.20 × -0.20 = -0.040
Add the values:
Z = 0.690
Therefore: Weighted Sum = 0.690
4 Apply Activation Function
For this teaching example, we use the sigmoid function:
We have:
Therefore:
Approximately:
H₁ ≈ 1 / (1 + 0.502)
H₁ ≈ 0.666
The hidden neuron therefore produces approximately: 0.666.
5 Calculate the Output
Suppose the output neuron has:
Output Bias = 0.20
The output neuron calculates:
Substitute:
Calculate:
Y = 1.332 + 0.20
Y = 1.532
The ANN's normalized output is therefore: 1.532.
6 Convert to House Price
Suppose our simplified normalization scheme represents 1.00 = ₹50 lakh.
Substitute:
This is a classroom demonstration. A real house-price ANN would use properly defined feature scaling, a suitable output layer, a real training dataset, and parameters learned from that data.
5. Complete ANN Mathematical Flow
↓
House Size = 0.75
Bedrooms = 0.60
House Age = 0.20
↓
WEIGHTED SUM
Z = (0.75 × 0.60) + (0.60 × 0.30) + (0.20 × -0.20) + 0.10
Z = 0.690
↓
SIGMOID ACTIVATION
H₁ ≈ 0.666
↓
OUTPUT
Y = (0.666 × 2.00) + 0.20
Y = 1.532
↓
PRICE CONVERSION
1.532 × ₹50 lakh
↓
🏠 PREDICTED PRICE ≈ ₹76.6 LAKH
6. Important ANN Terms
Input Layer Hidden Layer Output Layer Neuron Weight Bias Weighted Sum Activation Function Sigmoid Regression PredictionKey idea: In regression, an ANN can produce a continuous numerical prediction, such as house price, rather than a simple class such as PASS/FAIL.
No comments:
Post a Comment