Primary competition visual

Radiant Earth Spot the Crop Hackathon by #ZindiWeekendz

Helping South Africa
$300 USD
Challenge completed over 4 years ago
Classification
Earth Observation
81 joined
21 active
Starti
Jul 02, 21
Closei
Jul 04, 21
Reveali
Jul 04, 21
Dimension Eerror
Help · 3 Jul 2021, 22:32 · 9
X = np.append(X, X_tile,axis=0
-------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-28-13bb3597cf91> in <module>()
     26             X_tile = np.append(X_tile, vh_array, axis = 1)
     27 
---> 28         X = np.append(X, X_tile,axis=0)
<__array_function__ internals> in append(*args, **kwargs)
/usr/local/lib/python3.7/dist-packages/numpy/lib/function_base.py in append(arr, values, axis)
   4669         values = ravel(values)
   4670         axis = arr.ndim-1
-> 4671     return concatenate((arr, values), axis=axis)
   4672 
   4673
<__array_function__ internals> in concatenate(*args, **kwargs)
ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 1 dimension(s) and the array at index 1 has 2 dimension(s)
Discussion 9 answers

Did you modify the value of n_obs? The shape of X depends on n_obs.

4 Jul 2021, 03:04
Upvotes 0

no, I didn't what is the optimal value to take !

User avatar
DoubleAgent
Carnegie mellon university africa

I noticed a closing bracket missing in your initial worry. I will suggest inserting a break statement after X = np.append(X, X_tile, axis=0) so that we don't have to wait for long for all the data to be loaded and checking X.shape and X_tile.shape given that these two must be of the same number of columns for an append to work.

For an optimal n_obs, there is likely an optimal value which can likely be ascertained only via trial and error. To know the number of independent variables you have, I will suggest focusing on the shape X.shape[0] from the initialization X = np.empty((0, 2 * (n_obs - 1))

Edit

X,shape to X.shape

you can use all of them by optimizing the loading of tif files using apply functions and custom ones. But for your issue, you should look for the reason why you have one dimension in X instead of 2*(5-1)=8

yes the closing backet is not missing just I forget to copy it also I have initialize my n_obs=5 but it give me this error

User avatar
DoubleAgent
Carnegie mellon university africa

Okay. What are your values for X.shape and X_tile.shape?

X shape= (0, 8) X_tile shape= (65536, 0)

User avatar
DoubleAgent
Carnegie mellon university africa

The append error is logical. number of columns in X = 8 != 0 = number of columns in X_tile

X_tile is generated from vv_array and vh_array. Can you check the shapes of these two?

User avatar
DoubleAgent
Carnegie mellon university africa

If you've not made several changes in your notebook, maybe getting a fresh notebook from this link will be best. Also, ensure that your MLHUB_API_KEY is active. It is possible you are not able to read any data, reason why X_tile has zero columns.