Closed alexHeu closed 4 years ago
Would the following way be appropriate to achieve this?
I think your sample_indices
trick could keep the ordering for undersampling.
Is this expected behavior? Intuitively, it would make sense to me to keep the original ordering intact.
n
times)Therefore it's unlikely to provide a fixed ordering in general.
Do you have a use-case that strongly requires a fixed ordering?
I am closing since this is a usage question
Hi,
I have a question regarding the resulting sample ordering after using the RandomUnderSampler.
Currently, I run the sampling as follows:
X_resampled, y_resampled = sampler.fit_resample(X_train, y_train)
However, when looking at the result, I saw that all positive samples are placed after the negative ones:
plt.plot(y_resampled)
:Is this expected behavior? Intuitively, it would make sense to me to keep the original ordering intact.
Would the following way be appropriate to achieve this?
sample_indices = np.sort(sampler.sample_indices_)
X_resampled = X_train[sample_indices]
y_resampled = y_train[sample_indices]
best regards Alex