मॉडल फिट की व्याख्या

Python में Generalized Linear Models

Ita Cirovic Donev

Data Science Consultant

पैरामीटर का आकलन

  • Maximum likelihood estimation (MLE)
  • Iteratively reweighted least squares (IRLS)
Python में Generalized Linear Models

रिस्पॉन्स फंक्शन

  • Poisson regression मॉडल $$ log(\lambda)=\beta_0+\beta_1x_1 $$

  • रिस्पॉन्स फंक्शन: $$ \lambda=exp(\beta_0 + \beta_1x_1) $$                                                  or $$ \lambda=exp(\beta_0) \times exp(\beta_1x_1) $$

Python में Generalized Linear Models

रिस्पॉन्स फंक्शन

  • Poisson regression मॉडल $$ log(\lambda)=\beta_0+\beta_1x_1 $$

  • रिस्पॉन्स फंक्शन: $$ \lambda=exp(\beta_0 + \beta_1x_1) $$                                                  or $$ \lambda=exp(\beta_0) \color{red}{\times} exp(\beta_1x_1) $$

Python में Generalized Linear Models

पैरामीटर की व्याख्या

  • $exp(\beta_0)$

    • जब $x=0$ हो तो औसत $\lambda$ पर प्रभाव
  • $exp(\beta_1)$

    • $x$ में 1-यूनिट बढ़त पर औसत $\lambda$ पर गुणात्मक प्रभाव
Python में Generalized Linear Models

कोएफ़िशिएंट प्रभाव की व्याख्या

  • यदि $\color{#FF550D}{\beta_1 > 0}$
    • $exp(\beta_1)>1$
    • $x=0$ की तुलना में $\lambda$ $\color{#FF550D}{exp(\beta_1)\text{ गुना बड़ा}}$ है
  • यदि $\color{#D04A73}{\beta<0}$
    • $exp(\beta_1)<1$
    • $x=0$ की तुलना में $\lambda$ $\color{#D04A73}{exp(\beta_1) \text{ गुना छोटा}}$ है
  • यदि $\color{#0099FF}{\beta_1 = 0}$
    • $exp(\beta_1)=1$
    • $\lambda=exp(\beta_0)$
    • गुणात्मक फ़ैक्टर 1 है
    • $y$ और $x$ $\text{\color{#0099FF}{संबंधित नहीं}}$ हैं
Python में Generalized Linear Models

उदाहरण

model = glm('sat ~ weight', data = crab, 
            family = sm.families.Poisson()).fit()
                 Generalized Linear Model Regression Results (print cut)                 
=============================================================================
                 coef    std err          z      P>|z|      [0.025     0.975]
-----------------------------------------------------------------------------
Intercept     -0.4284      0.179     -2.394      0.017      -0.779     -0.078
weight         0.5893      0.065      9.064      0.000       0.462      0.717
=============================================================================
Python में Generalized Linear Models

उदाहरण - बीटा की व्याख्या

  • मॉडल कोएफ़िशिएंट निकालें
    model.params
    
Intercept   -0.428405
weight       0.589304
  • प्रभाव गणना करें
    np.exp(0.589304)
    
1.803
Python में Generalized Linear Models

कॉन्फिडेंस इंटरवल किसके लिए...

  • $\beta_1$
print(model.conf_int())
                  0         1
Intercept -0.779112 -0.077699
weight     0.461873  0.716735
  • औसत पर गुणात्मक प्रभाव
print(np.exp(crab_fit.conf_int()))
                  0         1
Intercept  0.458813  0.925243
weight     1.587044  2.047737
Python में Generalized Linear Models

अभ्यास करते हैं!

Python में Generalized Linear Models

Preparing Video For Download...