# 1. Perceptron
**Single Layer Perceptron(one Neuron)**  
A Perceptron is a simple model of a biological neuron that classifies the label of the input data based on various activation functions:
1. Binary Step Function: 
\begin{equation}
  f(x)=\begin{cases}
    0, & \text{if $x<0$}.\\
    1, & \text{otherwise}.
  \end{cases}
\end{equation}


2. Signum Function:
\begin{equation}
  f(x)=\begin{cases}
    -1, & \text{if $x<0$}.\\
    0, & \text{if $x=0$>}\\
    1, & \text{if $x>0$}.
  \end{cases}
\end{equation}


3. Linear Activation Function:
$$f(x) = x$$


4. Sigmoid / Logistic Activation Function:
$$f(x) = \frac{1}{1+e^{-x}}$$


5. Tanh Function (Hyperbolic Tangent):
$$f(x) = \frac{e^{x} - e^{-x}}{e^{x} + e^{-x}}$$


6. ReLU Function:
$$f(x) = max(0, x)$$


7. Exponential Linear Units (ELUs) Function:
\begin{equation}
  f(x)=\begin{cases}
    x, & \text{if $x\geqslant0$}.\\
    \alpha(e^{x} - 1), & \text{otherwise}.
  \end{cases}
\end{equation}


8. Swish:
$$f(x) = \frac{x}{1 + e^{-x}}$$


9. Gaussian Error Linear Unit (GELU):
$$f(x) = 0.5x(1 + tanh[\sqrt{2/\pi}(x + 0.044715x^3)])$$



```python
fn_list = ['step', 'signum', 'linear', 'relu', 'sigmoid', 'tanh', 'elu', 'gelu', 'swish']
```

## 1.1. How to use this
```python
from Perceptron.perceptron import Perceptron
from Perceptron.utils import prepare_data, save_plot, save_model

# get the data, convert it into a DataFrame and then use below commands
X, y = prepare_data(df)

model = Perceptron(eta = eta, epochs = epochs)
model.fit(X, y, fn, alpha=None) # alpha ranges between 0 to 1 if and only if ELU activation function is applied else alpha value remains None for other activation functions

Total_Error = model.total_loss()

save_model(model, filename = filename)

save_plot(df, plotFilename, model)
```

## 1.2. Reference
[Python Package Publishing Docs](https://packaging.python.org/tutorials/packaging-projects/)

[GitHub Actions CICD Docs](https://docs.github.com/en/actions/guides/building-and-testing-python#publishing-to-package-registries)

d51d582f32f5be82130aee0cd3701bda9a9cfeff
ipynb
Jupyter Notebook
Readme.ipynb
rohandhanraj/Perceptron
5eea4679b14be3beec4b9e9999e47fef62cf18d8
MIT
Readme.ipynb
rohandhanraj/Perceptron
5eea4679b14be3beec4b9e9999e47fef62cf18d8
MIT
Readme.ipynb
rohandhanraj/Perceptron
5eea4679b14be3beec4b9e9999e47fef62cf18d8
MIT
Qwen/Qwen-72B
1. YES
2. YES