Skip to content

Heperowt/Artificial-Neuron-From-Scratch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 Artificial Neuron (Perceptron) - Rent Estimator

C# .NET

A from-scratch implementation of an Artificial Neuron (Perceptron) in C# without using any external Machine Learning libraries. This project models the relationship between house features (Number of Rooms, Distance to Center, Building Age) and their Rent prices using supervised learning.

🎯 Project Overview

This project demonstrates the fundamental mechanics of a neural network: input processing, weight initialization, activation functions, and backpropagation (weight updates). The goal is to predict house rents based on a small normalized dataset.

📊 The Dataset (Normalized Summary)

The model is trained on 15 samples and tested on 5 samples. Before processing, the data is normalized (e.g., Rooms/5, Distance/20, Age/30, Rent/10000) to keep values between 0 and 1.

Feature Description Normalization Factor
Input 1 Number of Rooms / 5
Input 2 Distance to Center (km) / 20
Input 3 Building Age (years) / 30
Target Rent (₺) / 10,000

🧮 Mathematical Model

This implementation explicitly programs the core math of a single neuron:

  1. Summation Function ($v$): Calculates the weighted sum: $v = \sum_{i=1}^{n} w_i x_i$
  2. Activation Function (Sigmoid): Maps the output between 0 and 1: $y = \frac{1}{1 + e^{-v}}$
  3. Weight Update Rule: Adjusts weights based on error ($t - y$) and learning rate ($\lambda$): $w_i = w_i + \lambda(t - y)x_i$
  4. Error Evaluation (MSE): Calculates the Mean Squared Error: $MSE = \frac{1}{n} \sum (t - y)^2$

🔬 Experimental Analysis

The program automatically runs multiple simulations to analyze how different Hyperparameters affect the model's performance:

  • Feature Selection: Compares 3-input vs. 2-input (excluding Building Age) performance.
  • Learning Rates ($\lambda$): Tests $0.05$, $0.01$, and $0.1$ to find the best convergence.
  • Epochs: Compares training results after $25$ and $100$ cycles.

A final summary table is printed to the console, allowing for a detailed comparison of Mean Squared Error (MSE) across all test cases.

🛠️ How to Run

  1. Clone the repository.
  2. Open the .sln file in Visual Studio.
  3. Build and Run to see step-by-step training progress and final evaluation tables.

About

A C# implementation of an Artificial Neuron (Perceptron) built from scratch to predict house rents using Sigmoid activation and MSE evaluation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages