簡體   English   中英

statsmodel AttributeError: 模塊 'scipy.stats' 沒有屬性 'chisqprob'

[英]statsmodel AttributeError: module 'scipy.stats' has no attribute 'chisqprob'

我正在使用 statsmodel 0.8.0 運行下面的代碼,我認為這是最新的。

import statsmodels.api as sm
est = sm.Logit(y_train, x_train)
result = est.fit()
print(result.summary())

這給了我一個錯誤說:

AttributeError: 模塊 'scipy.stats' 沒有屬性 'chisqprob'。

我似乎無法在 stackoverflow 或其他地方找到任何東西來解決這個問題。 非常感謝任何幫助。

我有同樣的問題,但這解決了它。 但是,您首先需要從 scipy 導入統計信息。

stats.chisqprob = lambda chisq, df: stats.chi2.sf(chisq, df)

希望對你有幫助。

你有兩個選擇。 無論使用,

> result.summary2()

或者您可以導入 chisqprob。

> from scipy import stats

> stats.chisqprob = lambda chisq, df: stats.chi2.sf(chisq, df)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM