python错误中的重新示例()



我正在捡起python ....尝试使用重新样本并以下错误引用https://elitedatascience.com/imbalanced-classes

from sklearn.utils import resample
df_majority = df[df.balance==0]
df_minority = df[df.balance==1]
#Upsample minority class
df_minority_upsampled = resample(df_minority, 
                                 replace=True,     # sample with replacement
                                 n_samples=576,    # to match majority class
                                 random_state=123) # reproducible results
=================
Error:
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
  File "C:Anaconda3libsite-packagessklearnutils__init__.py", line 253, in resample
    max_n_samples, n_samples))
ValueError: Cannot sample 576 out of arrays with dim 49

感谢任何帮助...指针..谢谢你

P.S:我正在使用Zeppelin笔记本尝试一下。

我确定它与您的Sklearn版本有关。 assert sklearn.__version__ >= 0.18可能会导致例外情况。:)

相关内容

  • 没有找到相关文章

最新更新