Organiza tus páginas con colecciones Guarda y categoriza el contenido según tus preferencias.
Crear una red neuronal que aprende no linealidades comiencen con la siguiente estructura de modelo conocida: modelo lineal con la forma USD y' = b + w_1x_1 + w_2x_2 + w_3x_3$
Podemos visualizar esta ecuación como se muestra a continuación, donde $x_1$, $x_2$ y $x_3$ son los tres nodos de entrada (en azul), y $y'$ es el nodo de salida. (en verde).
Ejercicio 1
En el modelo anterior, el peso y los valores de sesgo se asignaron de forma aleatoria antes de que se inicialice. Realiza las siguientes tareas para familiarizarte con el y explorar el modelo lineal. Puedes ignora el menú desplegable Activation Function por ahora; discutiremos esto más adelante en el módulo.
Haz clic en el botón Reproducir (▶️) arriba de la red para calcular el valor de el nodo de salida para los valores de entrada $x_1 = 1.00$, $x_2 = 2.00$ $x_3 = 3.00$.
Haz clic en el segundo nodo de la capa de entrada y aumenta el valor de 2.00 a 2.50. Ten en cuenta que cambia el valor del nodo de salida. Selecciona el resultado nodos (en verde) y revisa el panel Cálculos para ver cómo la salida se calculó el valor.
Haz clic en el nodo de salida (en verde) para ver el peso ($w_1$, $w_2$, $w_3$). sesgo ($b$) del parámetro. Disminuye el valor del peso para $w_3$ (recuerda que el valor del nodo de salida y los cálculos que se muestran a continuación) cambiaron). Luego, aumenta el valor de sesgo. Revisa cómo estos cambios afectaron la salida del modelo.
Agregar capas a la red
Ten en cuenta que cuando ajustaste los valores de ponderación y sesgo de la red en Ejercicio 1, que no cambió los valores matemáticos generales relación entre la entrada y la salida. Nuestro modelo sigue siendo lineal.
¿Qué sucede si agregamos otra capa a la red entre la capa de entrada y la de salida? En la terminología de redes neuronales, las capas adicionales entre la capa de entrada y la de salida se denominan capas ocultas y los nodos de estas capas se denominan neuronas.
El valor de cada neurona en la capa oculta se calcula de la misma manera que la Resultado de un modelo lineal: Toma la suma del producto de cada una de sus entradas (las neuronas en la capa de red anterior) y un parámetro de peso único, además del sesgo. De forma similar, las neuronas en la capa siguiente (aquí, la capa de salida) se calculan con los valores de las neuronas de la capa oculta como entradas.
Esta nueva capa oculta permite a nuestro modelo recombinar los datos de entrada usando otro conjunto de parámetros. ¿Puede esto ayudar a nuestro modelo a aprender relaciones no lineales?
Ejercicio 2
Agregamos una capa oculta que contiene cuatro neuronas al modelo.
Haz clic en el botón Reproducir (▶️) arriba de la red para calcular el valor de entre los cuatro nodos de la capa oculta y el nodo de salida para los valores de entrada $x_1 = 1.00$, $x_2 = 2.00$ y $x_3 = 3.00$.
Luego, explora el modelo y úsalo para responder las siguientes preguntas.
¿Cuántos parámetros (pesos y sesgos) hace que tienen los modelos de red?
4
Nuestro modelo original del ejercicio 1 tuvo cuatro parámetros: w11, w21, w31 y b. Debido a que este modelo contiene capa oculta, hay más parámetros.
12
Ten en cuenta que la cantidad total de parámetros incluye ambos. que se usa para calcular los valores del nodo en la capa oculta a partir del los valores de entrada y los parámetros usados para calcular el valor de salida de los valores del nodo en la capa oculta.
16
Ten en cuenta que la cantidad total de parámetros incluye tanto la ponderación parámetros de sesgo.
21
Se utilizan 4 parámetros para calcular cada uno de los 4 valores de nodo en la capa oculta; 3 pesos (uno para cada valor de entrada) y una sesgo, que suma 16 parámetros. Luego, se usan 5 parámetros para calcular el valor de salida: 4 ponderaciones (una para cada nodo en el capa oculta) y un sesgo. En total, esta red neuronal tiene 21 parámetros.
Intenta modificar los parámetros del modelo y observa el efecto en el de los nodos de la capa oculta y el valor de salida (puedes revisar Panel de cálculos a continuación para ver cómo se obtuvieron estos valores calculada).
¿Puede este modelo aprender no linealidades?
Sí
Haz clic en cada nodo de la capa oculta y en el nodo de salida. y revisa los cálculos a continuación. ¿Qué notas todos estos cálculos?
No
Si haces clic en cada uno de los nodos de la capa oculta y revisas los siguientes cálculos, verás que todos son lineales (que comprende operaciones de multiplicación y suma).
Si haces clic en el nodo de salida y revisas el cálculo, verás que este cálculo también es lineal. Lineal los cálculos realizados sobre el resultado de los cálculos lineales también lineal, lo que significa que este modelo no puede aprender no linealidades.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2024-08-16 (UTC)"],[],[],null,["To build a [**neural network**](/machine-learning/glossary#neural_network)\nthat learns [**nonlinearities**](/machine-learning/glossary#nonlinear),\nbegin with the following familiar model structure: a\n[**linear model**](/machine-learning/glossary#linear-model) of the form\n$y' = b + w_1x_1 + w_2x_2 + w_3x_3$.\n\nWe can visualize this equation as shown below, where $x_1$,\n$x_2$, and $x_3$ are our three input nodes (in blue), and $y'$ is our output node\n(in green).\n\nExercise 1\n\nIn the model above, the [**weight**](/machine-learning/glossary#weight) and\n[**bias**](/machine-learning/glossary#bias) values have been randomly\ninitialized. Perform the following tasks to familiarize yourself with the\ninterface and explore the linear model. You can\nignore the *Activation Function* dropdown for now; we'll discuss this\ntopic later on in the module.\n\n1. Click the Play (▶️) button above the network to calculate the value of\n the output node for the input values $x_1 = 1.00$, $x_2 = 2.00$, and\n $x_3 = 3.00$.\n\n2. Click the second node in the\n [**input layer**](/machine-learning/glossary#input-layer), and increase\n the value from 2.00\n to 2.50. Note that the value of the output node changes. Select the output\n nodes (in green) and review the *Calculations* panel to see how the output\n value was calculated.\n\n | **Notes about calculations:**\n | - Values displayed are rounded to the hundredths place.\n | - The `Linear()` function simply returns the value it is passed.\n3. Click the output node (in green) to see the weight ($w_1$, $w_2$, $w_3$) and\n bias ($b$) parameter values. Decrease the weight value for\n $w_3$ (again, note that the value of the output node and the calculations below\n have changed). Then, increase the bias value. Review how these changes\n have affected the model output.\n\nAdding layers to the network\n\nNote that when you adjusted the weight and bias values of the network in\n[Exercise 1](#exercise_1), that didn't change the overall mathematical\nrelationship between input and output. Our model is still a linear model.\n\nBut what if we add another layer to the network, in between the input layer\nand the output layer? In neural network terminology, additional layers between\nthe input layer and the output layer are called\n[**hidden layers**](/machine-learning/glossary#hidden_layer), and the nodes\nin these layers are called\n[**neurons**](/machine-learning/glossary#neuron).\n\nThe value of each neuron in the hidden layer is calculated the same way as the\noutput of a linear model: take the sum of the product of each of its inputs\n(the neurons in the previous network layer) and a unique weight parameter,\nplus the bias. Similarly, the neurons in the next layer (here, the output layer)\nare calculated using the hidden layer's neuron values as inputs.\n\nThis new hidden layer allows our model to recombine the input data using another\nset of parameters. Can this help our model learn nonlinear relationships?\n\nExercise 2\n\nWe've added a hidden layer containing four neurons to the model.\n\nClick the Play (▶️) button above the network to calculate the value of\nthe four hidden-layer nodes and the output node for the input values\n$x_1 = 1.00$, $x_2 = 2.00$, and $x_3 = 3.00$.\n\nThen explore the model, and use it to answer the following questions. \nHow many [**parameters**](/machine-learning/glossary#parameter) (weights and biases) does this neural network model have? \n4 \nOur original model in [Exercise 1](#exercise-1) had four parameters: w~11~, w~21~, w~31~, and b. Because this model contains a hidden layer, there are more parameters. \n12 \nNote that the total number of parameters includes both the parameters used to calculate the node values in the hidden layer from the input values, and the parameters used to calculate the output value from the node values in the hidden layer. \n16 \nNote that the total number of parameters includes both the weight parameters and the bias parameters. \n21 \nThere are 4 parameters used to calculate each of the 4 node values in the hidden layer---3 weights (one for each input value) and a bias---which sums to 16 parameters. Then there are 5 parameters used to calculate the output value: 4 weights (one for each node in the hidden layer) and a bias. In total, this neural network has 21 parameters. \nTry modifying the model parameters, and observe the effect on the\nhidden-layer node values and the output value (you can review the\nCalculations panel below to see how these values were\ncalculated).\n\nCan this model learn nonlinearities? \nYes \nClick on each of the nodes in the hidden layer and the output node, and review the calculations below. What do you notice about all these calculations? \nNo \nIf you click on each of the nodes in the hidden layer and review\nthe calculations below, you'll see that all of them are linear\n(comprising multiplication and addition operations).\n\nIf you then click on the output node and review the calculation\nbelow, you'll see that this calculation is also linear. Linear\ncalculations performed on the output of linear calculations are\nalso linear, which means this model cannot learn nonlinearities.\n| **Key terms:**\n|\n| - [Bias](/machine-learning/glossary#bias)\n| - [Hidden layer](/machine-learning/glossary#hidden_layer)\n| - [Input layer](/machine-learning/glossary#input-layer)\n| - [Linear model](/machine-learning/glossary#linear-model)\n| - [Model](/machine-learning/glossary#model)\n| - [Neural network](/machine-learning/glossary#neural_network)\n| - [Neuron](/machine-learning/glossary#neuron)\n| - [Nonlinear](/machine-learning/glossary#nonlinear)\n| - [Parameter](/machine-learning/glossary#parameter)\n- [Weight](/machine-learning/glossary#weight) \n[Help Center](https://support.google.com/machinelearningeducation)"]]