text
stringlengths
0
2.87M
def print_weights(self):
print("LISTADO PESOS DE CONEXIONES")
for i in range(len(self.weights)):
print(self.weights[i])
def get_deltas(self):
return self.deltas
Y ahora creamos una red a nuestra medida, con 2 neuronas de entrada, 3 ocultas y 2 de salida. Deberemos ir ajustando los parámetros de entrenamiento learning rate y la cantidad de iteraciones “epochs” para obtener buenas predicciones.
# funcion Coche Evita obstáculos
nn = NeuralNetwork([2,3,2],activation ='tanh')
X = np.array([[0, 0], # sin obstaculos
[0, 1], # sin obstaculos
[0, -1], # sin obstaculos
[0.5, 1], # obstaculo detectado a derecha
[0.5,-1], # obstaculo a izq
[1,1], # demasiado cerca a derecha
[1,-1]]) # demasiado cerca a izq
y = np.array([[0,1], # avanzar
[0,1], # avanzar
[0,1], # avanzar
[-1,1], # giro izquierda
[1,1], # giro derecha
[0,-1], # retroceder
[0,-1]]) # retroceder
nn.fit(X, y, learning_rate=0.03,epochs=15001)
index=0
for e in X:
print("X:",e,"y:",y[index],"Network:",nn.predict(e))
index=index+1
La salidas obtenidas son: (comparar los valores “y” con los de “Network” )
X: [0. 0.] y: [0 1] Network: [0.00112476 0.99987346]
X: [0. 1.] y: [0 1] Network: [-0.00936178 0.999714 ]
X: [ 0. -1.] y: [0 1] Network: [0.00814966 0.99977055]
X: [0.5 1. ] y: [-1 1] Network: [-0.92739127 0.96317035]
X: [ 0.5 -1. ] y: [1 1] Network: [0.91719235 0.94992698]
X: [1. 1.] y: [ 0 -1] Network: [-8.81827252e-04 -9.79524215e-01]
X: [ 1. -1.] y: [ 0 -1] Network: [ 0.00806883 -0.96823086]
Aquí podemos ver como el coste de la función se va reduciendo y tiende a cero:
import matplotlib.pyplot as plt
deltas = nn.get_deltas()
valores=[]
index=0
for arreglo in deltas:
valores.append(arreglo[1][0] + arreglo[1][1])
index=index+1
plt.plot(range(len(valores)), valores, color='b')
plt.ylim([0, 1])
plt.ylabel('Cost')
plt.xlabel('Epochs')
plt.tight_layout()
plt.show()<kinrel><user>Explain the second law of thermodynamics to a 6 year old kid. Make the explanation very intuitive to understand for a kid and provide an easy to understand example.<user><kinrel>The second law of thermodynamics is about energy and how it moves. You know how you get really warm when you run aroun...
Imagine you have a big container of ice cubes and a big container of hot water. What would happen if you pour the hot water into the ice cube container and the cold water into the hot water container? The hot water would start to cool down and the ice cubes would start to melt and turn into water. But eventually, both ...
The second law of thermodynamics says that this is always what happens. Energy always moves from a place with a lot of energy to a place with less energy. And when energy moves, it makes a difference between the hot and cold places gets smaller and smaller, until they're the same temperature.
So, we can't make a machine that runs forever, because eventually, all the energy would end up in the same place and everything would be the same temperature. We call this "entropy." It's just a fancy way of saying that energy is always spreading out and becoming less useful.<kinrel><user>Est-ce qu'une fonction continu...
1. 打开设置:您可以通过 Windows 键 + I 快捷键打开设置。
2. 选择更新和安全:在设置菜单中,选择“更新和安全”。
3. 选择 Windows Update:在左侧菜单中选择“Windows Update”。
4. 点击更新设置:在“Windows Update”页面中,点击“更改计划设置”。
5. 禁用自动更新:在“计划设置”页面中,选择“不要计划安装”并点击“保存更改”。
请注意,禁用自动更新可能会影响您的系统的安全性和兼容性,因此请谨慎操作。<kinrel><user>如何从零开始写一套完整的区块链系统?<user><kinrel>從頭開始編寫一個完整的區塊鏈系統需要對區塊鏈技術的底層概念和組件有深刻的理解。
首先,您需要了解共識算法的工作原理以及哪些算法最適合您正在構建的應用程序。
接下來,您需要了解區塊鏈的組件,例如保護區塊鏈的節點、數據結構和加密算法。 您還需要了解如何從頭開始構建區塊鏈,包括共識算法及其組件的設計和實現。
此外,您需要構建一個系統來存儲和訪問區塊鏈中的數據,以及一個供用戶與區塊鏈交互的系統。
最後,您需要了解有關區塊鏈技術的法律以及構建完整區塊鏈系統的法律含義。 一旦這些基礎元素到位,您就可以開始開發區塊鏈系統,包括應用程序的代碼和架構。<kinrel><user>Welche verschiedenen Zählweisen des aktuellen Jahres gibt es?<user><kinrel>Im Gregorianischer Kalender, der in vielen Ländern der Welt verwendet wird, ist es 2023. Nach islamischer Zeitrechnung ist es das Jahr 1444. Nach dem Jüdisch...
Україна є 45 країною в світі за своєю площею.<kinrel><user>¿Podrías escribir un guion para un video de YouTube motivacional sobre el inicio del año nuevo?<user><kinrel>Claro, aquí está un guion para un video motivacional sobre el inicio del año nuevo:
Título: Aprovecha el Nuevo Año para Alcanzar tus Metas
Intro:
¡Bienvenido a nuestro video sobre motivación para el inicio del año nuevo!
El nuevo año es una oportunidad única para renovar nuestras metas y comenzar de nuevo.
Sección 1: Mira hacia atrás para avanzar
El primer paso para aprovechar el nuevo año es mirar hacia atrás en el año anterior.
Analiza tus logros y fracasos y aprende de ellos.