I have a function that takes 2 parameters and returns a shape of an array. where the function that will create a Numpy array of a given shape with random values.
The output should be like this: array([[0.37454012], [0.95071431], [0.73199394]])
, but I got it like this: arrayarray([[0.37454012, 0.95071431, 0.73199394]]))
.
What is the methoud that I can use to return it like this: ([[0.37454012], [0.95071431], [0.73199394]])
For example, initialise_array(3,1)
will return an array of dimensions (3,1)
that can look like this:
array([[0.37454012], [0.95071431], [0.73199394]])
My code:
def initialise_array(n_features, n_observations):
shape = np.random.rand(n_features, n_observations)
n_shape = shape.reshape(n_observations, n_features)
return n_shape
The output looks like array([[0.85546058, 0.70365786, 0.47417383]])
but I need to match the this array([[0.37454012], [0.95071431], [0.73199394]])