All Questions
164 questions
0
votes
0
answers
54
views
I am having a error with shape alignment, how can I solve this?
This is the code for a self playing game with a feedforwrd only neural network. I am gettin a error with the shapes alignment and I'm not being able to solve it
setup.py:
import pygame
import os
...
0
votes
1
answer
81
views
Implementing a perceptron using numpy [closed]
I'm trying to implement a perceptron in python using numpy, when using the notation z=XW+b everything is fine. While studying ML I do see though that z=WX+b is also common, especially when talking ...
0
votes
0
answers
103
views
Regression in Custom Neural Network giving same output for all inputs
I have recently started studying Neural Network and thought about writing my own Neural Network before using libraries like tensorflow or pytorch so that I understand deeply what happens inside the ...
1
vote
1
answer
63
views
Get directional elements in matrix
Lets suppose that I have a point of interest in my matrix that is NxN. The point is located in the position ij. So, given the index ij, is there a simple way to get the line elements passing trough ij ...
1
vote
0
answers
34
views
Value Error in code for neural network approximation
import numpy as np
import matplotlib.pyplot as plt
# Define the target function f(x) = sin(x)^2
def f(x):
return np.sin(x)**2
# Generate training dataset
np.random.seed(0) # For reproducibility
...
1
vote
0
answers
35
views
Neural Network backpropagation algorithm only partially training in python
I am writing a neural network to identify digits from the MNIST database. It's primarily based on this code https://github.com/SebLague/Neural-Network-Experiments
My neural network appears to be ...
-1
votes
1
answer
58
views
Matrix multiplication error when I tried to build the neural network from scratch
When I learned about mathematical working of neural network I tried to build it from scratch using Numpy. The neural network structure I tried to build was input_layer with 3 nodes -> ...
2
votes
3
answers
411
views
How can I fix my perceptron to recognize numbers?
My exercise is to train 10 perceptrons to recognize numbers (0 - 9). Each perceptron should learn a single digit. As training data, I've created 30 images (5x7 bmp). 3 variants per digit.
I've got a ...
0
votes
2
answers
347
views
How to train a network with two or more layers
I am implementing a neural network from scratch using python. I have a Neuron class, layer class and network class.
I have managed to train and use a network with 1 layer, 1 Neuron and 3 inputs.
I now ...
1
vote
2
answers
166
views
Implementation of Perceptron algorithm, but not efficent when I run it
When the sample size is set to 10, the average number of iterations until convergence should be around 15. However, when implementing the algorithm in my code, it takes approximately 225(or more!) ...
1
vote
0
answers
94
views
Trying to solve MNIST problem using only numpy, but have accuracy near 10%
I traing to solve MNIST problem using only numpy but have accuracy 10%
Read data and normalizing
import numpy as np
from sklearn.preprocessing import MinMaxScaler
import pandas as pd
import os
import ...
1
vote
0
answers
55
views
Why is the efficiency of my neural network code reducing and what is causing the issue?
I am trying to implement a simple neural network from scratch to classify images from the MNIST dataset. However, I have noticed that the efficiency of the code decreases as I try to train the network ...
1
vote
1
answer
733
views
How to compute batch-wise Jacobians using vmap in JAX?
I want to solve a 2D-differential equation using neural network and working with the JAX library. The neural network function I am using basically approximates the function u = f(x,y) and goes ...
0
votes
1
answer
83
views
I found some code on the internet about a neural network that trains it to whether a number is odd or even but I keep getting `ValueError`
I found some interesting code on the internet but for some reason it isn't working I keep getting this error:
Loss at iteration 0: 0.3568797210347673
Traceback (most recent call last):
File "d:\...
-3
votes
1
answer
241
views
calculate gradient for Contrastive loss
I have come across this loss function
L = y*d**2 + (1-y)*max(margin-d,0)**2
is it possible to calculate the gradient of this type of loss with max function in the function, if yes how should it be ...