{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Definindo um perceptron"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![title](perceptron.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Seja\n",
    "\n",
    "##### $X=\\left[\\begin{matrix} 1 \\\\ x_1 \\\\ \\vdots \\\\x_n \\end{matrix} \\right]$  as entradas, $1$ é o viés ou bias, e $\\left[\\begin{matrix} x_1 \\\\ \\vdots \\\\ x_n\\end{matrix}\\right]$ é o que chamamos de padrão, a entrada dos dados a classificar\n",
    "##### $W=\\left[\\begin{matrix}w_0 \\\\ w_1 \\\\ \\vdots \\\\w_n \\end{matrix} \\right]$ os pesos para ajuste\n",
    "\n",
    "##### $\\Sigma=W^T.X=\\left[ \\begin{matrix} w_0 & w_1 & \\cdots & w_n\\end{matrix}\\right] \\left[ \\begin{matrix} 1 \\\\ x_1 \\\\ \\vdots \\\\ x_n \\end{matrix} \\right]$ $\\hspace{0.3cm}$  ou $\\hspace{0.3cm}$   $ \\Sigma = w_0.1 + w_1.x_1 + \\cdots + w_n.x_n $\n",
    "##### $d$ : Saída desejada\n",
    "##### $Y=f(\\Sigma)$ : Função de ativação\n",
    "##### $\\Delta = d - Y$ :  erro\n",
    "##### $\\tau$ : Taxa de aprendizagem\n",
    "##### $w_{i,t}=w_{i,t-1}+\\tau \\Delta x_{i,t-1}$, $\\hspace{0.3cm}$ é o $w_i$ no tempo $t$  ajustado com os erros que ocorreram no tempo $t-1$\n",
    "##### ou\n",
    "##### $W_t=W_{t-1}+\\tau \\Delta X_{t-1}$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Usando numpy podemos fazer essas operações de multiplicação como:\n",
    "$S=W.T@X$ \n",
    "#### ou seja, estamos multiplicando W transposto por X (lembre das regras de multiplicação de matrizes)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# PORTUGOL"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![title](portugol.png)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
