0% found this document useful (0 votes)
8 views12 pages

Machine Learning

The document discusses various statistical and machine learning models, including qualitative response models, logistic regression, and Naive Bayes classification. It covers concepts such as maximum likelihood estimation, gradient descent, and natural language processing techniques like tokenization and word embeddings. Additionally, it highlights the limitations of traditional methods like Bag of Words and TF-IDF in capturing semantic information, proposing solutions like Word2Vec for better representation of text data.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
8 views12 pages

Machine Learning

The document discusses various statistical and machine learning models, including qualitative response models, logistic regression, and Naive Bayes classification. It covers concepts such as maximum likelihood estimation, gradient descent, and natural language processing techniques like tokenization and word embeddings. Additionally, it highlights the limitations of traditional methods like Bag of Words and TF-IDF in capturing semantic information, proposing solutions like Word2Vec for better representation of text data.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
Qualitative Resbonge Models > ‘her independent variables = Qualitative —> Durtiny Variable —> 0) uacditative lent Voriabla = Qvantriah sal ‘aed ae Sips > Rear Sie Deft x Site, Net out Afstie Ces] ] ay é BS (casigcion Defeuit, = 0 [Negative cs] (Lindt Reg” «5 Ss WS L0G RESSION. (LOGIT an los isc Ree oS ON t a) sregreasion > Ue need tas | ie To do thi 4 Sigrid function on Y= 0+, 2 wiry Led a co © € Lg FH COF of Lig Distibton oy 8" Faonafaos | “eabers dha omy’ woe, fag See (Oyen >t fon logistic "Abe aes” of Big ender luhood of dtsoning oe i gaara | is %) | ya? JU itn | boty phan 9 $— Med Teer) ye Ne, To conv Rabi nto Seale bie eal "XP || 7 Can't vse OLS [: Ass” of New Te (e-)=¢ Pe, hh a= t+ Bt, | Ge ise. Maximum, Lil fi 3 Ay ‘ : 5 Lineaxity bla lap odds and Trdebendemt| won) This Lonistie in find Coficiends tad make ous model Thijs Lege ink ; eta Ms Lg tas ; ona ti w ted = sesso] Spun Lom fndionigt@)=hUE)] eee tue itn dle ae Linear Regression S52 Bits, Josistic Function Lap Temfemsig | opit fundion —> fstimation, (Ue) to yotel and peedic Prati ond it] Pe to trot the pedihed pebabiitln back to a 1% Log odds of am ever chum all ind 0 (ouuial for Lge ng erates ott Od} | Faye to idrpid: Inbal of Birig valves gol ata! amor Sfaedided loq-odds hen thore's re : Feber Now we Know im Graodient Descent we find gldbal minimum, of Cost fondtion! « | gP> Change In Lag as of dpe onan Bok Tn Regresin # wan Phan Sparel ce [ 4-4) Tie graph ons Ay) Goes of (8) gud ajo » T Ss, TSs. i [es Logistic eg. we gek Y, Nem Linen fncion > Toa. Te ih Wt : ell sola fas ! ris oston Cet 2 ‘ To Sule the ie, we dive a Aftrent Cob fron (Fm ML) tt Yeawis Nessa “ux ue Poeuda | Pefaddoo RS 6 48 P i log iss= 1% fa + lof Zt {3} » 95 (-F)] LO. |e Ret Be re ile gible tee Y & | Ty — lef Cost > — fades (ulebtty |) FEE sqifeace —» Tv > Fst] ye UR i { he ism J a Pet) tei i ite 1K ety Tpdividual Significance >To CLEI > tstalistic [Loyitic > static “eBay snp fof of Si ss Mb captuses non linear tel” better) (Pras es Buia EE Rae Pobit- Noaiive Bayes Classifies > Sinpe" peobabibstc asia” based on applying Bayes Torin cith Sting: (pi) indefendeneassonPt6h blu abi OTedependent cent - Ocarare is vat dferdert on ony obwrevert «fy Fallg adie {2.3854} tale, ep : rs OF Tising cin Pr (Head) = F(a @Deerdak event > Thase uhich deferd upon whut bibpuned belre Ga: (oo o] RG) pp(ped)-3 Be > AB |A)= Robabity of ble gin we tok oot ted before = 2 ‘ ; ae © Taree 2 “tba apap ther excel] ((¥ond8) = P(A)» Pe(Bla) —» f(an8)= Pe(6nA) —> Pls)» P(Pn)= P(e) [LYNE] Gail eo Bu Rh aed 5 ore P(pssta--)= 2 opted tata stat . POd/riter-¥)= POOR) AA): ARI) sje ‘ PED Hed - Pla) ——— es Cate Seely cc ta ido Yn|o 2 Naive Payer hore ! 3 ‘Tempoute Plas Tennis f) Ye No P(t) Pid) Ys PQ) Plu) j oo) HR isles Yes 9 ie Me No 5 15 Gld + + 3s: = Now subpose in ovs tat dada (New) ond we work to salve ib vig Naive bapa based on datuict Gr aliendy have: BPs sean) ae pel-gal Fada Se eae Sore ts eee ¢ Cw erg, at) = lh)» Pm plein) <® 3 2 = grots [7 I bath thee we did not Comidered the denominatns «constant Rat Here we Com See 0:08570°031 butt ane ony too helpful - 0-03) 4 0-085 Pe/suomy nt)= 0-085 = 237, —> TF 0m ovtok & Samy onl Tentoniue § He pte Dowst 0-05) NATURAL LANGUAGE PROCESSING: (NLF) — Deals with Pecasing ord foi tor aka pe (eee) ES) Tr Ritton wx hare NLT Libary fos tis» [Naom) Language Thi] ane eal Tid Embed] (B) Token sation -> Break duu the text ido small units» © Sentence Tokenisdion—> Breaking douon ext)int fa-k-a CORPUS ox PARAGRAPH] tn Le “He ®) Wosd_Tokenisation —> Brekirg: doun ead sentence unit: SI the latter ste Classify overall Sentimends even tf Explit lle if eee. yale pel apes ar ihe TR-IDF and wlosd 2 Ver I tongs (0) Sterming —> Generates BAe ‘unc fom the IVFLECTEN’ uml. removing afi ote nxt Tn ale x sei te Ss) (Leman Gos toon feel fans of he Same und ad ten fins fase(aka lemma) Pay noe fy: He, quickly ale a. queeb pee ile in ing ith yeglan easing. sou Rania insite ies) Gerwtay Ged O A ® Canonicalization > Map very word of the language to its wot] bse fm lg ys, Ping Reel rete teat able t qenrak mearinatol i Be ane eine gene meng | base wosds. “fs Comifonicetion ———p Commu. Mae sate shave SS Te vepines “the woosd alongside the Past of, Speech Pos) of the wos with the wosd a3 a func [fom -abikestim imoot Wosdet etme] iy aah wd of « Senkce fo 7 pd ore Gor Nie eat posh) fdr mh van of a eon fer ie ea we its Oe TT et joa { caviegare Oa “abs i : ie pietinacts Dad ue ra Spe S ae (fo ‘infest _stapuosts| Special Growers 150521 i & Level (= Feeds extraction | Text Rebsesenta Db ag of words (Bow) > Treats the, document sn Uist: Faghuns an ihe ond the numb Sous bau mony Hines Bet team abfears | a vet os bu meng mgt Sule Viet Be fst Fe upd lg ; Sy Gow dont consider the onder of beds Dett th ae tae 1 : mH is «ged bo Sood bo oe TST Vetoes eat FR SE Va teinctat! Ty Sob 8 [nr hh egergenatee a. @ ele) Peek oot ‘aipedel ie SI hg ® MF {las ren ae dou fren) Ta hs ale fou Ke veus Soke tet rae » “ty ine Sonn ees SWZ) La Takes, Cane of the. pnplotomce of tends 2 gpor < Imsligend genie wit Seuhd Sent i iad Singin Nava elim ows in a St) nk —> yd bey 4 ig ay eg ag ee Aaa 2 doronanon weed 2 |q (Tet Bo \ nF = In (e Shak ota Tel oe) Sent 2 gool git) “boy 2 ome | By My qaedauin sent 3 boy gil god Yel 2 Gish 0% My UC) Ses 0 $8) m8) Seam Skleoen-featuse_ extn text: impust: Tfidf Vedbuisen Note that in Level? ce caold base ao used One-Hot Encoding | ‘aain_coxpus = But OHE [s mminly Used for individual woeds ~it reverent! thom as 7 me F fath ward here Carat to a unique dimension: (0,0, [1,0]... «he Ey: Male, Female, others | Genders ake Female Wa i ale OE ; Femmle 0 o ‘bat Coss ae ‘ others 0 ° t Consecutive Sequences of 1 items, uel in NLP 42 analyse text {st~brantfocm (aan oop) (1) Uniqueams -»Conmmonly ed in B-O-W). Cach individual cad - fo: Gad tfidf_ mobi tat = tfiof vedosva-brorsfuom [ea tope) Serban Ue me sat ems ‘eyuber, E Ver elo 3 tonsesdve text item ox weds Thane yo oe. i8E_ array train, = Hidf _ rraksix — train to (Convert TF-10F vee et ee oh aoe tat = Eh asta tare cab as Preble» Vor adn be anne os svete Bee inet nes t " SS Cooloff might be a common phvaae but what's the cnfext ad true meaning > Fira. print (efidf ere ttl bre) Basically the Semantic seladion | codext is in net bing onl Lew 3 pep Level 3 Semantic Refatrtaton ox Und Embeds —> Gre seman son onl tal mani fund : © Both BOW ond TF-IDF can't deal with Semantic Information, fy: The orden of Sentence is nob pressed yealtitents So they both ‘treat end word as a. ndeburdent entity. and ignore neldiom BETWEEN cords: “ Caplaring is vou Semurdic Yationtp is Krewn fa (00 EmBeDDINs (dyy 94.) if number of feaduser >> tang Sentences then, made Stads memosiing tin} E i Ms f e Wouds in q large coshus mpfean few times amd these lead to ae Secrest oak sated cong faa Goth Bow) ard TF-IDF lead to Overfitt " Lack of tontaxt [eads to loss of Valuable Info thos distinguishing Hw di meomiras of wosde belame tush. Solution :- Wosd2Vec cn moe ' : 01g 4 Trsbad of assigning values like de or Os ov 0-14 eke, Lid 2vec vebreents each werd an a vedor of 320 mse dorsiong. © (] 2 | (py arkic informadion and relation Hw wosds is also preserved. Sala sbi 2b Wi ne le [Soins ads hot oe rte] drcsmends 03 Semantic veces 4 ag ‘| ji & a} 2 aes he an for gece lata ene Vimwsa2 [pm NY tO Prepeccsing pfetporse srk on, ued, come € Spied me fs, ~ oat = Word Ve in-covn= | Hissin ; Py aN Sac ae reel = Word Vee (Senta, min-Courk= Dn sangeet a ‘sn + Men is Coser4p women’ thon 4a Phy: a \ 4 Sintors roel: tav- Task Simlen(‘boy) —> Shous te. Mas Similan ‘Poke Wing Plan F oman= Queen Shae Kil jordin eH tn Mala a} Bey b eed Naive Bayes Aftes deing all the Prfrecasiag Shs (Sopuerd vera storming Bow TID ele), ue tan do Neve Bayes ff : | Sentence 4» Grood boy eu é Sl Oe : ben fF ; Seofonce 2 Gated gor) ae oe TE is best fos fut clasificadion|'P fr each tand is checked 1 Serko 3° Bay Gil od 1 ‘ieee P fos Gutpor 1s alo checked ox ae Ke ae todd Naa Pe Ws |srene) = P=, 2,5)) (C4) oH) PC) et) [Den i atotitty of ovlfut spats 2 Pkied -00%8 Disachartages = & (D Nw odd icon > Tig funy a sate 6k Bh be Sprain = Wis Tea aye gets dastied’ a3 0(Bad/No |» dea) with Zetoprbabitin for Unseen hoes Laplace Sracthing 2 and hat Stead io te tay do coon oa, n ace Smoothing adds a Srmal) Count soe eadusing the uxel doant take a dass impossible 10 fy P (YD) ar Pits 0. if No Smeting S's 0-4fSmaonb singh = A+? i (ZAP Pasible Values for ae (0 ara Coo Yi ot \( 24 ar beer 3k Usually itis vor Yon high = 20-17. pase aoae = 75:87, | signed ofbaafil “73 fz $feom, Sklearn. naive bayes impost: Gasiend@| Gam Skew. Naive -bayeR import Categosia ‘yar swan = Ie-08) Dat Fox Continon festive [nkepmlent abla Gy Geighs to pret diabetes Js 10, {ote-alloa= Tax) > Fos Cdeqoricel fetora [indeperdeat Vax. &: Geno f paid diabetes swing pdr [(ifin=0, fae ape =Tox)-2 Ne Stig \ ial NB a= |fpa= T Hiram models with >2 Tangs. fan Sense lays infst Mylionitn@liin- 20 foe. ela Fe) > Bs mle ah ET ns ue Frediond coundyaite K= Neaweat Neightnoss > Used foe both Casifation ond Regrasion problems. Uses porinity t make clsifiatiog 0s Kepreions Pricion ao ing Clasifiain == ff ist Fp clasifiaien ie 4 iS Pf dial Ge aye ere nx Sein that k No of meant nelghbaos to \ndade in the mjouity ating Pres: ti ei Se fou tis we Sc Value of Hytefaromedor K-= 5/2 x , PE he cekgg do i tds bt? te Ty k-5 wel pi a as (2 ea) Oars he distance hove is calauated seg = fen Distance? OS rane n see Oa Cr SGT (i) Monhaken distance fhe [5-44] Basically - Pinkowski_dista dete pints X and Y with 1 Pineal a ce ed Regression :- Sire Room feice AX ~ = ales > KEY sae age ofl ck Pik’ pies. De6I= (5 pas t)" - - Pee A Sa E ee bummer then P= 9 fTinkuski Distance = MWNATEN ditence P22 3 Minkowski Distance = EUCLIDEAN distance é ‘eae P30 Minkousli Distance = GHEBISHEN distame © Hoye dabesds crnke am ise ~ if Kis ao high thin lot of time to clea eh onl ey dita ® Sensitive to outliers ‘laded but black poinds gutliers: @ Sensitive to missing Values» if missing valu then toe igh might oh affeded. ““Unifeom Each 5 paints get ual inpack[usiht todede! “dalene> welt « aE As Aes, ° PYTHON :> CLASSIFICATION > from Skleasmeneighbours. imbort: KeplosChsifo .ios ce csi = unifm, pts metaic =Plinkeust!) * “ee Means Evelidean distance, 7 Reguessin > foo Skleann- neighhous import. KNeightors Rar (o-ipis=5,is = Unifim, p= 2, Mebsc = ‘minkuucki)) SYM (Suppost Vectos Machines) Classi ficahon -»Suppost Vector Classifier Suppose vector aS ‘ Ae Hyborplane ‘This oe Shoat Hard Mugirad Planes ~a pind In [region planes] a 5 ae i f Sere aa sop forges art No oof shaigt Ine - y= mth o p= Ox, 1ounrostyth [y= Orb] Bramble = Spfox. we oveakd a huypertene 31424 H-0 fis sme points. > All blak points when sobstitiled in 4-0. Nemlive Velo {Maximum Parsin (008 aim is to Masiise tis margin) oe, “foinks hor Sbstitded im Tris built on Logistic segrension: Lagisti decision bounks Bd pie) Saachione Liscnse ached bles the Gaps bla Pagel Pane So Sight: aon Lahore ©8065 > Soft Marginal Plane. [ 0-67 Mt ati ah foal VM isa Lean Classifier tad delonnina, the hupber plane tat oa aa sep Sica: ne 9 ae Sica (ce esi th Bat Hyer Plane Plane that maximign Margin cidth bate on rie (Us) e Siero Covm Pod) | ihe IE) tat forme vif si ma TG dade is Linearly Seborable SHard Mugin Classifications if dutb> F dade is Linen Sebo hex ie Pennants ya Ge (o'(42)=2__ | ve wont lo marinise Tol Welt | thesageman mt 5 Sarai = a “sd for acurate deb fuind >[y(248) >] aise er yaa 4 Tn read wend , dade. # pee Sforalle : : = a : —__-_——“ Cast {imation [Las furdion —> oR we ft e. & reat pi sine sn 1 iy Regutarial rake Pts alowed ical Pe. fy C=3 OCS meee 210s Sepine as fay ees Sepia ‘the 3pts- i ding, thse, axa Sin 0 ee an Regession j os poids 1 eo Pane Cost funcion-» morse Tel] Gonstaint [y- "xs | < € wlutb=0(0sme b=0 2) whe o Bo 3 pees ; vo ob Berghe maeratereea 3 & ~ be he A x el - fos poinds qutside anginal plane lot of on se t e | fe Petpet Net st |4.-o'r] < et] 6 | 5 cat Hinge Loss sbarprronaden p SVM Kernels kat if our dade is not Vineanly Seerable? fis oe lou dimes space highsimentin) ‘i M7 hs “This tranaftemadion is, done usr y Di, hide of A fd ~ sie yet bet ee fom reel geei » Gh picks in ifbeck daase ie fede spe Sey oe SF satan scics ‘ c Nous till ey oe. had am) » (ns eauily Seberated > Batin 8 cue 5 ina kom — f,2)-('e4)* ge rb 1 ya) = : I sy, deat B (i) RBE kere | Gauusion Keel mhprted“tebedet 1 lee ati] Rand basis fonction Doig is covets cvsdase to following iq moid Kennel, Orr om Skkam. sym impost svc| C=40, Kewel= ‘nop’ fty|siymi’, degree = 2) 1 te Bas Regine franco [smenghxt-] Aeyree of flyromial Kae Pet n skleaxn-svm_ import sval(c= 10, Kor = inh [fly] ‘sgrnid! degree = 2) 5 ° Decision Tee c ‘ID3 (Thorative Dichotoméer 3) — Prltin splits CART ( Caasifiation ord xegresion tae) Sits aN (2) Entropy ord Gini Tadex fury git “a piers m (b) Tofesmatin Grain fete desion bee slit cp ent been inset) alee U if (age>15 ca a Bing eee ie Ce Ce paint (* Posed”) a =| Wsing outlook (fr ns) ue spit He dake =e fen fe rea (Dfonty hit cee a real RE a amy OHO SR ME Plext Bute sat pen = | at se oe fait of pate (1) : fe = Node [iit «use PIAL Ye Tn the graph> Sonny > HG)=— 21a, 3 = tog. See Dates Yi aha vant »HS) =i lg, 0 ~ 0 lig 0= 0 @Pforrmion Gain hin fast sled? fn Nos. Ae tase & Which is good? i o Oy /5N Poot | oes fle { seal ci i Grin (5, fst nok) = HS) — Ze Hf] 47 \exb (i) Gini Taposity Gut. = 1- 2e)- - [eres iia cob ef Fa eT nye Gt 20S-apmgit SSP TE 1G): tnicent angi aaon ents Grso =m VS fenn(s,6)= $94-[2..01+-Coi]- 0.019 N Uy Grain 6,5.) = Grin of $. > Gain of f, Hy Gin )= 0-031 8 ee Ua CFU STTTTT CET CCT E CET eeeeeeen ee eS Re we build the deusion tees on telning dab, it (ghd) eds 0 overftirg [rainy deusion toe lear, extuamely tell cabin oie ad insta “This “haters hen they care ton dep To del uth this — PRUNING OPest-Froning > Fist natok the DE on! thon im the bands f edu ove tng — > lewd Th the given deision toe — debth =4 — lew 2 Depth As we con see ,no point ef last split: (Yes >>> No) ‘Saja hoe [yf vs lw Pa ae we tea @ Pee Peuning -» pp hyborperemdor alii nade) cenutvction Lints real daring coratwin HH \> Battor fos Lange dedocet. fosly flay with hyperparamaen cud crsbatet accosdinaly LASSIFICATION RERRT :— a CLASSIFICATION. (ETRICS Confusion Matsix Shows bao diction ae csseck and incovsect fan class oa z i infusion Matsix —Shous ha many Keates rN 42) 3 Jk ; eee he ee FA soe <2 us eal faltesde Wafe Cohen's = 2 (P Th -FN FP) Nats (IPtEP) (FP+7H) + Grey) dels ety 12 Measues agreement Hy priced ard dual Clase f : Sitpost > Nomber of Tins tosh mebsic a) evented.! (tasse t al fst < ie e nee "pha! “feats " ig e> stesyee esti Sb Peal yu Sa, ROC (Rectiver Chorin Chaadrstc Gon) : : SU rad ‘fr] L Stows peapoe. ‘Model at all Classification Thresholds” ; vont htc we Pei = | ; ~2 Pauision bardela 1m} beter is ea, ie a Ensemble Techniques — Combines Predictions, of Multiple models tovmke move acuwiale ond yobust piedictians- © Bagging (Ror fort Ott ; Ge at i BaGGING Ge Kreuk Denon Facto owing Low Bias + High Vrdane Thr bagging is buoma la vance betas] —>[froael] —Joiput > Pract ie af uiput > Prediction] aie Classi Out 4 Debt Pre es Ba | Tet ong Med Nitin. & ee q Arerage Feary & ] [Link] 0, >4s a: Staorg Lecomen | i kere aasi ab, a Hore ue assign cits to the Weak, lames if : Cr eater SRG ati . spetulegton of Bating <5 0) * . i ye % ot Co cee ee te aa ‘ 5 ya yee uh es assigns ~ “4 Site My 0 rd, 07. P38 é ea eer Summoyy Barring > Raadem Fost >Pajity Vtg [Ay ofall eotl] athe coi hr patcody Lo cng eHow at Bo0sTING = Psigrment fone week tomes, high confi a

You might also like