Encountering a strange error using the SpaceNetRegressor fit function. My input is a list of images
y_train and an array of scalars
X_train. Each are the same length. All the images are correct and the same dimensions.
Here’s my (simplified) code:
decoder = SpaceNetRegressor(mask=V_img, penalty=params_snet['penalty'], eps=params_snet['eps'], # prefer large alphas memory=params_snet['memory']) istrain = train_set[:,f] y_train = Xs[glm][istrain][:,0] X_train = np.array(V_betas) X_train = list(X_train[istrain]) print(len(X_train)) print(y_train.size) print(X_train.shape) decoder.fit(X_train, y_train)
The output is:
120 120 (182, 218, 182) [NiftiMasker.fit] Loading data from None [NiftiMasker.fit] Resampling mask /Users/lpzatr/anaconda3/lib/python3.6/site-packages/nilearn/_utils/cache_mixin.py:291: UserWarning: memory_level is currently set to 0 but a Memory object has been provided. Setting memory_level to 1. warnings.warn("memory_level is currently set to 0 but " /Users/lpzatr/anaconda3/lib/python3.6/site-packages/nilearn/decoding/space_net.py:195: RuntimeWarning: divide by zero encountered in log10 return np.logspace(np.log10(alpha_min), np.log10(alpha_max), /Users/lpzatr/anaconda3/lib/python3.6/site-packages/numpy/core/function_base.py:117: RuntimeWarning: invalid value encountered in double_scalars delta = stop - start /Users/lpzatr/anaconda3/lib/python3.6/site-packages/nilearn/decoding/proximal_operators.py:20: RuntimeWarning: invalid value encountered in maximum shrink[y_nz] = np.maximum(1 - alpha / np.abs(y[y_nz]), 0) /Users/lpzatr/anaconda3/lib/python3.6/site-packages/nilearn/decoding/space_net.py:274: RuntimeWarning: invalid value encountered in reduce if w.ptp() == 0: ... ~/anaconda3/lib/python3.6/site-packages/scipy/stats/mstats_basic.py in spearmanr(x, y, use_ties) 457 df = n-2 458 if df < 0: --> 459 raise ValueError("The input must have at least 3 entries!") 460 461 # Gets the ranks and rank differences ValueError: The input must have at least 3 entries!
Any idea where to look for issues? No idea why the input is less than 3 entries at this point.