All Questions
89 questions
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
...
0
votes
1
answer
46
views
Training Loop of RNN returning the same loss after each epoch
I am trying to build a RNN from scratch, with the help of this repository (https://github.com/nicklashansen/rnn_lstm_from_scratch/tree/master), but the training loss after each epoch stays the same. ...
1
vote
0
answers
89
views
Problem with implementing 2 layer Neural Network using numpy
I tried creating a neural network with 2 layers using numpy only. My algorithm outputs the same value for all the Y's
What is my mistake?
text
Here is dataset i used
First layer has 2 neurons with ...
0
votes
1
answer
96
views
I'm getting an error while running this code snippit. I seems like the code is unable to create the numpy array.I think it's running an infinite loop
cap = cv2.VideoCapture(0)
# Set mediapipe model
with mp_holistic.Holistic(min_detection_confidence=0.5, min_tracking_confidence=0.5) as holistic:
# NEW LOOP
# Loop through actions
...
0
votes
1
answer
227
views
Tensorflow: Shape of 3D tensor (of an image) in Filter has None
I am following this tutorial on tensorflow.org.
I have folder images with two folders cat and dog in it. Following above tutorial I am trying to convert .jpg and .png images to features (NumPy array) ...
0
votes
0
answers
268
views
Gradient and Loss function
I could not understand well especially how gradients were computed with regards to matrix transposes. My question is for DW2 but if you want also to discuss about the computation of the other ...
0
votes
1
answer
46
views
TensorFlow - ValueError: Input 0 is incompatible with layer model_26: expected shape=(None, 2412, 3, 1), found shape=(None, 3, 1)
I'm new to ML and trying to write a neural network to for prediction, but I just can't solve the ValueError. I have looked up to different answers but still get the same error. How to fix this?
...
3
votes
1
answer
2k
views
jax.lax.select vs jax.numpy.where
Was taking a look at the dropout implementation in flax:
def __call__(self, inputs, deterministic: Optional[bool] = None):
"""Applies a random dropout mask to the input.
Args:
...
0
votes
1
answer
50
views
Python 3 | ValueError: shapes (2040,21) and (2040,2040) not aligned: 21 (dim 1) != 2040 (dim 0)
I am working on a Neural Language Model with the below code, and encountered this error:
Traceback (most recent call last):
File "main.py", line 99, in <module>
neural_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 ...
-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 ...
-1
votes
1
answer
672
views
What is the correct order np.dot(inputs, weights) or np.dot(weights, inputs)?
import numpy as np
inputs = [1, 2, 3, 4]
weights = [[0.3, 0.5, 0.2, -0.5],
[1.0, 0.2, -1, 0.5],
[1.0, 2.0, 3.0, 2.5],
[2.0, 5.0, -1.0, 2.0],
[-1.5, 2.7, 3....
1
vote
1
answer
809
views
Torch running out of memory issues
Using Torch, I am trying to load a large set of images into the program. But as I approach 50'000 images the kernel starts to crash which I assume is due to memory limitation. A minimal example of my ...
-1
votes
1
answer
386
views
Why model.fit() method of keras do not accept any tensor as feature or label argument, on the other hand it accepts numpy arrays
Last time when I was training a dnn model I noticed that When I try to train my model with tensor (dtype = float64) it always gives error but when I train the model with numpy array with same specs(...
0
votes
1
answer
158
views
Why is binary classification network not converging?
I have created a binary classification neural network from scratch using ReLu for hidden layers, sigmoid for my final layer and the binary cross entropy loss function, I also use minibatch gradient ...