Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I'm trying to solve the OpenAI gym Breakout-V0 with a Deep Q-Network Agent.
Every time when my agent reaches the point where:
The replay_memory is filled enough to start training
The copy_target_network interval is reached for the first time
The target_network predicts for the fist time
Tensorflow throws following error:
Error when checking input: expected dense_3_input to have shape (33600,) but got array with shape (1,)
When I print the shape of the incoming state array just 1 line before i call the predict(state), it confirms that the shape of state is (33600,)
Before this error is shown the model is able to predict_on_batch() inside the training loop with the exact same data (but batched)
Does anybody know how to solve this? I can gladly give more details and information if I'm missing any
Versions:
Python 3.8.7
TensorFlow 2.4.1
Gym 0.18.0
As Dr.Snoopy said, it's a simple solution
Just had to do np.reshape(state, (1, 33600))
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed last year.
Improve this question
I have got a training dataset of 1,000 images but while compiling my code, I came across this error;
Error: ValueError: Empty training data?
What's the possible solution? Thanks
The issue is that there is no validation or test dataset in your directory. Ensure you have data in your validation directory.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I have two array one with shape (320,1) and one with (850,1) how should I combine the two array. I tried np.append however it seems to be an error.
Assuming the two arrays are called arr1 and arr2, you could try the following code:
arr3 = np.append(arr1,arr2).reshape((-1,1))
The reshape is needed to make sure the final shape is (1170,1) instead of (1170,)
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I'm trying to get the element-wise mulitplication using normal *, and i tried np.multiply(), both give a weird answers.
now (1-y) is (100,) and np.log(1-sigmoid(np.dot(X,theta)))) is (100,1), so when i muliply them by element-wise, it should give (100,1); but it gives me (100,100) matrix(ALL are higlighted BLUE)
Here is my original function if it can help.
Can anyone help me with getting the source of erre here?
I'm not 100% sure why python does this, but the way to solve it would be to apply np.reshape((1-y),(100,1)) and then apply np.multiply(). In general it's always better to reshape your arrays and to give them a second dimension.
EDIT: This explains how numpy does the broadcasting when using an array of dimensions (n,) and (n,1).
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
For the above image, the regression lines are scribbled around and i don't know why? any help would be great.
I believe the issue here is that you are passing in data['size'], which is not sorted and goes between a value on the left and then to the right. The plt.plot always connects points, which is why you get squiggly line back and forth.
Now if this is a simple y = a + bx then I would recommend that you pass in an x input (e.g., x_range = [min(data['size']), max(data['size']) that is the minimum and maximum of data['size']. Then define yhat_no, yhat_yes, and yhat accordingly with x_range.
However, I see that you have a dependence data['year'], so the expectation of a single linear line will not happen.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I'm getting the following error when I try to build my kernel.
Openturns error
Can anyone help?
The build only takes a Sample object. You have to convert your numpy array:
import openturns as ot
import numpy as np
sample = ot.Sample(np.array([(1.0, 2.0), (3.0, 4.0), (5.0, 6.0)]))
For the conversion to happen, your data need to have the proper shape: (n_sample, dimension)
In this example, we have 3 sample and the dimension is 2.