Docsity

Feature Engineering + Logistic Regression Handwritten Notes, Study notes of Technology

Partial preview of the text

Download Feature Engineering + Logistic Regression Handwritten Notes and more Study notes Technology in PDF only on Docsity!

= Feahike. Engineexing : : Fage ee ° Encoding Cotegontcal Vasttables ° Greate Useful Dexived Features * Interaction Features . ° Sealing Noumexic Features . * Featune Selection —> One thot Encoding : One hot Encoding fs a technique used to convert categorical data into numenical form So ML models can understand it. Each Cobegory is represented as a Pincay Vector where 1 means present and O mean absent. Ex-: Gendex = male, female = Gendex | male| Female : male L ie) = Female} © af i] => > Dummy Vas fable trap: = The dummu Vaxtable trap oceurs when all dummy = Vastfables axe included causing eee To aveid it, we drop one dummy Vaxiable . ad Ex: Gclost- Red, Blue, Qrean = yerena = CDummy voriable trap): = Red, Blue, Green ——] Connect > aucid trae Red, Blue == Caneen ts implied whan both are O) == = Greote Useful Derived Feotwras t- Derived Features ane neo Featurcs created From existing data to Improve model performance and captuxe hidden potterns. —] Ex: => 5g you have ‘Height’ and ‘Weigh’, Ee ger can create BMI= Weight ox a new Featuste . = ES +e Tnleraction Featusxw2: = Bn 3nteraction Feolune ts created by Combi nedion of two er more Feotunes to capture their jefnt effect on the target voxioalole . Ex: > Jf ‘hours studied’ and ‘Sleep Houxs’ affect manks, Thteraction Feotune = Hous Studied x SleepHours Vuuuu « test ace} 6S7. —> at Undertittng i= C model ts toosimple) = training mee | Foy, => High bray low Vaxtance Predicted Varo. Boe Pine overtitting ena Undexfitting : — Page no 4 bf ot Onder Prt ing. ee OT st complexity N° of Params T ho of newrons T no of layers 4 a eater > decrease Features — Inexease Data Addin more data doesnt help Ovexfitting - High Vaxtance no of Params { no of neuxons | Liyi2 vequlaxization | a decrease - does help + Requlaxizotion i> We use Regularization Page no S when we have a Condition of overfitting e Losso Regression Ci Regulaxizatfon) . Ridge Regression (Gu) Requlaxizetion) « ElasticNet C Combination of LL and L2) ar Lasso Regression es! Cost Fxn: Hos, Z (he (2 yo) + Az | 85] Where, A= Regulasization Strength > \63| = Penal %! fl enality # 1 should not be zero tn Lasso regression because A=0O vemoves the Regulaxtzation term, tuning it Tnto Stmple |tneost regression with no Feature. Selection. dt Cross- Validation :- Cross- validation checks how well your model generalizes by training and testing it maltiple times on different data splits Insteacl of betting your entire Career on one lucky split. logistic Regression [Page no: 7 | : Logistic Regaession ts a classification algorithm used e to predict binary outcomes (0/1) by passing a Lineor a Combination of featores through a Stgmoid Fonction, which @ output prababili-Hes between O and 1. I+ uses log lox, eS Tnsteod of mean Squeed Error. * Why we use Logistic Regsession instead of Logistic Reg? 1) Linear Regression can give values < 0 or > 1 CProbability goes insane) 2) Logistic Regstession keaps outputs between 0 and 1. 3) Better suited for Classification Probability . + Sigmoid Fen: — Tt fs mathematical Fun thet converts any veal value into a number behseen O and 4. - T+ has an S- Shapedl curve and is commonly, used Tn logistic regression to represent Probability. Formola: 4 \ ie -— e.e Eulers number ey ae e = 2.418 AA NAAHAAHHAANHAAARANAA AN AAA AA FeseTvre geetsvorwee es eT eeetewTeeeeeeeevee sé Gi Logistic Regression Why = - Page no: 8 | + Keeps output between O and 1 ( Probability- friendly) + Smooth and Attferentiable ~ easy to optimize. + Hypothesis Fxn for logistic Reg :- the lod= g (Got 6, %1) fe a SS Lt e-(@ot 81 X1) Se Gost Fxne Ue ies fs. = Chel yoy 2m ce non- Convex Corve AHAHAAAAAANAARAAA we don't use the normal Mean Squared Error (MSE) cost functiongs in logistic wegression because it makes the cost Fxn non-convex leading to multiple local. minima. This makes optimization unstable and gracient descent unreliable. Instead, log loss (cross -entropy) rs usect because i} produces a convex cost function and Penolizes wrong conpident peecliction more eftectively. Annan