लिनियर क्लासिफ़ायर्स: प्रेडिक्शन इक्वेशंस

Python में Linear Classifiers

Michael (Mike) Gelbart

Instructor, The University of British Columbia

Dot Products

x = np.arange(3)
x
array([0, 1, 2])
y = np.arange(3,6)
y
array([3, 4, 5])
x*y
array([0, 4, 10])
np.sum(x*y)
14
x@y
14
  • x@y को x और y का dot product कहते हैं, और इसे $x \cdot y$ लिखते हैं।
Python में Linear Classifiers

लिनियर क्लासिफ़ायर प्रेडिक्शन

  • $\textrm{raw model output} = \textrm{coefficients} \cdot \textrm{features} + \textrm{intercept}$
  • लिनियर क्लासिफ़ायर प्रेडिक्शन: raw output निकालें, sign जाँचें
    • positive हो तो एक class प्रेडिक्ट करें
    • negative हो तो दूसरी class प्रेडिक्ट करें
  • यह logistic regression और linear SVM दोनों में समान है
    • fit अलग है, पर predict एक जैसा है
Python में Linear Classifiers

LogisticRegression प्रेडिक्शन कैसे करता है

$\textrm{raw model output} = \textrm{coefficients} \cdot \textrm{features} + \textrm{intercept}$

lr = LogisticRegression()

lr.fit(X,y)

lr.predict(X)[10]
0
lr.predict(X)[20]
1
Python में Linear Classifiers

LogisticRegression प्रेडिक्शन कैसे करता है (जारी)

lr.coef_ @ X[10] + lr.intercept_ # raw model output
array([-33.78572166])
lr.coef_ @ X[20] + lr.intercept_ # raw model output
array([ 0.08050621])
Python में Linear Classifiers

Raw model output

Python में Linear Classifiers

Raw model output

Python में Linear Classifiers

Raw model output

Python में Linear Classifiers

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

Python में Linear Classifiers

Preparing Video For Download...