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.
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 4 days ago.
Improve this question
multi inputs in python
write a program to take X and Y as input and out put the string x ,repeated y times.
sample input
hi
3
sample output
hi hi hi
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’ve loaded a sample using the code:
Data = np.load(sample_1.npy)
I need to convert the data points from H/T (coin tosses) to 0/1 (binary array). Not sure what code would work for this? I’ve tried googling answers and they haven’t worked.
If it's an array with "H" and "T" as values, you could try that:
Data = np.array([0 if x == "H" else 1 for x in Data])
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 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))
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).