從複雜實驗提煉洞見

Python 的實驗設計

James Chapman

Curriculum Manager, DataCamp

製造產量資料

manufacturing_yield
 BatchID  MaterialType  ProductionSpeed  TemperatureSetting  YieldStrength
      39       Polymer           Medium             Optimal          58.83
     195         Metal             High                High          51.29
     462       Polymer             High             Optimal          55.15
     696     Composite           Medium                 Low          50.27
     142     Composite             High                 Low          57.62
  • 多因子設計:MaterialTypeProductionSpeedTemperatureSetting
  • 反應變數:YieldStrength
Python 的實驗設計

製造品質資料

manufacturing_quality
 BatchID ProductionSpeed  ProductQuality
     149             Low           93.87
     739            High           93.35
     617          Medium           90.45
     131            High           90.26
     684             Low           91.62
  • 設計:ProductionSpeed
  • 反應變數:ProductQuality
Python 的實驗設計

合併策略

merged_manufacturing = pd.merge(manufacturing_yield,
                       manufacturing_quality, 
                       on=['BatchID', 'ProductionSpeed'])
print(merged_manufacturing)
 BatchID  MaterialType  ProductionSpeed  TemperatureSetting  YieldStrength  ProductQuality
       1         Metal              Low                High          57.32           91.19
       5     Composite           Medium             Optimal          51.82           90.20
       7       Polymer              Low                High          56.12           91.66
       8     Composite             High             Optimal          50.91           93.05
      11       Polymer              Low                High          50.13           92.31
Python 的實驗設計

並排長條圖

import seaborn as sns
sns.catplot(x='MaterialType', y='YieldStrength', hue='ProductionSpeed', kind='bar', 
            data=merged_manufacturing)

分類長條圖

Python 的實驗設計

三變數散佈圖

sns.relplot(x='YieldStrength', y='ProductQuality', hue='ProductionSpeed', 
            kind='scatter', data=merged_manufacturing)
plt.title('Yield Strength vs. Product Quality by Production Speed')

依生產速度的抗拉強度與產品品質

Python 的實驗設計

向技術受眾傳達資料

 

  • 撰寫資料敘事
    • p 值
    • 檢定統計量
    • 顯著水準
  • 視覺化複雜資料
    • 熱圖
    • 多色散佈圖
    • 投影

向技術受眾簡報

Python 的實驗設計

用資料吸引非技術受眾

 

  • 化繁為簡的資料洞見
    • 基本視覺化:長條圖、折線圖
  • 準備以受眾為中心的簡報
    • 為何這些資料重要?
    • 將洞見連結到實務應用

資料說故事

Python 的實驗設計

一起來練習吧!

Python 的實驗設計

Preparing Video For Download...