2017-05-01 1 views
0

私はデータサイエンスを初めて利用しています。シボーンの単純な因子プロットに関する質問があります。線分は何を表していますか?シーボーン因子プロットのソース関数は何ですか?

ここは私のテストです。

import pandas as pd 
import seaborn as sns 

x3 = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5] 
y3 = [0, 1, 1, 1, 0, 3, 1, 0, 1, 1, 3, 2, 3, 2, 3, 3, 2, 3, 2, 2] 
data = {'x': x3, 'y': y3} 
test3 = pd.DataFrame(data) 
sns.factorplot(x='Pclass', y='Survived', data=test3) 

その結果、この単純な試験により

enter image description here

あり、Iは、グラフの各点は同じ値を使用して、xのすべての値に対して、yの平均値(EXP)を意味することを知っています。例えば、x = 1の場合、(1,0)、(1,3)、(1,3)、(1,3)となるので、平均は(0 + 3 + 3 + 3)/ 4 = 2.25。しかし、x = 1の線分が0.75から3.0までの理由は分かりませんが、それはなぜ[0.0、3.0]ですか?

私はfactorplotのソースや有用な説明やオンラインのdocuを見つけようとしましたが、良い結果は得られませんでした。

誰でも助けてくれますか、ありがとうございます。

答えて

1

github repoの上部にある「このリポジトリを検索する」検索バーを使用して調べました。 「factorplot」の検索

は「」「バーで表示する点推定値と信頼区間を」「」のdocstringた、_BarPlotter(_CategoricalStatPlotter)に私を導いた、seaborn/categorical.pyclass _CategoricalPlotter(object)に私を導いた、そしてそれは__init__self.estimate_statistic(estimator, ci, n_boot)が含まれています。

estimate_statistic(self, estimator, ci, n_boot)の関数定義は、class _CategoricalStatPlotter(_CategoricalPlotter)(categorical.pyファイル内にあります)にあります。そこでは、空のリストconfint(すなわち、信頼区間)は初期化され、充填されている:

boots = bootstrap(stat_data, func=estimator, 
             n_boot=n_boot, 
             units=unit_data) 
confint.append(utils.ci(boots, ci)) 

だから、あなたが言及した垂直誤差バーはbootstrapped confidence intervalsあります。

関連する問題