<jupyter_start><jupyter_text>相關係數一樣，pandas 很貼心地讓我們可以非常容易計算相關係數<jupyter_code>app_train.corr()['TARGET']<jupyter_output><empty_output><jupyter_text>練習時間列出目標 (TARGET) 與所有欄位之間相關係數，數值最大以及最小各 15 個通過相關係數的結果觀察有興趣的欄位與 TARGET 或其他欄位的相關係數，並嘗試找出有趣的訊息- 最好的方式當然是畫圖，舉例來說，我們知道  EXT_SOURCE_3 這個欄位和 TARGET 之間的相關係數是 -0.178919 (在已經這個資料集已經是最負的了！)，那我們可以 EXT_SOURCE_3  為 x 軸， TARGET 為 y 軸，把資料給畫出來<jupyter_code>corr_df = app_train.corr()
max_values = corr_df['TARGET'].sort_values(ascending=False)[:15]
min_values = corr_df['TARGET'].sort_values(ascending=False)[-15:]

print('--- The top15 maxinum and minimum ---')
for var1, i, var2, j in zip(max_values.index, max_values, min_values.index, min_values):
    print('{}: {:.3f} ||| {}: {:.3f}'.format(var1, i, var2, j))

plt.plot(app_train['EXT_SOURCE_3'], app_train['TARGET'], '.')
plt.xlabel('EXT_SOURCE_3')
plt.ylabel('TARGET')
plt.show()<jupyter_output>--- The top15 maxinum and minimum ---
TARGET: 1.000 ||| AMT_GOODS_PRICE: -0.040
DAYS_EMPLOYED: 0.075 ||| HOUSETYPE_MODE_block of flats: -0.041
REGION_RATING_CLIENT_W_CITY: 0.061 ||| EMERGENCYSTATE_MODE_No: -0.042
REGION_RATING_CLIENT: 0.059 ||| FLOORSMAX_MODE: -0.043
NAME_INCOME_TYPE_Working: 0.057 ||| FLOORSMAX_MEDI: -0.044
DAYS_LAST_PHONE_CHANGE: 0.055 ||| FLOORSMAX_AVG: -0.044
CODE_GENDER_M: 0.055 ||| DAYS_EMPLOYED_ANOM: -0.046
DAYS_ID_PUBLISH: 0.051 ||| ORGANIZATION_TYPE_XNA: -0.046
REG_CITY_NOT_WORK_CITY: 0.051 ||| NAME_INCOME_TYPE_Pensioner: -0.046
NAME_EDUCATION_TYPE_Secondary / secondary special: 0.050 ||| CODE_GENDER_F: -0.055
FLAG_EMP_PHONE: 0.046 ||| NAME_EDUCATION_TYPE_Higher education: -0.057
REG_CITY_NOT_LIVE_CITY: 0.044 ||| DAYS_BIRTH: -0.078
FLAG_DOCUMENT_3: 0.044 ||| EXT_SOURCE_1: -0.155
OCCUPATION_TYPE_Laborers: 0.043 ||| EXT_SOURCE_2: -0.160
DAYS_REGISTRATION: 0.042 ||| EXT_SOURCE_3: -0.179
{'fraction_non_alphanumeric': 0.15077605321507762, 'fraction_numerical': 0.0837028824833703, 'mean_word_length': 6.746781115879829, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '339373', 'license': 'MIT', 'n_tokens_mistral': 1060, 'n_tokens_neox': 973, 'n_words': 125, 'path': 'Day_010_HW.ipynb', 'repo_name': 'hengbinxu/ML100-Days', 'size': '1804'}