> For the complete documentation index, see [llms.txt](https://apphp.gitbook.io/artificial-intelligence-with-php/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apphp.gitbook.io/artificial-intelligence-with-php/neural-networks/types-of-nn/basic-nn/simple-perceptron.md).

# Simple Perceptron

### Structure of a Simple Perceptron

A Simple Perceptron consists of:

1. **Input Layer:** Takes the input features as a vector $$\mathbf{x} = \[x\_1, x\_2, \dots, x\_n]$$.
2. **Weights:** Each input is associated with a weight , which determines the input’s influence on the perceptron.
3. **Bias Term ():** Adds flexibility by shifting the activation function.
4. **Summation Function:** Computes the weighted sum of inputs: $$z = \sum\_{i=1}^n w\_i x\_i + b$$
5. **Activation Function:** Applies a threshold to the weighted sum to determine the output:\
   \
   $$y = \begin{cases} 1 & \text{if } z \geq 0 \ 0 & \text{if } z < 0 \end{cases}$$\
   \\

   <div align="left"><figure><img src="/files/GsWbYSE2oph14dOKA3UA" alt="" width="563"><figcaption></figcaption></figure></div>

### Working Mechanism

1. **Initialization:** Randomly initialize the weights and bias.
2. **Forward Pass:** Compute the perceptron’s output using the summation and activation functions.
3. **Error Calculation:** Compare the predicted output with the actual label .
4. **Weight Update:** Adjust the weights based on the error using the perceptron learning rule: $$w\_i = w\_i + \eta \cdot (y\_{\text{true}} - y) \cdot x\_i$$\
   Here, $$\eta$$ is the learning rate.
5. **Iteration:** Repeat steps 2-4 for a specified number of epochs or until convergence.

#### Strengths of the Simple Perceptron

* Efficiency: Computationally lightweight and easy to implement.
* Binary Classification: Effective for linearly separable problems, such as distinguishing between two classes.

### Limitations

* Linear Separability: Fails for datasets that are not linearly separable (e.g., XOR problem).
* Limited Capability: Cannot handle complex patterns or nonlinear decision boundaries.

### Conclusion

The Simple Perceptron is a key stepping stone in machine learning, laying the foundation for more sophisticated models like multi-layer perceptrons and deep neural networks. While it has limitations, understanding its structure and function is crucial for grasping the evolution of neural networks.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apphp.gitbook.io/artificial-intelligence-with-php/neural-networks/types-of-nn/basic-nn/simple-perceptron.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
