Regressiemodellen

Statistiek-vragen voor sollicitaties oefenen in Python

Conor Dewey

Data Scientist, Squarespace

Aan de slag

  Gecorreleerde spreidingsplot

1 Wikimedia
Statistiek-vragen voor sollicitaties oefenen in Python

Aannames

  • Lineair verband
  • Fouten zijn normaal verdeeld
  • Homoscedasticiteit
  • Onafhankelijke observaties
Statistiek-vragen voor sollicitaties oefenen in Python

Lineaire regressie

Lineaire fit

1 Wikipedia
Statistiek-vragen voor sollicitaties oefenen in Python

Lineaire regressie

Formule voor lineaire regressie

Statistiek-vragen voor sollicitaties oefenen in Python

Voorbeeld: lineaire regressie

from sklearn.linear_model import LinearRegression 
lm = LinearRegression()
lm.fit(X_train, y_train)
LinearRegression(copy_X=True, fit_intercept=True, 
                    n_jobs=None, normalize=False)
Statistiek-vragen voor sollicitaties oefenen in Python

Voorbeeld: lineaire regressie

coef = lm.coef_
print(coef)
[0.79086669]
Statistiek-vragen voor sollicitaties oefenen in Python

Logistische regressie

  Logistische regressie, gevisualiseerd

1 Wikimedia
Statistiek-vragen voor sollicitaties oefenen in Python

Logistische regressie

  Sigmoïdefunctie

Statistiek-vragen voor sollicitaties oefenen in Python

Voorbeeld: logistische regressie

from sklearn.linear_model import LogisticRegression
clf = LogisticRegression(solver='lbfgs')
clf.fit(X_train, y_train)
LogisticRegression(C=1.0, class_weight=None, 
                   dual=False, fit_intercept=True, 
                   intercept_scaling=1,
                   max_iter=100, multi_class='warn',
                   n_jobs=None, penalty='l2',
                   random_state=None, solver='lbfgs',
                   tol=0.0001, verbose=0, 
                   warm_start=False)
Statistiek-vragen voor sollicitaties oefenen in Python

Voorbeeld: logistische regressie

coefs = clf.coef_
print(coefs)
[[0.4015177  3.85056451]]
accuracy = clf.score(X_test, y_test)
print(accuracy)
0.8583333333333333
Statistiek-vragen voor sollicitaties oefenen in Python

Samenvatting

  • Herhaling
  • Aannames
  • Lineaire regressie
  • Logistische regressie
Statistiek-vragen voor sollicitaties oefenen in Python

Laten we ons voorbereiden op het interview!

Statistiek-vragen voor sollicitaties oefenen in Python

Preparing Video For Download...