logo
Loading...

使用KDE分析出現ZeroDivisionError: 0.0 cannot be raised to a negative power錯誤 - Cupoy

針對每個columns屬於int64與float64 , 進行 KDE分析numeric_colum...

ml100-5,d13,kde,amt_annuity

使用KDE分析出現ZeroDivisionError: 0.0 cannot be raised to a negative power錯誤

2019/04/28 05:31 AM
機器學習新手論壇
陳秉涵
觀看數:0
回答數:2
收藏數:0
ml100-5
d13
kde
amt_annuity

針對每個columns屬於int64與float64 , 進行 KDE分析

numeric_columns = list(app_train.columns[list(app_train.dtypes.isin([np.dtype('int64'),np.dtype('float64')]))])

import seaborn as sns 

for col in numeric_columns:     

    plt.figure(figsize = (10, 8))     

    value = app_train[col].values     

    sns.kdeplot(( value - np.mean(value) ) / ( np.std(value) ), label = col)     

    plt.show()

當跑到 'AMT_ANNUITY' 下列出現錯誤, 請問可能的原因 ?


C:\Users\pingh\Anaconda3\lib\site-packages\statsmodels\nonparametric\kde.py:448: RuntimeWarning: invalid value encountered in greater   X = X[np.logical_and(X > clip[0], X < clip[1])] # won't work for two columns. 

C:\Users\pingh\Anaconda3\lib\site-packages\statsmodels\nonparametric\kde.py:448: RuntimeWarning: invalid value encountered in less   X = X[np.logical_and(X > clip[0], X < clip[1])] # won't work for two columns. 

C:\Users\pingh\Anaconda3\lib\site-packages\numpy\core\_methods.py:140: RuntimeWarning: Degrees of freedom <= 0 for slice   keepdims=keepdims) 

C:\Users\pingh\Anaconda3\lib\site-packages\numpy\core\_methods.py:110: RuntimeWarning: invalid value encountered in true_divide   arrmean, rcount, out=arrmean, casting='unsafe', subok=False) C:\Users\pingh\Anaconda3\lib\site-packages\numpy\core\_methods.py:132: RuntimeWarning: invalid value encountered in double_scalars   ret = ret.dtype.type(ret / rcount) 

C:\Users\pingh\Anaconda3\lib\site-packages\statsmodels\nonparametric\bandwidths.py:20: RuntimeWarning: invalid value encountered in minimum   return np.minimum(np.std(X, axis=0, ddof=1), IQR) 

--------------------------------------------------------------------------- ValueError  

 ZeroDivisionError: 0.0 cannot be raised to a negative power