├── .github └── ISSUE_TEMPLATE │ └── sharing-course-notes.md ├── .gitignore ├── README.md ├── docs ├── 01.112 │ └── index.html ├── 02.126 │ └── index.html ├── 02.137DH │ └── index.html ├── 02.212TS │ └── index.html ├── 02.229 │ └── index.html ├── 30.003 │ └── index.html ├── 30.101 │ └── index.html ├── 30.102 │ └── index.html ├── 30.110 │ └── index.html ├── 40.002 │ └── index.html ├── 40.011 │ └── index.html ├── 40.016 │ └── index.html ├── 40.302 │ └── index.html ├── 40.305 │ └── index.html ├── 404.html ├── 50.003 │ └── index.html ├── 50.005 │ └── index.html ├── 50.012 │ └── index.html ├── 50.034 │ └── index.html ├── 50.038 │ └── index.html ├── assets │ ├── fonts │ │ ├── font-awesome.css │ │ ├── material-icons.css │ │ └── specimen │ │ │ ├── FontAwesome.ttf │ │ │ ├── FontAwesome.woff │ │ │ ├── FontAwesome.woff2 │ │ │ ├── MaterialIcons-Regular.ttf │ │ │ ├── MaterialIcons-Regular.woff │ │ │ └── MaterialIcons-Regular.woff2 │ ├── images │ │ ├── GitHub-Mark-32px.png │ │ ├── book.png │ │ ├── download.png │ │ ├── favicon.png │ │ ├── icons │ │ │ ├── bitbucket.1b09e088.svg │ │ │ ├── github.f0b8504a.svg │ │ │ └── gitlab.6dd19c00.svg │ │ ├── logo.png │ │ └── profile.png │ ├── javascripts │ │ ├── application.c648116f.js │ │ ├── lunr │ │ │ ├── lunr.da.js │ │ │ ├── lunr.de.js │ │ │ ├── lunr.du.js │ │ │ ├── lunr.es.js │ │ │ ├── lunr.fi.js │ │ │ ├── lunr.fr.js │ │ │ ├── lunr.hu.js │ │ │ ├── lunr.it.js │ │ │ ├── lunr.ja.js │ │ │ ├── lunr.jp.js │ │ │ ├── lunr.multi.js │ │ │ ├── lunr.nl.js │ │ │ ├── lunr.no.js │ │ │ ├── lunr.pt.js │ │ │ ├── lunr.ro.js │ │ │ ├── lunr.ru.js │ │ │ ├── lunr.stemmer.support.js │ │ │ ├── lunr.sv.js │ │ │ ├── lunr.th.js │ │ │ ├── lunr.tr.js │ │ │ ├── tinyseg.js │ │ │ └── wordcut.js │ │ └── modernizr.74668098.js │ └── stylesheets │ │ ├── application-palette.a8b3c06d.css │ │ └── application.30686662.css ├── index.html ├── search │ └── search_index.json ├── sitemap.xml └── sitemap.xml.gz └── notes ├── 01.112 Machine Learning └── 2019-Siew Wen │ ├── 01.112_notes.pdf │ ├── 01.112_notes.tex │ ├── BayesianNetworks.md │ ├── Clustering.md │ ├── FowardBackwardAlgorithm.md │ ├── HiddenMarkovModel.md │ ├── IntroToML.md │ ├── LinearClassification.md │ ├── LogisticRegression.md │ ├── MixtureModels.md │ ├── README.md │ ├── ReinforcementLearning.md │ ├── SVM.md │ ├── final_cheatsheet.pdf │ └── pictures │ ├── 1d_mixture_models.png │ ├── bayesian_network_example.png │ ├── effects_of_regularization.PNG │ ├── em.png │ ├── gaussian_em_iterations.PNG │ ├── kink.PNG │ ├── not_linear_separable_through_origin.PNG │ ├── penalty.png │ ├── pres_accident.png │ ├── sgd_loss_functions.png │ └── slack_variable.jpg ├── 01.113 Statistical and Machine Learning └── 2020-huikang │ └── first-half.html ├── 02.126 SEA under Japan └── 2019 │ ├── SEA under Japan Week 01 - Before 1941.md │ ├── SEA under Japan Week 02.md │ ├── SEA under Japan Week 03.md │ ├── SEA under Japan Week 04.md │ ├── SEA under Japan Week 05.md │ ├── SEA under Japan Week 08.md │ ├── SEA under Japan Week 09.md │ ├── SEA under Japan Week 10.md │ ├── SEA under Japan Week 11.md │ ├── SEA-under-Japan-2019-notes.pdf │ └── SEA-under-Japan-2019-notes.tex ├── 02.137DH Introduction to Digital Humanities └── 2019-WM │ ├── 02.137DH_notes.pdf │ └── 02.137DH_notes.tex ├── 02.212TS The Visual Culture of Science and Technology └── 2019 │ ├── 02.212TS_notes.pdf │ └── 02.212TS_notes.tex ├── 02.229 Decision Theory & Practice └── 2019-Yustynn │ ├── decision-theory-2019-notes.pdf │ ├── w01-summary.pdf │ ├── w02-summary.pdf │ ├── w03-summary.pdf │ ├── w04-summary.pdf │ ├── w05-summary.pdf │ ├── w06-summary.pdf │ ├── w09-summary.pdf │ ├── w10-summary.pdf │ ├── w10-summary.png │ ├── w11-summary.pdf │ ├── w12-summary.pdf │ ├── w13-summary.pdf │ └── w13-summary.png ├── 30.003 Introduction to Probability and Statistics └── 2019-WM │ ├── 30.003_PnS_notes.pdf │ ├── 30.003_PnS_notes.tex │ ├── 30.003_finals_revision_guide.pdf │ ├── 30.003_finals_revision_guide.tex │ ├── 30.003_midterms_revision_guide.pdf │ └── 30.003_midterms_revision_guide.tex ├── 30.101 Systems & Control └── 2020-WM │ ├── 30.101_SnC_notes.pdf │ ├── 30.101_SnC_notes.tex │ ├── 30.101_midterms_revision_guide.pdf │ ├── 30.101_midterms_revision_guide.tex │ └── blockdiagrams.png ├── 30.102 Electromagnetics & Applications └── 2020-WM │ ├── 30.102_finals_revision_guide.pdf │ ├── 30.102_finals_revision_guide.tex │ ├── 30.102_midterms_revision_guide.pdf │ ├── 30.102_midterms_revision_guide.tex │ ├── TL_ant_Tx.png │ └── planecurrent.png ├── 30.110 Digital Systems Lab └── 2020-WM │ ├── 16expressions.png │ ├── 30.110_revision_guide.pdf │ ├── 30.110_revision_guide.tex │ ├── 4bitreg.png │ ├── bin-sync-counter.png │ ├── binary-ripple-counter.png │ ├── logicgates.jpg │ ├── logicgates.png │ ├── mealy-machine.png │ ├── moore-machine.png │ ├── seq-fsm.png │ ├── seq-logic-2.png │ ├── serial-trf.png │ ├── state-diagram.png │ ├── state-minimization.png │ ├── static-discipline.png │ ├── uni_shift_reg.png │ ├── wx.jpg │ └── yz.jpg ├── 40.002 Optimisation └── 2019-huikang │ ├── README.md │ ├── final-summary.md │ ├── final-summary.pdf │ ├── midterm-summary.md │ └── midterm-summary.pdf ├── 40.011 Data and Business Analytics └── 2019-huikang │ ├── README.md │ ├── midterm-cheatsheet.md │ └── midterm-cheatsheet.pdf ├── 40.012 Manufacturing and Service Operations └── 2020-huikang │ ├── assets │ ├── EOQ-cost.png │ ├── EOQ-inventory.png │ ├── EPQ-inventory.png │ ├── NV-formulas.png │ └── QR-inventory.png │ └── inventory-management.md ├── 40.014 Engineering Systems Architecture └── 2020-huikang │ ├── assets │ ├── influence-diagram.png │ ├── modularity.png │ └── stakeholder-diagram.png │ ├── first-half.md │ └── second-half.md ├── 40.016 The Analytics Edge └── 2019-huikang │ ├── R-cheatsheet.md │ ├── R-cheatsheet.pdf │ └── README.md ├── 40.302 Advanced Topics in Optimization ├── 2019-Yustynn │ └── opti-notes.pdf └── 2021-huikang │ ├── README.md │ ├── README.pdf │ └── assets │ ├── cheatsheet-page-1.png │ ├── cheatsheet-page-2.png │ ├── jm-cmax-1.png │ ├── jm-cmax-2.png │ ├── permutation-flow-shop-alt.png │ ├── taxonomy-machine-environment.png │ └── taxonomy-objective-functions.png ├── 40.305 Advanced Topics in Stochastic Modeling └── 2019-Yustynn │ └── atsm-notes.pdf ├── 40.316 Game Theory └── 2021-huikang │ ├── README.md │ └── assets │ ├── cheatsheet-page-1.png │ ├── cheatsheet-page-2.png │ └── splitting-the-pie.png ├── 50.003 Elements of Software Construction ├── 2018-Joel │ ├── esc_notes_joel.pdf │ └── esc_notes_joel_src │ │ ├── img │ │ ├── blocking-queue.png │ │ ├── cyclic-barrier.png │ │ ├── nonblockingll.png │ │ ├── parallel-bfs.jpg │ │ ├── parallelization.png │ │ ├── phaser.jpg │ │ └── volatile.png │ │ ├── main.tex │ │ └── src │ │ ├── CDLDemo.java │ │ ├── DecoratorDemo.java │ │ ├── DiningPhil1.java │ │ ├── FutureRenderer2.java │ │ ├── ISTDWebsiteClickRandomLink.java │ │ ├── ObserverPattern.java │ │ ├── ParameterizedTest.java │ │ ├── PizzaStore.java │ │ ├── StrategyPattern.java │ │ ├── TestWithMock.java │ │ ├── VisitorPatternOriginal.java │ │ ├── generalized_fuzzer.py │ │ └── simple-fuzzer.c └── 2019-Siew Wen │ ├── 50.003_Finals_Revision_Compiled.md │ ├── 50.003_Finals_Revision_Concurrency.md │ ├── 50.003_Finals_Revision_Refactoring.md │ ├── 50.003_Finals_Revision_Test_Design.md │ ├── 50.003_Finals_Revision_UML.md │ ├── 50.003_Finals_notes.pdf │ ├── 50.003_Finals_notes.tex │ └── basic-control-flow-graphs.jpg ├── 50.005 Computer System Engineering ├── 2018-Shaun,Joel │ └── cse_notes_shaun.pdf └── 2019-Siew Wen │ ├── 50.005_notes.pdf │ ├── 50.005_notes.tex │ ├── Networking.md │ └── OS.md ├── 50.012 Networks └── 2019-Siew Wen │ ├── 50.012_finals_summary.pdf │ ├── 50.012_finals_summary.tex │ ├── 50.012_midterms_summary.pdf │ ├── 50.012_midterms_summary.tex │ ├── 50.012_notes.pdf │ ├── 50.012_notes.tex │ ├── Extras.md │ ├── Finals-Summary.md │ ├── Lecture1-TransportLayer.md │ ├── Lecture10-CongestionControl.md │ ├── Lecture11-TCPWrapup.md │ ├── Lecture13-NetworkLayerOverview.md │ ├── Lecture14-IPAddressing.md │ ├── Lecture15-RoutingAlgorithms.md │ ├── Lecture16-Routing.md │ ├── Lecture17-SDN.md │ ├── Lecture19-Link_Layer.md │ ├── Lecture2-HTTP.md │ ├── Lecture21-WirelessNetworks.md │ ├── Lecture3-WebAPI.md │ ├── Lecture5-NetworkApplications.md │ ├── Lecture6-CDN-and-PNP.md │ ├── Lecture7-RDT.md │ ├── Lecture8-RDTPipelines.md │ ├── Lecture9-TCP_RDT_CC_Principles.md │ ├── Midterm-Summary.md │ ├── README.md │ ├── pictures │ ├── GNB.PNG │ ├── GNB_receiver.PNG │ ├── GNB_sender.PNG │ ├── IPv4_vs_IPv6.PNG │ ├── SR.PNG │ ├── SR_dillema.PNG │ ├── TCPCongestionControl.PNG │ ├── TCP_sender_simple.PNG │ ├── code-division-multiple-access-cdma.jpg │ ├── control_plane.PNG │ ├── demo_rest_api.png │ ├── djikstra_oscillations.png │ ├── forwarding_diagram.png │ ├── hol_blocking.png │ ├── input_port2.png │ ├── output_port.png │ ├── rdt2.1_receiver.PNG │ ├── rdt2.1_sender.PNG │ ├── rdt2.2_receiver.PNG │ ├── rdt2.2_sender.PNG │ ├── rdt3.0_pipeling.PNG │ ├── rdt3.0_receiver.jpg │ ├── rdt3.0_sender.PNG │ ├── rdt3.0_stopandwait.PNG │ ├── rdt_noack.png │ ├── rdt_noack2.png │ ├── rdt_noack3.png │ ├── routing_architecture.png │ ├── stopandwait_vs_pipeline.PNG │ ├── subnet_example.png │ ├── switching_bus.png │ ├── switching_crossbar.png │ ├── switching_memory.png │ ├── tcp_fairness.PNG │ └── tcp_throughput.PNG │ ├── tcp_sample.py │ └── udp_sample.py ├── 50.021 Artificial Intelligence └── 2021-huikang │ ├── README.md │ ├── README.pdf │ └── assets │ ├── alpha-beta-pruning.png │ ├── backtracking.png │ ├── cheatsheet-page-1.png │ ├── cheatsheet-page-2.png │ ├── cheatsheet-page-3.png │ └── cheatsheet-page-4.png ├── 50.034 Introduction to Probability and Statistics └── 2018-Jing Yu │ └── pns_notes_kjy.pdf ├── 50.038 Computational Data Science └── 2019-Siew Wen │ ├── 50.038 exam-checklist.md │ └── 50.038-exam-checklist.pdf ├── 50.039 Theory and Practice of Deep Learning └── 2021-huikang │ ├── README.md │ ├── README.pdf │ └── assets │ ├── finals-cheatsheet-page-1.png │ ├── finals-cheatsheet-page-2.png │ ├── midterms-cheatsheet-page-1.png │ ├── midterms-cheatsheet-page-2.png │ ├── q-table.png │ └── transformer.png └── 50.045 Information Retrieval └── 2021-huikang ├── README.md ├── README.pdf └── assets ├── NDCG.png └── query-likelihood-model.png /.github/ISSUE_TEMPLATE/sharing-course-notes.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Sharing course notes 3 | about: Use this issue template if you would like to share your course notes. 4 | title: "[Notes] xx.xxx Course Name Here" 5 | labels: needs-review 6 | assignees: flamanta 7 | 8 | --- 9 | 10 | **Course Name** 11 | 12 | xx.xxx Course Name Here 13 | 14 | **Link to your course notes on cloud storage** 15 | 16 | [GDrive](https://drive.google.com) 17 | 18 | **Do you need help converting your notes into LaTeX?** 19 | 20 | Yes/No 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/.DS_Store 2 | -------------------------------------------------------------------------------- /docs/assets/fonts/material-icons.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 3 | * use this file except in compliance with the License. You may obtain a copy 4 | * of the License at: 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, SOFTWARE 9 | * DISTRIBUTED UNDER THE LICENSE IS DISTRIBUTED ON AN "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | * SEE THE LICENSE FOR THE SPECIFIC LANGUAGE GOVERNING PERMISSIONS AND 12 | * LIMITATIONS UNDER THE LICENSE. 13 | */@font-face{font-family:"Material Icons";font-style:normal;font-weight:400;src:local("Material Icons"),local("MaterialIcons-Regular"),url("specimen/MaterialIcons-Regular.woff2") format("woff2"),url("specimen/MaterialIcons-Regular.woff") format("woff"),url("specimen/MaterialIcons-Regular.ttf") format("truetype")} -------------------------------------------------------------------------------- /docs/assets/fonts/specimen/FontAwesome.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/docs/assets/fonts/specimen/FontAwesome.ttf -------------------------------------------------------------------------------- /docs/assets/fonts/specimen/FontAwesome.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/docs/assets/fonts/specimen/FontAwesome.woff -------------------------------------------------------------------------------- /docs/assets/fonts/specimen/FontAwesome.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/docs/assets/fonts/specimen/FontAwesome.woff2 -------------------------------------------------------------------------------- /docs/assets/fonts/specimen/MaterialIcons-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/docs/assets/fonts/specimen/MaterialIcons-Regular.ttf -------------------------------------------------------------------------------- /docs/assets/fonts/specimen/MaterialIcons-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/docs/assets/fonts/specimen/MaterialIcons-Regular.woff -------------------------------------------------------------------------------- /docs/assets/fonts/specimen/MaterialIcons-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/docs/assets/fonts/specimen/MaterialIcons-Regular.woff2 -------------------------------------------------------------------------------- /docs/assets/images/GitHub-Mark-32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/docs/assets/images/GitHub-Mark-32px.png -------------------------------------------------------------------------------- /docs/assets/images/book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/docs/assets/images/book.png -------------------------------------------------------------------------------- /docs/assets/images/download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/docs/assets/images/download.png -------------------------------------------------------------------------------- /docs/assets/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/docs/assets/images/favicon.png -------------------------------------------------------------------------------- /docs/assets/images/icons/bitbucket.1b09e088.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/assets/images/icons/github.f0b8504a.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/assets/images/icons/gitlab.6dd19c00.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/docs/assets/images/logo.png -------------------------------------------------------------------------------- /docs/assets/images/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/docs/assets/images/profile.png -------------------------------------------------------------------------------- /docs/assets/javascripts/lunr/lunr.da.js: -------------------------------------------------------------------------------- 1 | !function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");var r,m,i;e.da=function(){this.pipeline.reset(),this.pipeline.add(e.da.trimmer,e.da.stopWordFilter,e.da.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.da.stemmer))},e.da.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.da.trimmer=e.trimmerSupport.generateTrimmer(e.da.wordCharacters),e.Pipeline.registerFunction(e.da.trimmer,"trimmer-da"),e.da.stemmer=(r=e.stemmerSupport.Among,m=e.stemmerSupport.SnowballProgram,i=new function(){var i,t,n,s=[new r("hed",-1,1),new r("ethed",0,1),new r("ered",-1,1),new r("e",-1,1),new r("erede",3,1),new r("ende",3,1),new r("erende",5,1),new r("ene",3,1),new r("erne",3,1),new r("ere",3,1),new r("en",-1,1),new r("heden",10,1),new r("eren",10,1),new r("er",-1,1),new r("heder",13,1),new r("erer",13,1),new r("s",-1,2),new r("heds",16,1),new r("es",16,1),new r("endes",18,1),new r("erendes",19,1),new r("enes",18,1),new r("ernes",18,1),new r("eres",18,1),new r("ens",16,1),new r("hedens",24,1),new r("erens",24,1),new r("ers",16,1),new r("ets",16,1),new r("erets",28,1),new r("et",-1,1),new r("eret",30,1)],o=[new r("gd",-1,-1),new r("dt",-1,-1),new r("gt",-1,-1),new r("kt",-1,-1)],a=[new r("ig",-1,1),new r("lig",0,1),new r("elig",1,1),new r("els",-1,1),new r("løst",-1,2)],d=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,48,0,128],u=[239,254,42,3,0,0,0,0,0,0,0,0,0,0,0,0,16],c=new m;function l(){var e,r=c.limit-c.cursor;c.cursor>=t&&(e=c.limit_backward,c.limit_backward=t,c.ket=c.cursor,c.find_among_b(o,4)?(c.bra=c.cursor,c.limit_backward=e,c.cursor=c.limit-r,c.cursor>c.limit_backward&&(c.cursor--,c.bra=c.cursor,c.slice_del())):c.limit_backward=e)}this.setCurrent=function(e){c.setCurrent(e)},this.getCurrent=function(){return c.getCurrent()},this.stem=function(){var e,r=c.cursor;return function(){var e,r=c.cursor+3;if(t=c.limit,0<=r&&r<=c.limit){for(i=r;;){if(e=c.cursor,c.in_grouping(d,97,248)){c.cursor=e;break}if((c.cursor=e)>=c.limit)return;c.cursor++}for(;!c.out_grouping(d,97,248);){if(c.cursor>=c.limit)return;c.cursor++}(t=c.cursor)=t&&(r=c.limit_backward,c.limit_backward=t,c.ket=c.cursor,e=c.find_among_b(s,32),c.limit_backward=r,e))switch(c.bra=c.cursor,e){case 1:c.slice_del();break;case 2:c.in_grouping_b(u,97,229)&&c.slice_del()}}(),c.cursor=c.limit,l(),c.cursor=c.limit,function(){var e,r,i,n=c.limit-c.cursor;if(c.ket=c.cursor,c.eq_s_b(2,"st")&&(c.bra=c.cursor,c.eq_s_b(2,"ig")&&c.slice_del()),c.cursor=c.limit-n,c.cursor>=t&&(r=c.limit_backward,c.limit_backward=t,c.ket=c.cursor,e=c.find_among_b(a,5),c.limit_backward=r,e))switch(c.bra=c.cursor,e){case 1:c.slice_del(),i=c.limit-c.cursor,l(),c.cursor=c.limit-i;break;case 2:c.slice_from("løs")}}(),c.cursor=c.limit,c.cursor>=t&&(e=c.limit_backward,c.limit_backward=t,c.ket=c.cursor,c.out_grouping_b(d,97,248)?(c.bra=c.cursor,n=c.slice_to(n),c.limit_backward=e,c.eq_v_b(n)&&c.slice_del()):c.limit_backward=e),!0}},function(e){return"function"==typeof e.update?e.update(function(e){return i.setCurrent(e),i.stem(),i.getCurrent()}):(i.setCurrent(e),i.stem(),i.getCurrent())}),e.Pipeline.registerFunction(e.da.stemmer,"stemmer-da"),e.da.stopWordFilter=e.generateStopWordFilter("ad af alle alt anden at blev blive bliver da de dem den denne der deres det dette dig din disse dog du efter eller en end er et for fra ham han hans har havde have hende hendes her hos hun hvad hvis hvor i ikke ind jeg jer jo kunne man mange med meget men mig min mine mit mod ned noget nogle nu når og også om op os over på selv sig sin sine sit skal skulle som sådan thi til ud under var vi vil ville vor være været".split(" ")),e.Pipeline.registerFunction(e.da.stopWordFilter,"stopWordFilter-da")}}); -------------------------------------------------------------------------------- /docs/assets/javascripts/lunr/lunr.ja.js: -------------------------------------------------------------------------------- 1 | !function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(m){if(void 0===m)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===m.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");var l="2"==m.version[0];m.ja=function(){this.pipeline.reset(),this.pipeline.add(m.ja.trimmer,m.ja.stopWordFilter,m.ja.stemmer),l?this.tokenizer=m.ja.tokenizer:(m.tokenizer&&(m.tokenizer=m.ja.tokenizer),this.tokenizerFn&&(this.tokenizerFn=m.ja.tokenizer))};var j=new m.TinySegmenter;m.ja.tokenizer=function(e){var r,t,i,n,o,s,p,a,u;if(!arguments.length||null==e||null==e)return[];if(Array.isArray(e))return e.map(function(e){return l?new m.Token(e.toLowerCase()):e.toLowerCase()});for(r=(t=e.toString().toLowerCase().replace(/^\s+/,"")).length-1;0<=r;r--)if(/\S/.test(t.charAt(r))){t=t.substring(0,r+1);break}for(o=[],i=t.length,p=a=0;a<=i;a++)if(s=a-p,t.charAt(a).match(/\s/)||a==i){if(0=c.limit)return;c.cursor=e+1}for(;!c.out_grouping(u,97,248);){if(c.cursor>=c.limit)return;c.cursor++}(s=c.cursor)=s&&(r=c.limit_backward,c.limit_backward=s,c.ket=c.cursor,e=c.find_among_b(a,29),c.limit_backward=r,e))switch(c.bra=c.cursor,e){case 1:c.slice_del();break;case 2:n=c.limit-c.cursor,c.in_grouping_b(d,98,122)?c.slice_del():(c.cursor=c.limit-n,c.eq_s_b(1,"k")&&c.out_grouping_b(u,97,248)&&c.slice_del());break;case 3:c.slice_from("er")}}(),c.cursor=c.limit,r=c.limit-c.cursor,c.cursor>=s&&(e=c.limit_backward,c.limit_backward=s,c.ket=c.cursor,c.find_among_b(m,2)?(c.bra=c.cursor,c.limit_backward=e,c.cursor=c.limit-r,c.cursor>c.limit_backward&&(c.cursor--,c.bra=c.cursor,c.slice_del())):c.limit_backward=e),c.cursor=c.limit,c.cursor>=s&&(i=c.limit_backward,c.limit_backward=s,c.ket=c.cursor,(n=c.find_among_b(l,11))?(c.bra=c.cursor,c.limit_backward=i,1==n&&c.slice_del()):c.limit_backward=i),!0}},function(e){return"function"==typeof e.update?e.update(function(e){return i.setCurrent(e),i.stem(),i.getCurrent()}):(i.setCurrent(e),i.stem(),i.getCurrent())}),e.Pipeline.registerFunction(e.no.stemmer,"stemmer-no"),e.no.stopWordFilter=e.generateStopWordFilter("alle at av bare begge ble blei bli blir blitt både båe da de deg dei deim deira deires dem den denne der dere deres det dette di din disse ditt du dykk dykkar då eg ein eit eitt eller elles en enn er et ett etter for fordi fra før ha hadde han hans har hennar henne hennes her hjå ho hoe honom hoss hossen hun hva hvem hver hvilke hvilken hvis hvor hvordan hvorfor i ikke ikkje ikkje ingen ingi inkje inn inni ja jeg kan kom korleis korso kun kunne kva kvar kvarhelst kven kvi kvifor man mange me med medan meg meget mellom men mi min mine mitt mot mykje ned no noe noen noka noko nokon nokor nokre nå når og også om opp oss over på samme seg selv si si sia sidan siden sin sine sitt sjøl skal skulle slik so som som somme somt så sånn til um upp ut uten var vart varte ved vere verte vi vil ville vore vors vort vår være være vært å".split(" ")),e.Pipeline.registerFunction(e.no.stopWordFilter,"stopWordFilter-no")}}); -------------------------------------------------------------------------------- /docs/assets/javascripts/lunr/lunr.stemmer.support.js: -------------------------------------------------------------------------------- 1 | !function(r,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():t()(r.lunr)}(this,function(){return function(r){r.stemmerSupport={Among:function(r,t,i,s){if(this.toCharArray=function(r){for(var t=r.length,i=new Array(t),s=0;s>3]&1<<(7&s))return this.cursor++,!0}return!1},in_grouping_b:function(r,t,i){if(this.cursor>this.limit_backward){var s=b.charCodeAt(this.cursor-1);if(s<=i&&t<=s&&r[(s-=t)>>3]&1<<(7&s))return this.cursor--,!0}return!1},out_grouping:function(r,t,i){if(this.cursor>3]&1<<(7&s)))return this.cursor++,!0}return!1},out_grouping_b:function(r,t,i){if(this.cursor>this.limit_backward){var s=b.charCodeAt(this.cursor-1);if(i>3]&1<<(7&s)))return this.cursor--,!0}return!1},eq_s:function(r,t){if(this.limit-this.cursor>1),a=0,f=u=(l=r[i]).s_size){if(this.cursor=e+l.s_size,!l.method)return l.result;var m=l.method();if(this.cursor=e+l.s_size,m)return l.result}if((i=l.substring_i)<0)return 0}},find_among_b:function(r,t){for(var i=0,s=t,e=this.cursor,n=this.limit_backward,u=0,o=0,h=!1;;){for(var c=i+(s-i>>1),a=0,f=u=(_=r[i]).s_size){if(this.cursor=e-_.s_size,!_.method)return _.result;var m=_.method();if(this.cursor=e-_.s_size,m)return _.result}if((i=_.substring_i)<0)return 0}},replace_s:function(r,t,i){var s=i.length-(t-r);return b=b.substring(0,r)+i+b.substring(t),this.limit+=s,this.cursor>=t?this.cursor+=s:this.cursor>r&&(this.cursor=r),s},slice_check:function(){if(this.bra<0||this.bra>this.ket||this.ket>this.limit||this.limit>b.length)throw"faulty slice operation"},slice_from:function(r){this.slice_check(),this.replace_s(this.bra,this.ket,r)},slice_del:function(){this.slice_from("")},insert:function(r,t,i){var s=this.replace_s(r,t,i);r<=this.bra&&(this.bra+=s),r<=this.ket&&(this.ket+=s)},slice_to:function(){return this.slice_check(),b.substring(this.bra,this.ket)},eq_v_b:function(r){return this.eq_s_b(r.length,r)}}}},r.trimmerSupport={generateTrimmer:function(r){var t=new RegExp("^[^"+r+"]+"),i=new RegExp("[^"+r+"]+$");return function(r){return"function"==typeof r.update?r.update(function(r){return r.replace(t,"").replace(i,"")}):r.replace(t,"").replace(i,"")}}}}}); -------------------------------------------------------------------------------- /docs/assets/javascripts/lunr/lunr.sv.js: -------------------------------------------------------------------------------- 1 | !function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");var r,l,n;e.sv=function(){this.pipeline.reset(),this.pipeline.add(e.sv.trimmer,e.sv.stopWordFilter,e.sv.stemmer),this.searchPipeline&&(this.searchPipeline.reset(),this.searchPipeline.add(e.sv.stemmer))},e.sv.wordCharacters="A-Za-zªºÀ-ÖØ-öø-ʸˠ-ˤᴀ-ᴥᴬ-ᵜᵢ-ᵥᵫ-ᵷᵹ-ᶾḀ-ỿⁱⁿₐ-ₜKÅℲⅎⅠ-ↈⱠ-ⱿꜢ-ꞇꞋ-ꞭꞰ-ꞷꟷ-ꟿꬰ-ꭚꭜ-ꭤff-stA-Za-z",e.sv.trimmer=e.trimmerSupport.generateTrimmer(e.sv.wordCharacters),e.Pipeline.registerFunction(e.sv.trimmer,"trimmer-sv"),e.sv.stemmer=(r=e.stemmerSupport.Among,l=e.stemmerSupport.SnowballProgram,n=new function(){var n,t,i=[new r("a",-1,1),new r("arna",0,1),new r("erna",0,1),new r("heterna",2,1),new r("orna",0,1),new r("ad",-1,1),new r("e",-1,1),new r("ade",6,1),new r("ande",6,1),new r("arne",6,1),new r("are",6,1),new r("aste",6,1),new r("en",-1,1),new r("anden",12,1),new r("aren",12,1),new r("heten",12,1),new r("ern",-1,1),new r("ar",-1,1),new r("er",-1,1),new r("heter",18,1),new r("or",-1,1),new r("s",-1,2),new r("as",21,1),new r("arnas",22,1),new r("ernas",22,1),new r("ornas",22,1),new r("es",21,1),new r("ades",26,1),new r("andes",26,1),new r("ens",21,1),new r("arens",29,1),new r("hetens",29,1),new r("erns",21,1),new r("at",-1,1),new r("andet",-1,1),new r("het",-1,1),new r("ast",-1,1)],s=[new r("dd",-1,-1),new r("gd",-1,-1),new r("nn",-1,-1),new r("dt",-1,-1),new r("gt",-1,-1),new r("kt",-1,-1),new r("tt",-1,-1)],a=[new r("ig",-1,1),new r("lig",0,1),new r("els",-1,1),new r("fullt",-1,3),new r("löst",-1,2)],o=[17,65,16,1,0,0,0,0,0,0,0,0,0,0,0,0,24,0,32],u=[119,127,149],m=new l;this.setCurrent=function(e){m.setCurrent(e)},this.getCurrent=function(){return m.getCurrent()},this.stem=function(){var e,r=m.cursor;return function(){var e,r=m.cursor+3;if(t=m.limit,0<=r||r<=m.limit){for(n=r;;){if(e=m.cursor,m.in_grouping(o,97,246)){m.cursor=e;break}if(m.cursor=e,m.cursor>=m.limit)return;m.cursor++}for(;!m.out_grouping(o,97,246);){if(m.cursor>=m.limit)return;m.cursor++}(t=m.cursor)=t&&(m.limit_backward=t,m.cursor=m.limit,m.ket=m.cursor,e=m.find_among_b(i,37),m.limit_backward=r,e))switch(m.bra=m.cursor,e){case 1:m.slice_del();break;case 2:m.in_grouping_b(u,98,121)&&m.slice_del()}}(),m.cursor=m.limit,e=m.limit_backward,m.cursor>=t&&(m.limit_backward=t,m.cursor=m.limit,m.find_among_b(s,7)&&(m.cursor=m.limit,m.ket=m.cursor,m.cursor>m.limit_backward&&(m.bra=--m.cursor,m.slice_del())),m.limit_backward=e),m.cursor=m.limit,function(){var e,r;if(m.cursor>=t){if(r=m.limit_backward,m.limit_backward=t,m.cursor=m.limit,m.ket=m.cursor,e=m.find_among_b(a,5))switch(m.bra=m.cursor,e){case 1:m.slice_del();break;case 2:m.slice_from("lös");break;case 3:m.slice_from("full")}m.limit_backward=r}}(),!0}},function(e){return"function"==typeof e.update?e.update(function(e){return n.setCurrent(e),n.stem(),n.getCurrent()}):(n.setCurrent(e),n.stem(),n.getCurrent())}),e.Pipeline.registerFunction(e.sv.stemmer,"stemmer-sv"),e.sv.stopWordFilter=e.generateStopWordFilter("alla allt att av blev bli blir blivit de dem den denna deras dess dessa det detta dig din dina ditt du där då efter ej eller en er era ert ett från för ha hade han hans har henne hennes hon honom hur här i icke ingen inom inte jag ju kan kunde man med mellan men mig min mina mitt mot mycket ni nu när någon något några och om oss på samma sedan sig sin sina sitta själv skulle som så sådan sådana sådant till under upp ut utan vad var vara varför varit varje vars vart vem vi vid vilka vilkas vilken vilket vår våra vårt än är åt över".split(" ")),e.Pipeline.registerFunction(e.sv.stopWordFilter,"stopWordFilter-sv")}}); -------------------------------------------------------------------------------- /docs/assets/javascripts/lunr/lunr.th.js: -------------------------------------------------------------------------------- 1 | !function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(t){if(void 0===t)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===t.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");var i="2"==t.version[0];t.th=function(){this.pipeline.reset(),this.pipeline.add(t.th.trimmer),i?this.tokenizer=t.th.tokenizer:(t.tokenizer&&(t.tokenizer=t.th.tokenizer),this.tokenizerFn&&(this.tokenizerFn=t.th.tokenizer))},t.th.wordCharacters="[฀-๿]",t.th.trimmer=t.trimmerSupport.generateTrimmer(t.th.wordCharacters),t.Pipeline.registerFunction(t.th.trimmer,"trimmer-th");var n=t.wordcut;n.init(),t.th.tokenizer=function(e){if(!arguments.length||null==e||null==e)return[];if(Array.isArray(e))return e.map(function(e){return i?new t.Token(e):e});var r=e.toString().replace(/^\s+/,"");return n.cut(r).split("|")}}}); -------------------------------------------------------------------------------- /docs/sitemap.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | https://opensutd.org/course-notes/ 5 | 2021-01-17 6 | daily 7 | 8 | 9 | https://opensutd.org/course-notes/30.003/ 10 | 2021-01-17 11 | daily 12 | 13 | 14 | https://opensutd.org/course-notes/30.101/ 15 | 2021-01-17 16 | daily 17 | 18 | 19 | https://opensutd.org/course-notes/30.102/ 20 | 2021-01-17 21 | daily 22 | 23 | 24 | https://opensutd.org/course-notes/30.110/ 25 | 2021-01-17 26 | daily 27 | 28 | 29 | https://opensutd.org/course-notes/40.002/ 30 | 2021-01-17 31 | daily 32 | 33 | 34 | https://opensutd.org/course-notes/40.011/ 35 | 2021-01-17 36 | daily 37 | 38 | 39 | https://opensutd.org/course-notes/40.016/ 40 | 2021-01-17 41 | daily 42 | 43 | 44 | https://opensutd.org/course-notes/40.302/ 45 | 2021-01-17 46 | daily 47 | 48 | 49 | https://opensutd.org/course-notes/40.305/ 50 | 2021-01-17 51 | daily 52 | 53 | 54 | https://opensutd.org/course-notes/02.126/ 55 | 2021-01-17 56 | daily 57 | 58 | 59 | https://opensutd.org/course-notes/02.137DH/ 60 | 2021-01-17 61 | daily 62 | 63 | 64 | https://opensutd.org/course-notes/02.212TS/ 65 | 2021-01-17 66 | daily 67 | 68 | 69 | https://opensutd.org/course-notes/02.229/ 70 | 2021-01-17 71 | daily 72 | 73 | 74 | https://opensutd.org/course-notes/01.112/ 75 | 2021-01-17 76 | daily 77 | 78 | 79 | https://opensutd.org/course-notes/50.003/ 80 | 2021-01-17 81 | daily 82 | 83 | 84 | https://opensutd.org/course-notes/50.005/ 85 | 2021-01-17 86 | daily 87 | 88 | 89 | https://opensutd.org/course-notes/50.012/ 90 | 2021-01-17 91 | daily 92 | 93 | 94 | https://opensutd.org/course-notes/50.034/ 95 | 2021-01-17 96 | daily 97 | 98 | 99 | https://opensutd.org/course-notes/50.038/ 100 | 2021-01-17 101 | daily 102 | 103 | -------------------------------------------------------------------------------- /docs/sitemap.xml.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/docs/sitemap.xml.gz -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/01.112_notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/01.112 Machine Learning/2019-Siew Wen/01.112_notes.pdf -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/Clustering.md: -------------------------------------------------------------------------------- 1 | # Clustering 2 | 3 | - Unsupervised learning 4 | - Cluster: collection of similar data points, and is sufficiently different from other groups. 5 | - Criterion for selecting clusters & representatives 6 | - Cosine Similarity: $\frac{x^{(i)}\cdot x^{(j)}}{||x^{(i)}||\cdot ||x^{(j)}||}$ 7 | - Euclidean Distance: $||x^{(i)}|| - ||x^{(j)}||$ 8 | 9 | ## K-means 10 | 11 | ### Cost of Clustering 12 | 13 | $$ cost(C_1...C_k, z^{(1)}...z^{(k)}) = \sum_{j=1...k}\sum_{i\Subset C_j} ||x^{(i)} - z^{(j)} ||^2 $$ 14 | 15 | $$ cost(z^{(1)}...z^{(k)}) = \sum_{i=1...n} \min_{j=1...k} ||x^{(i)} - z^{(j)} ||^2 $$ 16 | ### How it works 17 | 1. Choose the number of clusters $k$ 18 | 2. Place the centroids $c_1, c_2, ..... c_k$ randomly 19 | 3. for each data point $x_i$: 20 | - find the nearest centroid $(c_1, c_2 .. c_k)$ 21 | - assign the point to that cluster 22 | 4. for each cluster j = $1..k$ 23 | - new centroid = mean of all points assigned to that cluster 24 | $$z^{(j)} = \frac{1}{|C_j|} \sum_{i \Subset C_j} x^{(i)}$$ 25 | 5. Repeat steps 4 and 5 until 26 | - convergence ( when we find a clustering that minimizes the cost of clustering) 27 | - or until the end of a fixed number of iterations. 28 | 29 | Each iteration requires $O(kn)$ operations, and necessarily lowers the cost of clustering,, the sum of costs of individual clusters. 30 | 31 | 32 | ## K-medoids 33 | 34 | ### Choosing k 35 | We should choose the value of k that results in the highest relative drop in the cost (which corresponds to an “elbow” in the graph capturing as a function of $k$). 36 | 37 | ### How it works 38 | 1. Choose the number of clusters $k$ 39 | 2. Choose the exemplars $z_1, z_2, ..... z_k$ randomly out of the data points (or given otherwise) 40 | 3. For each data point $x_i$, other than the centroids: 41 | - calculate the distance to each exemplar $z_1, z_2, ..... z_k$ 42 | - add the data point to the cluster that contains $z^{(j)}$ which is nearest to the point $x_i$. 43 | 4. Set new exemplar $z^{(j)}$ to be the point in $C^j$ that minimizes $\sum_{i\Subset C^j} d(x^{(i)},z^{(j)})$ 44 | 5. Repeat steps 3-4 until no further change in cost. 45 | 46 | ## Difference between K-means and K-medoids 47 | 48 | | K-medoids | K-means | 49 | | --------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | 50 | | K-mediods is applicable to arbitrary objects and distance functions (e.g. categorical data) | Not possible to be applied for arbitrary objects and distance functions | 51 | | It is less sensitive to noisy data when compared to k-means since a mediod is less influenced by outlier than a mean. | More sensitive to noisy data | 52 | | Can be applied even when true data points are not available and only their pair-wise distances are provided | Cannot be applied if true data points are not available | 53 | | Can be applied to both continuous and discrete domains | Can only be applied to the continuous domain since the mean is not necessarily a data point. | 54 | | Longer run time, especially for large and random datasets. Computing the medoid is harder than computing the average | Shorter run time | 55 | | Medoid has no statistical meaning; it is neither a median nor geometric median | The mean value has a true geometrical and statistical meaning | 56 | 57 | ### Similarities between K-means and K-medoids 58 | - each iteration decreases the cost 59 | - the algorithm always converges 60 | - different starts gives different final answers 61 | - it does not achieve the global minimum -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/FowardBackwardAlgorithm.md: -------------------------------------------------------------------------------- 1 | ## Forward-Backward Algorthm 2 | 3 | ### Going Forward 4 | 5 | - $\alpha_u(j) =$ the sum of the scores of all paths from START to node $u$ at $j$ 6 | 7 | - For the first node, there is no emission probability. 8 | $$ 9 | \begin{aligned} 10 | \alpha_u(1) &= \alpha_{START,u} \\ 11 | &= p(x_0 , y_1 = u) 12 | \end{aligned} 13 | $$ 14 | 15 | - For the other nodes, 16 | 17 | $$\text{Given that }\sum_B P(A,B) = P(A)$$ 18 | 19 | $$ 20 | \begin{aligned} 21 | \alpha_u(j+1) &= p(x_1 ... x_j, y_{j+1} = u) \\ 22 | &= \sum_v p(x_1...x_j, y_{j+1} = u, y_j = v) \\ 23 | &= \sum_v p(x_1...x_{j-1}, y_j = v, x_j, y_{j+1}= u) \\ 24 | &= \sum_v p(x_1...x_{j-1}, y_j = v) \cdot b_v(x_j) \cdot a_{v,u} \\ 25 | &= \sum_v \alpha_v(j) \cdot b_v(x_j)\cdot \alpha_{v,u} 26 | \end{aligned} 27 | $$ 28 | 29 | ### Going Backward 30 | 31 | - $\beta_u(j) =$ the sum of the scores of all paths from node $u$ at $j$ to STOP. 32 | 33 | > $x_{j+1}$ cannot be generated before $x_j$ 34 | 35 | $$ 36 | \begin{aligned} 37 | \beta_u(j) &= p(x_j...x_n | y_j = u) \\ 38 | &= \sum_v p(x_j...x_n, y_{j+1} = v | y_j = u) \\ 39 | &= \sum_v p(x_j, y_{j+1} = v, x_{j+1}... x_n | y_j =u) \\ 40 | &= \sum_v b_u(x_j) \cdot a_{u,v} \cdot p(x_{j+1}...x_n | y_{j+1} = v) \\ 41 | &= \sum_v b_u(x_j) \cdot a_{u,v} \cdot \beta_v(j+1) 42 | \end{aligned} 43 | $$ 44 | 45 | Time Complexity: $O(nT^2)$ 46 | - $O(T)$ operations for $T$ nodes at $n$ positions 47 | 48 | -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/LogisticRegression.md: -------------------------------------------------------------------------------- 1 | # Logistic Regression 2 | 3 | $$ \sigma (\theta\cdot x + \theta_0) = \frac{\exp(\theta\cdot x + \theta_0)}{1+\exp(\theta\cdot x + \theta_0)} $$ 4 | 5 | Let $h(x) = \sigma (\theta\cdot x + \theta_0)$ 6 | 7 | - $p(y|x) = h(x) \text{ for } y = + 1$ 8 | - $p(y|x) = 1-h(x) \text{ for } y = - 1$ 9 | 10 | We can combine the piece-wise function into one expression. 11 | 12 | $$p(y|x) = \sigma (y(\theta\cdot x + \theta_0)) $$ 13 | 14 | ### Determining the label of prediction 15 | 16 | If new input $x$ is positive, 17 | $$p(y=+1|x) > p(y=-1|x)$$ 18 | $$\frac{p(y=+1|x)}{p(y=-1|x)} > 0$$ 19 | $$\log \frac{p(y=+1|x)}{p(y=-1|x)} > 0$$ 20 | $$\log \exp (\theta\cdot x + \theta_0) = \theta\cdot x + \theta_0 > 0$$ 21 | 22 | ## Objective Function 23 | 24 | $$ 25 | \begin{aligned} 26 | &\max_{\theta,\theta_0} \prod_{i=1}^n p(y^{(i)}|x^{(i)}) \\ 27 | = &\max_{\theta,\theta_0} \log\prod_{i=1}^n p(y^{(i)}|x^{(i)} \\ 28 | = &\max_{\theta,\theta_0} \sum_{i=1}^n \log p(y^{(i)}|x^{(i)}) \\ 29 | = &\min_{\theta,\theta_0} \sum_{i=1}^n -\log p(y^{(i)}|x^{(i)}) \\ 30 | = &\min_{\theta,\theta_0} \sum_{i=1}^n \log \frac{1}{p(y^{(i)}|x^{(i)})} \\ 31 | \end{aligned} 32 | $$ 33 | 34 | We reduce the expression into a summation term from a product term **to avoid the underflow problem** where the constant multiplication of probabilities leads to a number that is too small to be represented in the computer. 35 | 36 | ## Loss Function 37 | 38 | Since the objective function refers to the minimization of the loss function, we have 39 | $$ 40 | \begin{aligned} 41 | &\sum_{i=1}^n \log p(\frac{1}{y^{(i)}|x^{(i)}}) \\ 42 | = &\sum_{i=1}^n \log(1+\exp(-y^{(i)}(\theta\cdot x^{(i)}+ \theta_0)) 43 | \end{aligned} 44 | $$ 45 | 46 | To determine the cost/error at each iteration, let's drop $\theta_0$ to make life easier for now since it can be added back easily. 47 | 48 | $$ e^{(t)}(\theta) = \log(1+\exp(-y^{(i)}(\theta\cdot x^{(i)})) $$ 49 | $$ \triangledown e^{(t)}(\theta) = \frac{-y^{(t)}x^{(t)}}{1+\exp(-y^{(i)}(\theta\cdot x^{(i)}))} $$ 50 | 51 | Then we update the weights as such 52 | 53 | $$ \theta \leftarrow \theta - \alpha\triangledown e^{(t)}(\theta) $$ -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/README.md: -------------------------------------------------------------------------------- 1 | # Machine Learning Revision 2 | 3 | Table of Contents 4 | 5 | - [Intro to Machine Learning](IntroToML.md) 6 | - [Linear Classification](LinearClassification.md) 7 | - [Logistic Regression](LogisticRegression.md) 8 | - [Clustering](Clustering.md) 9 | - [SVM](SVM.md) 10 | - [Mixture Models](MixtureModels.md) 11 | - [Hidden Markov Models](HiddenMarkovModel.md) 12 | - [Forward Backward Algorithm](FowardBackwardAlgorithm.md) 13 | - [Bayesian Networks](BayesianNetworks.md) 14 | - [Reinforcement Learning](ReinforcementLearning.md) 15 | - :bulb: [Finals Cheatsheet](final_cheatsheet.pdf) 16 | 17 | > :warning: Beware notes for these concepts were **not written**, as I felt that they were pretty self-explanative when you learn them. 18 | >- Neural Networks 19 | >- Generative Models 20 | 21 | Below are some basic background info for Machine Learning. 22 | - [What is Machine Learning](#what-is-machine-learning) 23 | - [Recap on Convex Functions](#recap-on-convex-functions) 24 | - [Empirical Risk](#empirical-risk) 25 | - [Loss Functions](#loss-functions) 26 | - [Types of Machine Learning](#types-of-machine-learning) 27 | 28 | ## What is Machine Learning 29 | 30 | Machine learning revolves around **models**, which are trained via certain **techniques** and **learning algorithms** that are based on specific **loss functions**. They produce outputs based on **predictor functions**. 31 | 32 | ## Recap on Convex Functions 33 | 34 | A convex function typically has a U-shape (there are boundary cases where the surface can be flat, though. In that case the function is both convex and concave). 35 | 36 | Properties: 37 | - $\frac{f(x_1)+f(x_2)}{2} ≥ f(\frac{x_1+x_2}{2})$ 38 | - Its local optimum is also a global optimum. 39 | - Sum of convex functions is also convex. 40 | 41 | Some examples: 42 | - $f(x) = (x-1)^2 $ 43 | - $f(x) = max(x^2, 2^x)$ 44 | - $f(x) = |x| - x$ 45 | 46 | The convexity of empirical risk allows us to find the minimum even in non-realizable case. 47 | 48 | ## Empirical Risk 49 | 50 | Defined as the average loss on the training examples. 51 | $$ R_n(\theta) = \frac{1}{n} \sum_{t=1}^n Loss_h(y^{(t)}\theta\cdot x^{(t)}) $$ 52 | 53 | ## Loss Functions 54 | 55 | | Loss function | $Loss_h(z)$ | 56 | | -------------------------------- | ----------------- | 57 | | Squared Euclidean/ Least Squares | $\frac{1}{2}z^2$ | 58 | | Zero-one loss | | 59 | | Hinge Loss | $max\{ 1-z , 0\}$ | 60 | 61 |

62 | 63 |

64 | 65 | ## Types of Machine Learning 66 | 67 | > Notice the resemblance in the problems from each category of tasks 68 | 69 | Supervised Tasks 70 | - Classification $f: R^n \rightarrow \{ 1...k \}$ 71 | - LR,SVM, Perceptron NB 72 | - Regression: $f: R^n \rightarrow R^m$ 73 | - Ridge Regression, Logistic Regression 74 | - Structured Prediction: $f: S_1 \rightarrow S_2$ where $\text{size}(S_1) >\text{size}(S_2)$ 75 | - HMM, CRF, Structured Perceptron, Structural SVM 76 | 77 | Unsupervised Tasks 78 | - Clustering: $f: R^n \rightarrow \{ 1...k \}$ 79 | - K-means, EM 80 | - Dimensionality Reduction: $f: R^n \rightarrow R^m$ 81 | - PCA, LDA, Autoencoder 82 | - Structured Prediction: $f: S_1 \rightarrow S_2$ 83 | - Unsupervised HMM -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/ReinforcementLearning.md: -------------------------------------------------------------------------------- 1 | # Reinforcement Learning 2 | 3 | **Problem:** $f: S \rightarrow A$ 4 | - $S$: Set of States 5 | - $A$: Set of Actions 6 | 7 | **Transition Probability** 8 | - Moving from one state to another state is not definite 9 | - $ T(s,a,s') = p(s'|s,a) $ 10 | 11 | **Reward** 12 | - Incentivize a target state to be reached / not reached. 13 | - Can be positive (reward) / negative (penalty) 14 | - $R(s,a,s')$: Generally 15 | - $R(s')$ : if the system only requires the target state to be reached. 16 | 17 | ## Markov Decision Process 18 | 19 | Given 20 | - a set of states $S$ 21 | - a set of actions $A$ 22 | - a transition probability function $T(s,a,s') = p(s'|s,a) $ 23 | - a reward function $R(s,a,s')$ or $R(s')$ 24 | 25 | ### Utility (Long Term Reward) 26 | - Maximizing the rewards alone is not sufficient to incentivise the program to reach the final state that you want. The program may infinitely loop around a few states 27 | - Hence we apply a **discount** $\gamma$ to long-term rewards. 28 | 29 | $$ 30 | \begin{aligned} 31 | U([s_1,s_2,...s_n]) &= R(s_1) + \gamma R(s_2) + \gamma_2 R(s_3) + ... \\ 32 | &= \sum_{t=0}^\infty R(s_t) 33 | \end{aligned} 34 | $$ 35 | 36 | ### Value Iteration Policy 37 | 38 | We first define the following 39 | - $\pi(s)$: a particular policy that specifies the action we should take in state $s$ 40 | - $V^\pi(s)$: The value of state $s$ under policy $\pi$ 41 | - $Q^\pi(s,a)$: The $Q$-value of state $s$ and action $a$ under policy $\pi$ 42 | 43 | and the optimal version of them 44 | - $\pi^*(s)$: a particular policy that specifies the action we should take in state $s$ 45 | - $V^*(s)$: The value of state $s$ under the optimal policy $\pi^*$ 46 | - $Q^*(s,a)$: The $Q$-value of state $s$ and action $a$ under policy $\pi^*$ 47 | 48 | $$ 49 | \begin{aligned} 50 | Q^*(s,a) &= \sum_{s'} T(s,a,s') [R(s,a,s') + \gamma V^*(s')] \\\\ 51 | V^*(s) &= Q^*(s,\pi^*(s)) \\ 52 | &= \max_a Q^*(s,a) \\ 53 | &= \max_a \sum_{s'} T(s,a,s') [R(s,a,s') + \gamma V^*(s')] \\\\ 54 | \pi^*(s) = \argmax_a Q^*(s,a) 55 | \end{aligned} 56 | $$ 57 | 58 | ### Value Iteration Algorithm 59 | 1. Start with $V_0^*(s) = 0$ $\forall s \in S$ 60 | 2. Given $V_i^*$, 61 | 1. calculate the values for all states $s \in S$ and 62 | 2. keep track of the best actions to formulate the best policy 63 | 64 | $$ 65 | V^*(s) \leftarrow \max_a \sum_{s'} T(s,a,s') [R(s,a,s') + \gamma V^*(s')] 66 | $$ 67 | 68 | 3. Repeat until convergence. 69 | 70 | ### Q-value Iteration Algorithm 71 | 72 | Similar to Value Iteration Algorithm. -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/SVM.md: -------------------------------------------------------------------------------- 1 | # SVMs 2 | 3 | ## Adding Slack Variables 4 | 5 | Sometimes we get data which has two classes that are mostly separated except some small training data where the two categories overlap. In such cases, we would like to allow some points to intentionally be misclassified so as classify the rest correctly. 6 | 7 | To do so, for each training data point we can define a variable that measures the distance of the point to its marginal hyperplane, $\xi_t$, in terms ofthe hinge loss function. 8 | 9 | $$ 10 | \begin{aligned} 11 | \xi_t &= Loss_h(y^{(t)}(\theta\cdot x^{(t)} + \theta_0))\\ 12 | &= max\{1-y^{(t)}(\theta\cdot x^{(t)}),0 \} 13 | \end{aligned} 14 | $$ 15 | 16 |

17 | 18 |

19 | 20 | 21 | We can define a separating hyperplane by minimizing such errors $\xi_i$ 22 | 23 | $$ \min_{\theta,\theta_0,\xi} \{ \sum_{i=1}^N \xi_i \} $$ 24 | 25 | Each individual training point has a different but parallel marginal hyperplane. 26 | 27 | $$ 28 | \begin{aligned} 29 | \theta\cdot x + \theta_0 \geq 1 - \xi_i & \text{if } y_i = +1 \\ 30 | \theta\cdot x + \theta_0 \leq -1 + \xi_i & \text{if } y_i = -1 31 | \end{aligned} 32 | $$ 33 | 34 | Combining these 2 equations we yield a single equation for the constraint of primal problem. 35 | $$ y^{(i)}(\theta\cdot x^{(i)} + \theta_0) \geq 1 -\xi_i $$ 36 | 37 | ### Updated Primal Problem 38 | $$ \min \frac{\lambda}{2}||\theta||^2 + \sum_{t=1}^n \xi_t$$ 39 | 40 | $$ 41 | \begin{aligned} 42 | \text{such that } y^{(i)}(\theta\cdot x^{(i)} + \theta_0) \geq 1 -\xi_i,& \\ 43 | \xi\geq 0, &\\ 44 | t=1...n & 45 | \end{aligned} 46 | $$ 47 | 48 | Here, the slack variables are simply encoding the **hinge loss in the primal formulation.** 49 | 50 | ### Updated Dual Formulation 51 | 52 | The Dual Problem remains the same, except that we limit how large the Langrange multipliers $\alpha_t$ can become. 53 | 54 | - Also the larger the value of $\lambda$ (the more we want to expand the margin at the expense of the constraints), the smaller the resulting $\alpha_t$ must be. 55 | 56 | $$ \max \sum_{i=1}^n \alpha_t - \frac{1}{2} \sum_{i=1}^n\sum_{j=1}^n \alpha_i \alpha_j y^{(i)}y^{(j)}(x^{(i)}) $$ 57 | 58 | $$ \text{subject to } 0 \leq \alpha_t \leq 1/\lambda, \sum_{i=1}^n \alpha_i y^{(i)} = 0 $$ 59 | 60 | ### Complementary slackness constraints 61 | 62 | $$ 63 | \begin{aligned} 64 | &\hat{\alpha}_i = 0 \rightarrow \text{non-support vectors: } &y^{(i)} (\sum_{j=1}^n \hat{\alpha}_j y^{(j)}(x^{(j)} \cdot x^{(i)}) + \hat{\theta}_0) \geq 1 \\ 65 | &\hat{\alpha}_i \Subset (0,1/\lambda) \rightarrow \text{support vectors: } &y^{(i)} (\sum_{j=1}^n \hat{\alpha}_j y^{(j)}(x^{(j)} \cdot x^{(i)}) + \hat{\theta}_0) = 1 \\ 66 | &\hat{\alpha}_i = 1/\lambda \rightarrow \text{margin violations: } &y^{(i)} (\sum_{j=1}^n \hat{\alpha}_j y^{(j)}(x^{(j)} \cdot x^{(i)}) + \hat{\theta}_0) \leq 1 67 | \end{aligned} 68 | $$ 69 | 70 | We can use $\alpha_i$ that lies in the interior of possible values to reconstruct $\hat{\theta}_0$ -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/final_cheatsheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/01.112 Machine Learning/2019-Siew Wen/final_cheatsheet.pdf -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/pictures/1d_mixture_models.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/01.112 Machine Learning/2019-Siew Wen/pictures/1d_mixture_models.png -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/pictures/bayesian_network_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/01.112 Machine Learning/2019-Siew Wen/pictures/bayesian_network_example.png -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/pictures/effects_of_regularization.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/01.112 Machine Learning/2019-Siew Wen/pictures/effects_of_regularization.PNG -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/pictures/em.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/01.112 Machine Learning/2019-Siew Wen/pictures/em.png -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/pictures/gaussian_em_iterations.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/01.112 Machine Learning/2019-Siew Wen/pictures/gaussian_em_iterations.PNG -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/pictures/kink.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/01.112 Machine Learning/2019-Siew Wen/pictures/kink.PNG -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/pictures/not_linear_separable_through_origin.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/01.112 Machine Learning/2019-Siew Wen/pictures/not_linear_separable_through_origin.PNG -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/pictures/penalty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/01.112 Machine Learning/2019-Siew Wen/pictures/penalty.png -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/pictures/pres_accident.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/01.112 Machine Learning/2019-Siew Wen/pictures/pres_accident.png -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/pictures/sgd_loss_functions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/01.112 Machine Learning/2019-Siew Wen/pictures/sgd_loss_functions.png -------------------------------------------------------------------------------- /notes/01.112 Machine Learning/2019-Siew Wen/pictures/slack_variable.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/01.112 Machine Learning/2019-Siew Wen/pictures/slack_variable.jpg -------------------------------------------------------------------------------- /notes/02.126 SEA under Japan/2019/SEA under Japan Week 01 - Before 1941.md: -------------------------------------------------------------------------------- 1 | # Circumstances that led to Japan's going to War 2 | 3 | ## SEA under Japan 4 | 5 | ### Lesson 2 6 | 7 | You could broadly split these reasons into *a. Historical* and *b. Immediate (30s - 41)*. 8 | 9 | ## Historical 10 | 11 | **Meiji Restoration - 1868** 12 | 13 | Japan was under a lot of pressure by Western powers. Westernization, industrialization, abolition of the Shogun and Samurai, restoration of power under the Emperor - adoption of many Western ideas. 14 | 15 | > First Sino -Japanese War 1894 16 | > 17 | > Invasion of Taiwan 18 | > 19 | > Korea - a dagger pointed in the heart of Jpan 20 | 21 | Many more militarily trained young men and demands of civilians (heavy taxation to fuel the restoration led to demands for foreign colonies) further fueled these expansionist tendencies. 22 | 23 | Interestingly, it led to painters going out onto the battlefront to make paintings for...stuff? 24 | 25 | ### Russo-Japanese War 1905 26 | 27 | Rooted in Manchurian and Korean territorial issues. It was significant to the Japanese because WOOHOO Asians never die. Made the Germans semi-nervous. 28 | 29 | Most Japanese still preferred a pacifist stance at this time however - see the poem by Akiko Yosano - but this changes by the time Manchuria happens. 30 | 31 | White supremacist prodding by Wilhem of Germany - interestingly, the Japanese looked to the Germans for guidance in the Meiji Restoration. 32 | 33 | ### Japan in WW1 34 | 35 | Beat the Germans, assisted the European allies (Britain, US, Italy and France) and profited (and took over German assets in Asia). This also earned them a permanent place on the Council of League of Nations. 36 | 37 | At the **Paris Peace Conference, 1919** , there was a proposal for racial equality - the Racial Equality Proposal - where there was a push for all races to be deemed officially equal. This was rejected by Britain and Australia. Japan is understandably upset. 38 | 39 | ### Washington Naval Conference 1921 40 | 41 | Naval Limitation Agreement - limiting ships in a 5:5:3 (UK:US:Japan). This snubs Japan. 42 | 43 | America passes the Japanese Exclusion Act in 1924, which singles out Japanese and bars them from immigrating to US. 44 | 45 | Then markets falter in 1926, which sparks nationalist sentiment in Japan. Well shit. 46 | 47 | Now the Japanese go full upsetti spaghetti. 48 | 49 | ## 1930s 50 | 51 | ### Manchurian 1931 - the Mukden Incident 52 | 53 | The "bombing" of a Japanese railway in Manchuria and the subsequent exit of the Japan from the League of Nations set the stage for shenanigans. 54 | 55 | And by shenanigans, I mean creating Manchukuo, using ex-Emperor Pu Yi as a figurehead head of state. The Japanese issued an ultimatum - be the head of state and have a chance of re-acquiring the title of Emperor, or be an enemy to the Japanese. Power rested with the Commander of General Affairs, and the associated assembly which was staffed by Japanese soldiers. 56 | 57 | After the formation of Manchukuo, Japan proceeds to migrate 1 million households to Manchukuo, which displaced hundreds of thousands of Manchurians. 58 | 59 | It's not a sudden annexation - the railway and all the designs for Manchuria have been there for years. 60 | 61 | ### The rekt of Nanking 62 | 63 | War against China **1937**, and it was brutal. They 'accidentally' bombed the American Panay, a gunship in the Yangtze River. Plenty of killing of civilians. 64 | 65 | Prime Minister of Japan (also Prince), Fumimaro Konoe escalated the war in China, and pushed for the Tripartite Act (signed Sept 1940) which created the Axis. 66 | 67 | ### Pearl Harbor 1941 68 | 69 | 2 hours after the start of the invasion of Malaya, they dropped by the American naval base Pearl Harbour and by that I mean they dropped bombs on Pearl Harbor. Chiang Kai-Shek and Winston Churchill were pretty hyped. 70 | 71 | 72 | 73 | ## How Social Awkwardness drove Japan to War 74 | 75 | Emperor - scared of upsetting the military and govt because of previous attempted coup 76 | 77 | Konoe - PM of Civilian Govt - fuffed about with working out a treaty/agreement with the Americans. 78 | 79 | Mitsumoe - Foreign Minister of Japan - Sees allies in Germany, Italy, Russia (because of German-Russian non-aggression pact), 80 | 81 | Military Arm - two factions: Army and Navy. Army and Navy commanders also trying to impress their jingoistic subordinates - all trying to impress each other. They're all secretly hoping that the Civilian Govt is able to work out a diplomatic solution with the Americans so they don't have to fight. 82 | 83 | #### Homework 84 | 85 | Similarities between the readings/comparisons and what not. 86 | -------------------------------------------------------------------------------- /notes/02.126 SEA under Japan/2019/SEA under Japan Week 03.md: -------------------------------------------------------------------------------- 1 | # SEA under Japan Week 3 2 | 3 | We're doing some of last week's material because we didn't cover it. 4 | 5 | ## Pan-Asianism 6 | 7 | The idea that there's some unifying identity for Asian nations that would allow Asia to resist the West. 8 | 9 | The Western imperialist powers declined to give Asian people the same things that they gave their own citizens - self-determination, clear borders, votes and what not. They viewed Asia as the "waiting room of history" - where the people were not ready to create their own civilization, and needed Western guidance to achieve their potential - and hence justified Western presence. 10 | 11 | **Pan-Asianism** isn't just a Western concept - there exists commonalities between the Asian countries. Culturally, Confucianism, Buddhism and Hinduism are common threads that bound the Asian countries together. 12 | 13 | Japan identified itself as Asian, but also as a cut above the rest - some mental gymnastics took place when they tried to justify their shenanigans in Korea and China, and that they aren't a colonial power themselves. 14 | 15 | ### Teaist Pan-Asianism 16 | 17 | By Okakura: A pacifist idea of Pan-Asianism, rooted in cultural and spirituality and tea. Asian 'moral' soft power rooted in art, culture and philosophy, in contrast with the Western focus in science and politics. 18 | 19 | #### Sinic Pan-Asianism 20 | 21 | China needs help - too many problems and too varied a people. A weak China made for a poor Russian counterweight, and having Japan come along and fix China up would do Asia good. Japanese, Korean and even Chinese investors poured funds into this - until Japan started screwing around with the Chinese. 22 | 23 | ### Meishuron Pan-Asianism 24 | 25 | The Empire of the Rising Sun needed to be protected - a throwback to the samurai era of honor and what not. Somehow a lot of Japanese threw their lot with this. Japan needed to be militarily strong to protect the Emperor, and by extension, Asia. Under the Japanese umbrella would be the Greater Eastern Co-Prosperity Sphere. 26 | 27 | Yes, the Japanese believed in these idea, but we can't ignore the practical aspects of this war. They did need the resources. 28 | 29 | ## Japan in Malaya 30 | 31 | > Thomas Shenton - Governor of Singapore 32 | > 33 | > Percival - British Commander of Malaya and Singapore 34 | > 35 | > Yamashita - The Tiger of Malaya, Commander of the Japanese forces, and also a political enemy of Tojo. Still, a capable man nonetheless. 36 | 37 | The Singapore strategy - start with a naval base, some cannons, and get reinforcements from India and Australia. If shit goes down, get the Americans (didn't work because of *Pearl Harbor*) or reinforcement from the Middle East (Churchill's shifting theatres of war). 38 | 39 | The English had this incredible notion that the Japanese were grossly incapable of fighting - even when clearly outmatched. With the Japanese rolling in with 600 planes, mostly modern planes like the legendary Mitsubishi Zeros, the British were still fuffing about with 90 old planes like Buffalo Brewsters. You can see how this wouldn't work. 40 | 41 | The Thai were uncomfortable because to the north was Burma (under Brits) and to the south was Malaya (under Brits too) and thought the Brits had designs on the isthmus of Kra. 42 | 43 | The British planned Operation Matador as a countermove to Japanese landings in Malaya, but that would piss of the Thai. 44 | 45 | The advance of the Japanese was incredibly rapid - not just because they were properly equipped for the jungle, but also because the Brits very easily retreated. Contingents of Indian troops would surrender and defect because the Brits just gave in and ran. 46 | 47 | Disappointing. 48 | 49 | So repeatedly, they'd cede more land and say 'let's protect the further south'. You can see how this doesn't work. 50 | 51 | -------------------------------------------------------------------------------- /notes/02.126 SEA under Japan/2019/SEA under Japan Week 05.md: -------------------------------------------------------------------------------- 1 | # SEA under Japan Week 5 2 | 3 | ### Japan and Malaya 4 | 5 | The Japanese had seeded and fanned independence movements within the Malays, given their funding and support from the KMM. They also leveraged on Malay Friday prayers to spread paraphenelia and pro-Japanese messages - which imbued a sort of strength into the clergy class. 6 | 7 | However, there was some low-level resistance against the Japanese (clearly). Breakoffs from the MPAJA would raid Japanese supply trucks, and the supplies stolen bled into the black market. 8 | 9 | The Japanese arrival catalysed the formation of the idea of a Malay nation. Apart from providing support to the KMM, which already wanted an independent Malay nation, their rule also indirectly gave rise to several Malay newspapers - this also caused a shift in linguistics, as Roman letters were adopted as the standard script for Melayu, and gave rise to some new phrases (in fact, when the British finally return, there was a whole new vernacular they'd have to pick up). 10 | 11 | The KMM eventually got miffed that the Japanese weren't actually keen on a Malay nation, and kept pushing for it. They eventually met and worked together with the Communists, which is weird because the Communists are allied to the British, and the KMM was allied with the Japanese. Eventually, the Japanese found the KMM more trouble than they were worth, and banned the KMM, with adviser roles being given out to the leaders of KMM. 12 | 13 | Then, in 1943, Burma gets a sort of independence with their own government (which is a puppet government, of course). This excites the Malays and gives them hope. 14 | 15 | Then **SYKE** the northernmost 4 states are given to Thailand, which to the Malays was an incredible betrayal. Mustafa Hussein said "**NOPE** screw dis I'm going back to perak bye you little shits". 16 | 17 | Japan then offers military training and the militarisation of the Malays, creating their own army - with 2000 strong, Japanese uniforms, training and equipment, led by Ibrahim Yaacob. This army was set against the MPAJA, but that really didn't work out because 1) these people aren't really warriors, and 2) many of these people thought that the MPAJA weren't that shitty and it was wrong to fight their own people. 18 | 19 | Food supplies were shitacular because the 4 northern states were the rice-producing states of Malaysia. (Meanwhile in the 4 states, while they were nominally Thai, but there's weak policing by the Thai and they're generally run by the Malays). Without good food (since most of the food was channeled to the Japanese war effort), there was a shift toward use of tapioca. It's calorie rich, but not nutritious, which led to a lot of growth stunting. 20 | 21 | THEN YAMASHITA MY BOI SEZ 22 | 23 | > Yo chinese people fuk u too gimme 50 million dollars 24 | 25 | And the Chinese somehow scraped together 50 million dollars (by borrowing from a Japanese bank). 26 | 27 | There's a slow breakdown of the notion of the plural society because of the common denominator of *desperately trying to survive* lubricated social exchange when people met in the markets (and black markets). Old British systems and ideas like a segregated plural society, and business/logistical systems were thrown out of the window. People improvised, and those improvised systems stayed. 28 | 29 | KRIS - kesatuan rakyat indonesia semenanjung. A greater Malay nation including Indonesia. A notion that bubbled up at the end of the War. 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /notes/02.126 SEA under Japan/2019/SEA under Japan Week 10.md: -------------------------------------------------------------------------------- 1 | # SEA under Japan Week 10 2 | 3 | The PETA Revolt in Indonesia 4 | 5 | Few written sources - largely survivor testimonies. 6 | 7 | Formed October 1943 as *Tentara Sukarela Pembela Tanah Air* - Voluntary Army for the Defence of Land and Seas. Strikingly, it was **volunteer** basis, and was largely from **upper class families**. Many signed up - at the time, the Japanese were still viewed **positively**. 8 | 9 | Creation of independent, non-hierarchical *daidans* (battalions) - not hiearchical but independent, and intra-*daidan* contact was forbidden. This was to prevent the possibility of revolt. 10 | 11 | Meant to serve as a standing force against possible reprisal from the Australians, or attacks on Indonesia. 12 | 13 | Indonesia had long been 'demilitarized' under Dutch rule, and the Japanese militarization of Indonesia empowered the Indonesian people by equipping them with the necessary skills and equipment. 14 | 15 | Each *kabupaten* raised a *daidan*. They were pulled out from their civilian lives and put through rigorous military training. When they returned after training, they found that civilian life had changed for the worse - farmers were forced to sell rice, eggs were bought by the Japanese at cute-rate prices ostensibly for PETA, but it ended up for the Japanese. 16 | 17 | Scrap iron was being taken, with ornamnets and young women forced to go to 'Tokyo' for 'study'. 18 | 19 | PETA officers would be slapped by the Japanese, and that really ticked off the Indonesians because the Japanese claimed that they were equals. 20 | 21 | Many taken away to be *romusha*, forced labour for mines and the Death Railway. Blitar *daidan* got to see some of this, but these *romusha* were slightly better off. 22 | 23 | Indonesia was host to a lot of Dutch, and let's not forget that they, the colonizers, ended up as victims as well. 24 | 25 | Japanese used other PETA troops from Blitar *daidan* and *Heiho* to **suppress** the **revolt**, which made it difficult for the Indonesians to fight each other (they're all nationalists after all). The rebels withdrew into the mountains, which helped them endure a bit longer. Eventually the revolting troops surrendered with conditions. The Japanese granted relatively *lenient* sentences because they had to handle the Indonesians carefully - if they executed all the troops, that would inspire rebellion in the rest. 26 | 27 | **Supriyadi **- leader of the PETA rebellion. Disappeared after the forces withdrew into the mountain. He was slated to be the minister of defence, apparently, but he just...disappeared. 28 | 29 | Blitar's pretty popular, because it's a story that advances the cause of nationalism or valor (it's rather romanticized). An old man eventually claimed to be Supriyadi, and there was a lot of interest because of the tale - and he made many plausible claims. The one *startling* one is that he was present at the declaration of Independence, and was simply not noticed because he wasn't dressed formally, and kept a low profile. 30 | 31 | Whether it's true or not is irrelevant - it's the fervor that it inspired that we should note. 32 | 33 | There were also **Japanese** who devoted themselves to the independence of Indonesia against the allies. They gave up their weapons to the Indonesians to arm them against the Allies - cheeky strat, really. 34 | 35 | ## Friday Recital 36 | 37 | Complete your summaries - 7 top summaries will be used for score. Final paper needs a bibliography of at least 5 sources, with a draft by week 12. [go prepare this ahead of time] Hard deadline is 6th. 38 | 39 | > **Examples of Papers** 40 | > 41 | > *Comfort women* 42 | > 43 | > *The reasons for japanese atrocities from diaries and confessions of soldiers* 44 | > 45 | > *Failure of colonial rule post-war* 46 | > 47 | > *experiences of children in malaya in WW2* 48 | > 49 | > *bushido and the Japanese actions in SEA* 50 | > 51 | > *The most persecuted race in SEA in WW2* 52 | > 53 | > *The reason for bridge building in SEA* 54 | > 55 | > *Local japanese resistance to the war during ww2* 56 | > 57 | > *Reasons for the aggressive insurgency against the dutch after the Japanese surrender* 58 | > 59 | > *Food in malaya* 60 | > 61 | > *Sukarno and the blood on his hands* 62 | > 63 | > *Life under colonial rule and the Japanese occupation* 64 | > 65 | > *The notion of Japanese superiority and the aversion to surrender* 66 | > 67 | > 68 | > 69 | > 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /notes/02.126 SEA under Japan/2019/SEA under Japan Week 11.md: -------------------------------------------------------------------------------- 1 | # SEA under Japan Week 11 2 | 3 | ## The Phillipines 4 | 5 | 1898 Battle of Manila Bay - the Spanish surrendered to the Americans, and gave up the Philippines. The reason for the fight was *Cuba* rather than the Philippines itself (Spanish American War 1898) resulting in the Treaty of Paris. 6 | 7 | America pays Spain $20 million for infrastructure (and ownership) of the Philippines. 8 | 9 | Nationalists say *we want our country*, not a *change of colonial power*. The Americans were never quite the colonial power compared to the Spaniards, Brits or the Dutch, but for the Filipinos, the Americans were just another white power coming over. 10 | 11 | The nationalists fought against the Americans for 3 years, and unsuccessfully so - they surrender in 1901. America was brutal in their clamping down against the revolutionaries (waterboarding, and widespread killing). In 1935, the Commonwealth of the Philippines was set up, because the Americans insist they aren't a colonial power. 12 | 13 | Then the Japanese attack. 14 | 15 | Most of the fighting is centered on Luzon, with two other strikes on the East and South. The Americans floundered, the same way the British did - the Japanese attack was fast, precise and brutal. To the Americans' credit, they held on longer because 16 | 17 | The Americans sought to preserve Manila (because they put a lot of resources into Manila) and decide not to fight in it - they make it an 'Open City', where they accept that the Japanese can take over it, contingent on not-destroying-the-whole-place. 18 | 19 | > It didn't work, because the Japanese still opened their assault with aerial bombing to soften the (non-existent) defence. 20 | 21 | The American and Philippine armies move to Corregidor, a small island, to hold their ground. Fighting is brutal - 5 months from December 30th till surrender. 22 | 23 | MacArthur is recalled to Australia by America. Surrender on 6th May, under Wainwright. 24 | 25 | The *Bataan March* - 80,000 POWs marched to camp *O'Donnell*, and only 50,000 reached the camp. Horrific conditions, with the Japanese just pulling random POWs into the bushes to be bayoneted so the Japanese troops could steal their watches. 6 days without food to walk 60 miles - those who fell behind where killed. 26 | 27 | *Hell Ships* - Japanese ships that transported the POWs to labour camps. One. carrying POWs, was sunk with their cargo on board - out of 662, only 82 survived. 28 | 29 | The Japanese set up a government in the Philippines - not very popular - and a government-in-exile headed by Quezon (President of the Philippines Commonwealth) in America. 30 | 31 | Despite Japanese efforts to win over the Filipino populace, Filipino sentiment was still strongly anti-Japanese. 32 | 33 | The Battle of Midway represent a sort of turning point in the war, because it revealed the apparent weakness of the Japanese - apart from the breaking of the Japanese code, the Americans could recover and reuse more ships than the Japanese, while most Japanese ships were wrecked. 34 | 35 | In 1944, the Americans fight to retake the Philippines. There's an iconic photo of MacArthur walking up the beach against the backdrop of amphibious assault boats, with a look of grim determination on his face - it blew up because something something American glory and what not. What *actually* happened was that MacArthur did not want to get wet, but because the boat he was on could not land, he had to walk. This grim determination was just him being pissed as hell. 36 | 37 | The Battle of Luzon - Japan reinstated Yamashita to defend Manila. Yamashita had the same idea as the Americans - a sort of open city, and planned to regroup. However, there was insubordination - Rear Admiral Iwabuchi had a vendetta against the Americans, and held Manila fiercely, while massacring the civilians (Manila Massacre - 100,000 to 250,000 dead). The Americans bombard Manila to hell, killing thousands upon thousands of civilians. Even libraries were destoyed - essentially, Filipino history ends in 1945 because everything was destroyed. 38 | 39 | There's also some serious *Force 136*/ MPAJA styled shenanigans - the **Hukbalahap**. A communist/socialist guerilla movement that fought the Japanese *and also the Americans*. At their peak, their had 50,000 to their name. They continue fighting the Philippines Government until 1946 before being put down by the president. In 1949, they go a bit crazy and assassinate Quezon's wife, which kind of pisses of the Americans. 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /notes/02.126 SEA under Japan/2019/SEA-under-Japan-2019-notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/02.126 SEA under Japan/2019/SEA-under-Japan-2019-notes.pdf -------------------------------------------------------------------------------- /notes/02.137DH Introduction to Digital Humanities/2019-WM/02.137DH_notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/02.137DH Introduction to Digital Humanities/2019-WM/02.137DH_notes.pdf -------------------------------------------------------------------------------- /notes/02.212TS The Visual Culture of Science and Technology/2019/02.212TS_notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/02.212TS The Visual Culture of Science and Technology/2019/02.212TS_notes.pdf -------------------------------------------------------------------------------- /notes/02.229 Decision Theory & Practice/2019-Yustynn/decision-theory-2019-notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/02.229 Decision Theory & Practice/2019-Yustynn/decision-theory-2019-notes.pdf -------------------------------------------------------------------------------- /notes/02.229 Decision Theory & Practice/2019-Yustynn/w01-summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/02.229 Decision Theory & Practice/2019-Yustynn/w01-summary.pdf -------------------------------------------------------------------------------- /notes/02.229 Decision Theory & Practice/2019-Yustynn/w02-summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/02.229 Decision Theory & Practice/2019-Yustynn/w02-summary.pdf -------------------------------------------------------------------------------- /notes/02.229 Decision Theory & Practice/2019-Yustynn/w03-summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/02.229 Decision Theory & Practice/2019-Yustynn/w03-summary.pdf -------------------------------------------------------------------------------- /notes/02.229 Decision Theory & Practice/2019-Yustynn/w04-summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/02.229 Decision Theory & Practice/2019-Yustynn/w04-summary.pdf -------------------------------------------------------------------------------- /notes/02.229 Decision Theory & Practice/2019-Yustynn/w05-summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/02.229 Decision Theory & Practice/2019-Yustynn/w05-summary.pdf -------------------------------------------------------------------------------- /notes/02.229 Decision Theory & Practice/2019-Yustynn/w06-summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/02.229 Decision Theory & Practice/2019-Yustynn/w06-summary.pdf -------------------------------------------------------------------------------- /notes/02.229 Decision Theory & Practice/2019-Yustynn/w09-summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/02.229 Decision Theory & Practice/2019-Yustynn/w09-summary.pdf -------------------------------------------------------------------------------- /notes/02.229 Decision Theory & Practice/2019-Yustynn/w10-summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/02.229 Decision Theory & Practice/2019-Yustynn/w10-summary.pdf -------------------------------------------------------------------------------- /notes/02.229 Decision Theory & Practice/2019-Yustynn/w10-summary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/02.229 Decision Theory & Practice/2019-Yustynn/w10-summary.png -------------------------------------------------------------------------------- /notes/02.229 Decision Theory & Practice/2019-Yustynn/w11-summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/02.229 Decision Theory & Practice/2019-Yustynn/w11-summary.pdf -------------------------------------------------------------------------------- /notes/02.229 Decision Theory & Practice/2019-Yustynn/w12-summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/02.229 Decision Theory & Practice/2019-Yustynn/w12-summary.pdf -------------------------------------------------------------------------------- /notes/02.229 Decision Theory & Practice/2019-Yustynn/w13-summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/02.229 Decision Theory & Practice/2019-Yustynn/w13-summary.pdf -------------------------------------------------------------------------------- /notes/02.229 Decision Theory & Practice/2019-Yustynn/w13-summary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/02.229 Decision Theory & Practice/2019-Yustynn/w13-summary.png -------------------------------------------------------------------------------- /notes/30.003 Introduction to Probability and Statistics/2019-WM/30.003_PnS_notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.003 Introduction to Probability and Statistics/2019-WM/30.003_PnS_notes.pdf -------------------------------------------------------------------------------- /notes/30.003 Introduction to Probability and Statistics/2019-WM/30.003_finals_revision_guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.003 Introduction to Probability and Statistics/2019-WM/30.003_finals_revision_guide.pdf -------------------------------------------------------------------------------- /notes/30.003 Introduction to Probability and Statistics/2019-WM/30.003_midterms_revision_guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.003 Introduction to Probability and Statistics/2019-WM/30.003_midterms_revision_guide.pdf -------------------------------------------------------------------------------- /notes/30.101 Systems & Control/2020-WM/30.101_SnC_notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.101 Systems & Control/2020-WM/30.101_SnC_notes.pdf -------------------------------------------------------------------------------- /notes/30.101 Systems & Control/2020-WM/30.101_midterms_revision_guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.101 Systems & Control/2020-WM/30.101_midterms_revision_guide.pdf -------------------------------------------------------------------------------- /notes/30.101 Systems & Control/2020-WM/blockdiagrams.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.101 Systems & Control/2020-WM/blockdiagrams.png -------------------------------------------------------------------------------- /notes/30.102 Electromagnetics & Applications/2020-WM/30.102_finals_revision_guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.102 Electromagnetics & Applications/2020-WM/30.102_finals_revision_guide.pdf -------------------------------------------------------------------------------- /notes/30.102 Electromagnetics & Applications/2020-WM/30.102_midterms_revision_guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.102 Electromagnetics & Applications/2020-WM/30.102_midterms_revision_guide.pdf -------------------------------------------------------------------------------- /notes/30.102 Electromagnetics & Applications/2020-WM/TL_ant_Tx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.102 Electromagnetics & Applications/2020-WM/TL_ant_Tx.png -------------------------------------------------------------------------------- /notes/30.102 Electromagnetics & Applications/2020-WM/planecurrent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.102 Electromagnetics & Applications/2020-WM/planecurrent.png -------------------------------------------------------------------------------- /notes/30.110 Digital Systems Lab/2020-WM/16expressions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.110 Digital Systems Lab/2020-WM/16expressions.png -------------------------------------------------------------------------------- /notes/30.110 Digital Systems Lab/2020-WM/30.110_revision_guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.110 Digital Systems Lab/2020-WM/30.110_revision_guide.pdf -------------------------------------------------------------------------------- /notes/30.110 Digital Systems Lab/2020-WM/4bitreg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.110 Digital Systems Lab/2020-WM/4bitreg.png -------------------------------------------------------------------------------- /notes/30.110 Digital Systems Lab/2020-WM/bin-sync-counter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.110 Digital Systems Lab/2020-WM/bin-sync-counter.png -------------------------------------------------------------------------------- /notes/30.110 Digital Systems Lab/2020-WM/binary-ripple-counter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.110 Digital Systems Lab/2020-WM/binary-ripple-counter.png -------------------------------------------------------------------------------- /notes/30.110 Digital Systems Lab/2020-WM/logicgates.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.110 Digital Systems Lab/2020-WM/logicgates.jpg -------------------------------------------------------------------------------- /notes/30.110 Digital Systems Lab/2020-WM/logicgates.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.110 Digital Systems Lab/2020-WM/logicgates.png -------------------------------------------------------------------------------- /notes/30.110 Digital Systems Lab/2020-WM/mealy-machine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.110 Digital Systems Lab/2020-WM/mealy-machine.png -------------------------------------------------------------------------------- /notes/30.110 Digital Systems Lab/2020-WM/moore-machine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.110 Digital Systems Lab/2020-WM/moore-machine.png -------------------------------------------------------------------------------- /notes/30.110 Digital Systems Lab/2020-WM/seq-fsm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.110 Digital Systems Lab/2020-WM/seq-fsm.png -------------------------------------------------------------------------------- /notes/30.110 Digital Systems Lab/2020-WM/seq-logic-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.110 Digital Systems Lab/2020-WM/seq-logic-2.png -------------------------------------------------------------------------------- /notes/30.110 Digital Systems Lab/2020-WM/serial-trf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.110 Digital Systems Lab/2020-WM/serial-trf.png -------------------------------------------------------------------------------- /notes/30.110 Digital Systems Lab/2020-WM/state-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.110 Digital Systems Lab/2020-WM/state-diagram.png -------------------------------------------------------------------------------- /notes/30.110 Digital Systems Lab/2020-WM/state-minimization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.110 Digital Systems Lab/2020-WM/state-minimization.png -------------------------------------------------------------------------------- /notes/30.110 Digital Systems Lab/2020-WM/static-discipline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.110 Digital Systems Lab/2020-WM/static-discipline.png -------------------------------------------------------------------------------- /notes/30.110 Digital Systems Lab/2020-WM/uni_shift_reg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.110 Digital Systems Lab/2020-WM/uni_shift_reg.png -------------------------------------------------------------------------------- /notes/30.110 Digital Systems Lab/2020-WM/wx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.110 Digital Systems Lab/2020-WM/wx.jpg -------------------------------------------------------------------------------- /notes/30.110 Digital Systems Lab/2020-WM/yz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/30.110 Digital Systems Lab/2020-WM/yz.jpg -------------------------------------------------------------------------------- /notes/40.002 Optimisation/2019-huikang/README.md: -------------------------------------------------------------------------------- 1 | This contains my revision notes midterms and finals. I have obtained 90% for the first three of the four exams/quiz. 2 | 3 | The images are not my work, and most of them are taken from the slides. 4 | 5 | The source code is available in [my repository](https://github.com/tonghuikang/notes_ESD_term10/tree/master/OPTI). 6 | 7 | -------------------------------------------------------------------------------- /notes/40.002 Optimisation/2019-huikang/final-summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.002 Optimisation/2019-huikang/final-summary.pdf -------------------------------------------------------------------------------- /notes/40.002 Optimisation/2019-huikang/midterm-summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.002 Optimisation/2019-huikang/midterm-summary.pdf -------------------------------------------------------------------------------- /notes/40.011 Data and Business Analytics/2019-huikang/README.md: -------------------------------------------------------------------------------- 1 | This contains the cheatsheet for the first half of the course. 2 | 3 | For the finals, I had used a cheatsheet from my senior. Moreover, I am already familiar with the accounting and finance concepts (I am in the SUTD-SMU Dual Degree Programme). 4 | 5 | -------------------------------------------------------------------------------- /notes/40.011 Data and Business Analytics/2019-huikang/midterm-cheatsheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.011 Data and Business Analytics/2019-huikang/midterm-cheatsheet.pdf -------------------------------------------------------------------------------- /notes/40.012 Manufacturing and Service Operations/2020-huikang/assets/EOQ-cost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.012 Manufacturing and Service Operations/2020-huikang/assets/EOQ-cost.png -------------------------------------------------------------------------------- /notes/40.012 Manufacturing and Service Operations/2020-huikang/assets/EOQ-inventory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.012 Manufacturing and Service Operations/2020-huikang/assets/EOQ-inventory.png -------------------------------------------------------------------------------- /notes/40.012 Manufacturing and Service Operations/2020-huikang/assets/EPQ-inventory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.012 Manufacturing and Service Operations/2020-huikang/assets/EPQ-inventory.png -------------------------------------------------------------------------------- /notes/40.012 Manufacturing and Service Operations/2020-huikang/assets/NV-formulas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.012 Manufacturing and Service Operations/2020-huikang/assets/NV-formulas.png -------------------------------------------------------------------------------- /notes/40.012 Manufacturing and Service Operations/2020-huikang/assets/QR-inventory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.012 Manufacturing and Service Operations/2020-huikang/assets/QR-inventory.png -------------------------------------------------------------------------------- /notes/40.014 Engineering Systems Architecture/2020-huikang/assets/influence-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.014 Engineering Systems Architecture/2020-huikang/assets/influence-diagram.png -------------------------------------------------------------------------------- /notes/40.014 Engineering Systems Architecture/2020-huikang/assets/modularity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.014 Engineering Systems Architecture/2020-huikang/assets/modularity.png -------------------------------------------------------------------------------- /notes/40.014 Engineering Systems Architecture/2020-huikang/assets/stakeholder-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.014 Engineering Systems Architecture/2020-huikang/assets/stakeholder-diagram.png -------------------------------------------------------------------------------- /notes/40.014 Engineering Systems Architecture/2020-huikang/first-half.md: -------------------------------------------------------------------------------- 1 | # Midterms revision 2 | 3 | I am here studying the exam paper. Some instructions may not be present in the midterms but are still expected to be followed. 4 | 5 | Bring a ruler to improve your quality of life. 6 | 7 | ### Architectural design concepts 8 | 9 | - Modularity, Operational Analysis, Scenario Analysis, Structural Design, Operational Analysis, Concept Generation, Problem and Mission Statements, Use Cases 10 | - Use common sense 11 | 12 | 13 | 14 | ### Identifying Stakeholders 15 | 16 | - Your power-interest diagram require annotated arrows. 17 | 18 | ![stakeholder-diagram](assets/stakeholder-diagram.png) 19 | 20 | - One table explains the position of the power and interest in the diagram. 21 | - One table explains the relationship between the different stakeholders. You only need to fill up cells with a relationship. 22 | 23 | 24 | 25 | ### Influence Diagrams 26 | 27 | - Sketch this argument using the Design Research Methodology notation. In particular, each arc should have two signs (either “+” or “-“), one at the tail end of the arc and the other at the head of the arc. Label each arc as “E”, for “Experience” or “A” for “Assumption”. 28 | - Points will be deducted if you use the words "increase" or "decrease" within a bubble - this information belongs on the arcs. 29 | - Your proposal should be in the shape of a hexagon. 30 | 31 | ![influence-diagram](assets/influence-diagram.png) 32 | 33 | ### Architectural DSM 34 | 35 | - Rearrange rows and columns such that the "loss" is minimum. "Loss" is the distance of ones from the diagonal. 36 | - You can sketch the relationships as a graph. 37 | 38 | 39 | 40 | ### Modularity 41 | 42 | - Identify six functions 43 | - Identify three subsystems 44 | - Assign functions to the subsystems 45 | - List the exchanges on a table "Exchange", "From Entity", "To Entity" 46 | - Sketch a state change diagram for a typical cycle of events 47 | 48 | ![modularity](assets/modularity.png) 49 | 50 | ### Trade Studies 51 | 52 | - You need to draw a table. 53 | - Headings: Attribute List, Relative Weighting, A Rating, A Weighted Rating, B Rating, B Weighted Rating. 54 | - Summaries (after attribute list): Total, Rank, Recommend 55 | 56 | -------------------------------------------------------------------------------- /notes/40.016 The Analytics Edge/2019-huikang/R-cheatsheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.016 The Analytics Edge/2019-huikang/R-cheatsheet.pdf -------------------------------------------------------------------------------- /notes/40.016 The Analytics Edge/2019-huikang/README.md: -------------------------------------------------------------------------------- 1 | This contains my R cheatsheet, which is good for both midterms and finals. 2 | 3 | -------------------------------------------------------------------------------- /notes/40.302 Advanced Topics in Optimization/2019-Yustynn/opti-notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.302 Advanced Topics in Optimization/2019-Yustynn/opti-notes.pdf -------------------------------------------------------------------------------- /notes/40.302 Advanced Topics in Optimization/2021-huikang/README.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.302 Advanced Topics in Optimization/2021-huikang/README.pdf -------------------------------------------------------------------------------- /notes/40.302 Advanced Topics in Optimization/2021-huikang/assets/cheatsheet-page-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.302 Advanced Topics in Optimization/2021-huikang/assets/cheatsheet-page-1.png -------------------------------------------------------------------------------- /notes/40.302 Advanced Topics in Optimization/2021-huikang/assets/cheatsheet-page-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.302 Advanced Topics in Optimization/2021-huikang/assets/cheatsheet-page-2.png -------------------------------------------------------------------------------- /notes/40.302 Advanced Topics in Optimization/2021-huikang/assets/jm-cmax-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.302 Advanced Topics in Optimization/2021-huikang/assets/jm-cmax-1.png -------------------------------------------------------------------------------- /notes/40.302 Advanced Topics in Optimization/2021-huikang/assets/jm-cmax-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.302 Advanced Topics in Optimization/2021-huikang/assets/jm-cmax-2.png -------------------------------------------------------------------------------- /notes/40.302 Advanced Topics in Optimization/2021-huikang/assets/permutation-flow-shop-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.302 Advanced Topics in Optimization/2021-huikang/assets/permutation-flow-shop-alt.png -------------------------------------------------------------------------------- /notes/40.302 Advanced Topics in Optimization/2021-huikang/assets/taxonomy-machine-environment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.302 Advanced Topics in Optimization/2021-huikang/assets/taxonomy-machine-environment.png -------------------------------------------------------------------------------- /notes/40.302 Advanced Topics in Optimization/2021-huikang/assets/taxonomy-objective-functions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.302 Advanced Topics in Optimization/2021-huikang/assets/taxonomy-objective-functions.png -------------------------------------------------------------------------------- /notes/40.305 Advanced Topics in Stochastic Modeling/2019-Yustynn/atsm-notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.305 Advanced Topics in Stochastic Modeling/2019-Yustynn/atsm-notes.pdf -------------------------------------------------------------------------------- /notes/40.316 Game Theory/2021-huikang/assets/cheatsheet-page-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.316 Game Theory/2021-huikang/assets/cheatsheet-page-1.png -------------------------------------------------------------------------------- /notes/40.316 Game Theory/2021-huikang/assets/cheatsheet-page-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.316 Game Theory/2021-huikang/assets/cheatsheet-page-2.png -------------------------------------------------------------------------------- /notes/40.316 Game Theory/2021-huikang/assets/splitting-the-pie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/40.316 Game Theory/2021-huikang/assets/splitting-the-pie.png -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel.pdf -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/img/blocking-queue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/img/blocking-queue.png -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/img/cyclic-barrier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/img/cyclic-barrier.png -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/img/nonblockingll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/img/nonblockingll.png -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/img/parallel-bfs.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/img/parallel-bfs.jpg -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/img/parallelization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/img/parallelization.png -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/img/phaser.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/img/phaser.jpg -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/img/volatile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/img/volatile.png -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/src/CDLDemo.java: -------------------------------------------------------------------------------- 1 | import java.util.concurrent.CountDownLatch; 2 | 3 | public class CDLDemo { 4 | 5 | public static void main(String[] args) throws Exception { 6 | CountDownLatch latch = new CountDownLatch(3); 7 | 8 | Waiter waiter = new Waiter(latch); 9 | Decrementer decrementer = new Decrementer(latch); 10 | 11 | new Thread(waiter).start(); 12 | new Thread(decrementer).start(); 13 | } 14 | } 15 | 16 | class Waiter implements Runnable { 17 | 18 | CountDownLatch latch = null; 19 | 20 | public Waiter(CountDownLatch latch) { 21 | this.latch = latch; 22 | } 23 | 24 | public void run() { 25 | try { 26 | latch.await(); 27 | } catch (InterruptedException e) { 28 | e.printStackTrace(); 29 | } 30 | 31 | System.out.println("Waiter Released"); 32 | } 33 | } 34 | 35 | class Decrementer implements Runnable { 36 | 37 | CountDownLatch latch = null; 38 | 39 | public Decrementer(CountDownLatch latch) { 40 | this.latch = latch; 41 | } 42 | 43 | public void run() { 44 | try { 45 | Thread.sleep(1000); 46 | this.latch.countDown(); 47 | System.out.println(latch.getCount()); 48 | 49 | Thread.sleep(1000); 50 | this.latch.countDown(); 51 | System.out.println(latch.getCount()); 52 | Thread.sleep(1000); 53 | this.latch.countDown(); 54 | System.out.println(latch.getCount()); 55 | } catch (InterruptedException e) { 56 | e.printStackTrace(); 57 | } 58 | } 59 | } 60 | 61 | // output: 62 | // 2 63 | // 1 64 | // 0 65 | // Waiter Released -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/src/DecoratorDemo.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class DecoratorDemo { 4 | public static void main(String[] args){ 5 | MyPizza basicPizza = new Ham(new TomatoSauce(new Cheese(new PlainPizza()))); 6 | System.out.println("Ingredients: " + basicPizza.ingredients()); 7 | System.out.println("Price: " + basicPizza.getCost()); 8 | } 9 | } 10 | 11 | interface MyPizza { 12 | public String ingredients(); 13 | public double getCost(); 14 | } 15 | 16 | class PlainPizza implements MyPizza { 17 | public String ingredients() { 18 | return "dough"; 19 | } 20 | 21 | public double getCost() { 22 | return 4.00; 23 | } 24 | } 25 | 26 | abstract class ToppingDecorator implements MyPizza { 27 | protected MyPizza tempPizza; 28 | 29 | public ToppingDecorator(MyPizza newPizza){ 30 | tempPizza = newPizza; 31 | } 32 | 33 | public String ingredients() { 34 | return tempPizza.ingredients(); 35 | } 36 | 37 | public double getCost() { 38 | return tempPizza.getCost(); 39 | } 40 | } 41 | 42 | class Cheese extends ToppingDecorator { 43 | 44 | public Cheese(MyPizza newPizza) { 45 | super(newPizza); 46 | } 47 | 48 | public String ingredients(){ 49 | return tempPizza.ingredients() + ", cheese"; 50 | } 51 | 52 | public double getCost(){ 53 | return tempPizza.getCost() + 2.00; 54 | } 55 | } 56 | 57 | class TomatoSauce extends ToppingDecorator { 58 | 59 | public TomatoSauce(MyPizza newPizza) { 60 | super(newPizza); 61 | } 62 | 63 | public String ingredients(){ 64 | return tempPizza.ingredients() + ", tomato sauce"; 65 | } 66 | 67 | public double getCost(){ 68 | return tempPizza.getCost() + .35; 69 | } 70 | } 71 | 72 | class Ham extends ToppingDecorator { 73 | 74 | public Ham(MyPizza newPizza) { 75 | super(newPizza); 76 | } 77 | 78 | public String ingredients(){ 79 | return tempPizza.ingredients() + ", ham"; 80 | } 81 | 82 | public double getCost(){ 83 | return tempPizza.getCost() + 4.00; 84 | } 85 | } -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/src/DiningPhil1.java: -------------------------------------------------------------------------------- 1 | import java.util.Random; 2 | import java.util.concurrent.locks.ReentrantLock; 3 | 4 | 5 | // Locking policy: Each Fork1 object has a reentrant lock that 6 | // abstracts the availability of the lock. Since deadlock can only happen 7 | // if each Philosopher is holding on to one fork and waiting for a held Fork1, 8 | // if all 5 Philosophers hold on to forks on the same hand, e.g. left, 9 | // no forks would be left. If they try to get a Fork on the right, 10 | // then they would fail and release the left one. This solution prevents 11 | // deadlock and can be implemented either on the left or right hands. 12 | 13 | public class DiningPhil1 { 14 | 15 | private static int N = 5; 16 | 17 | public static void main (String[] args) throws Exception { 18 | Philosopher1[] phils = new Philosopher1[N]; 19 | Fork1[] forks = new Fork1[N]; 20 | 21 | for (int i = 0; i < N; i++) { 22 | forks[i] = new Fork1(i); 23 | } 24 | 25 | for (int i = 0; i < N; i++) { 26 | phils[i] = new Philosopher1 (i, forks[i], forks[(i+N-1)%N]); 27 | phils[i].start(); 28 | } 29 | } 30 | } 31 | 32 | class Philosopher1 extends Thread { 33 | private final int index; 34 | private final Fork1 left; 35 | private final Fork1 right; 36 | 37 | public Philosopher1 (int index, Fork1 left, Fork1 right) { 38 | this.index = index; 39 | this.left = left; 40 | this.right = right; 41 | } 42 | 43 | public void run() { 44 | Random randomGenerator = new Random(); 45 | try { 46 | while (true) { 47 | // Lock left, then tryLock right. 48 | Thread.sleep(randomGenerator.nextInt(100)); //not sleeping but thinking 49 | System.out.println("Phil " + index + " finishes thinking."); 50 | left.lock.lock(); 51 | System.out.println("Phil " + index + " locks left."); 52 | left.pickup(); 53 | System.out.println("Phil " + index + " picks up left Fork1."); 54 | System.out.println("Phil " + index + " tries to lock right."); 55 | boolean lockRight; 56 | if (lockRight = right.lock.tryLock()) { 57 | System.out.println("Phil " + index + " locks right."); 58 | right.pickup(); 59 | System.out.println("Phil " + index + " picks up right Fork1."); 60 | } 61 | Thread.sleep(randomGenerator.nextInt(100)); //eating 62 | System.out.println("Phil " + index + " finishes eating."); 63 | left.putdown(); 64 | System.out.println("Phil " + index + " puts down left Fork1."); 65 | left.lock.unlock(); 66 | System.out.println("Phil " + index + " unlocks left."); 67 | if (lockRight) { 68 | right.putdown(); 69 | System.out.println("Phil " + index + " puts down right Fork1."); 70 | right.lock.unlock(); 71 | System.out.println("Phil " + index + " unlocks right."); 72 | } 73 | } 74 | } catch (InterruptedException e) { 75 | System.out.println("Don't disturb me while I am sleeping, well, thinking."); 76 | } 77 | } 78 | } 79 | 80 | class Fork1 { 81 | private final int index; 82 | private boolean isAvailable = true; 83 | public ReentrantLock lock = new ReentrantLock(); 84 | 85 | public Fork1 (int index) { 86 | this.index = index; 87 | } 88 | 89 | public synchronized void pickup () throws InterruptedException { 90 | while (!isAvailable) { 91 | wait(); 92 | } 93 | 94 | isAvailable = false; 95 | notifyAll(); 96 | } 97 | 98 | public synchronized void putdown() throws InterruptedException { 99 | while (isAvailable) { 100 | wait(); 101 | } 102 | 103 | isAvailable = true; 104 | notifyAll(); 105 | } 106 | 107 | public String toString () { 108 | if (isAvailable) { 109 | return "Fork " + index + " is available."; 110 | } 111 | else { 112 | return "Fork " + index + " is NOT available."; 113 | } 114 | } 115 | } -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/src/FutureRenderer2.java: -------------------------------------------------------------------------------- 1 | public class FutureRenderer2 { 2 | private final ExecutorService executor = new ScheduledThreadPoolExecutor (100); 3 | 4 | void renderPage (CharSequence source) throws Exception { 5 | final List imageInfos = scanForImageInfo(source); 6 | 7 | Callable> task = new Callable>() { 8 | public List call () { 9 | List result = new ArrayList(); 10 | for (ImageInfo imageInfo : imageInfos) { 11 | result.add(imageInfo.downloadImage()); 12 | } 13 | 14 | return result; 15 | } 16 | }; 17 | 18 | Future> future = executor.submit(task); 19 | renderText(source); 20 | 21 | try { 22 | List imageData = future.get(3, TimeUnit.SECONDS); 23 | for (ImageData data: imageData) { 24 | renderImage(data); 25 | } 26 | } catch (InterruptedException e) { 27 | Thread.currentThread().interrupt(); 28 | future.cancel(true); 29 | } catch (TimeoutException e) { 30 | renderCross(); 31 | } 32 | } 33 | private void renderCross() { /* TODO Auto-generated method stub */ } 34 | private void renderImage(ImageData data) { /* TODO Auto-generated method stub */ } 35 | private void renderText(CharSequence source) { /* TODO Auto-generated method stub */ } 36 | private List scanForImageInfo(CharSequence source) { return null; } 37 | } -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/src/ISTDWebsiteClickRandomLink.java: -------------------------------------------------------------------------------- 1 | import org.openqa.selenium.By; 2 | import org.openqa.selenium.StaleElementReferenceException; 3 | import org.openqa.selenium.WebDriver; 4 | import org.openqa.selenium.WebElement; 5 | import org.openqa.selenium.chrome.ChromeDriver; 6 | 7 | import java.util.Random; 8 | 9 | public class ISTDWebsiteClickRandomLink { 10 | 11 | public static void main(String[] args) throws InterruptedException { 12 | System.setProperty("webdriver.chrome.driver","/Users/Joel/Desktop/SUTD/Term 5/50.003 Elements of Software Construction/chromedriver.exe"); 13 | WebDriver driver = new ChromeDriver(); 14 | 15 | driver.get("https://istd.sutd.edu.sg"); 16 | Random rand = new Random(); 17 | 18 | while (true) { 19 | // get all the links 20 | java.util.List links = driver.findElements(By.tagName("a")); 21 | System.out.println(links.size()); 22 | 23 | // click a random link 24 | int nextLink = rand.nextInt(links.size()); 25 | System.out.println("*** Navigating to" + " " + links.get(nextLink).getAttribute("href")); 26 | if (links.get(nextLink).getAttribute("href") == null) continue; 27 | 28 | try { 29 | driver.navigate().to(links.get(nextLink).getAttribute("href")); 30 | Thread.sleep(3000); 31 | //driver.navigate().back(); 32 | System.out.println("*** Navigated to" + " " + links.get(nextLink).getAttribute("href")); 33 | //staleElementLoaded = false; 34 | } catch (StaleElementReferenceException e) { 35 | //staleElementLoaded = true; 36 | } 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/src/ObserverPattern.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | import java.util.List; 3 | 4 | class Subject { 5 | private List observers = new ArrayList(); 6 | private int state; 7 | 8 | public int getState() { 9 | return state; 10 | } 11 | 12 | public void setState(int state) { 13 | this.state = state; 14 | notifyAllObservers(); 15 | } 16 | 17 | public void attach(Observer observer){ 18 | observers.add(observer); 19 | } 20 | 21 | public void notifyAllObservers(){ 22 | for (Observer observer : observers) { 23 | observer.update(); 24 | } 25 | } 26 | } 27 | 28 | abstract class Observer { 29 | protected Subject subject; 30 | public abstract void update(); 31 | } 32 | 33 | 34 | // two concrete implementations of the observer class 35 | 36 | class BinaryObserver extends Observer{ 37 | 38 | public BinaryObserver(Subject subject){ 39 | this.subject = subject; 40 | this.subject.attach(this); 41 | } 42 | 43 | @Override 44 | public void update() { 45 | System.out.println( "Binary String: " + Integer.toBinaryString( subject.getState() ) ); 46 | } 47 | } 48 | 49 | class OctalObserver extends Observer{ 50 | 51 | public OctalObserver(Subject subject){ 52 | this.subject = subject; 53 | this.subject.attach(this); 54 | } 55 | 56 | @Override 57 | public void update() { 58 | System.out.println( "Octal String: " + Integer.toOctalString( subject.getState() ) ); 59 | } 60 | } 61 | 62 | public class ObserverPattern { 63 | public static void main(String[] args) { 64 | Subject subject = new Subject(); 65 | 66 | new OctalObserver(subject); 67 | new BinaryObserver(subject); 68 | 69 | System.out.println("First state change: 15"); 70 | subject.setState(15); 71 | System.out.println("Second state change: 10"); 72 | subject.setState(10); 73 | } 74 | } 75 | 76 | // output 77 | // First state change: 15 78 | // Octal String: 17 79 | // Binary String: 1111 80 | // Second state change: 10 81 | // Octal String: 12 82 | // Binary String: 1010 -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/src/ParameterizedTest.java: -------------------------------------------------------------------------------- 1 | import org.junit.*; 2 | import org.junit.runner.RunWith; 3 | import org.junit.runners.Parameterized; 4 | import org.junit.runners.Parameterized.Parameters; 5 | import static org.junit.Assert.*; 6 | import java.util.*; 7 | 8 | // include this for running parameterized tests 9 | @RunWith(Parameterized.class) 10 | 11 | public class ParameterizedTest { 12 | public int sum, a, b; 13 | 14 | // classic constructor 15 | public ParameterizedTest (int sum, int a, int b) { 16 | this.sum = sum; 17 | this.a = a; 18 | this.b = b; 19 | } 20 | 21 | // decide the list of parameters to be sent to the class 22 | @Parameters public static Collection parameters() { 23 | return Arrays.asList (new Object [][] {{0, 0, 0}, {2, 1, 1}}); 24 | } 25 | 26 | // This test is invoked for each of the parameter sent via parameters() 27 | @Test public void additionTest() { 28 | assertEquals(sum, Sum.sum(a, b)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/src/PizzaStore.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class PizzaStore { 4 | 5 | public static void main(String[] args) { 6 | Scanner sc = new Scanner(System.in); 7 | String whichPizza = ""; 8 | System.out.print("What type of pizza? cheese/greek/pepperoni: "); 9 | 10 | if (sc.hasNextLine()){ 11 | whichPizza = sc.nextLine(); 12 | } 13 | 14 | PizzaFactory factory = new PizzaFactory(); 15 | Pizza pizza = factory.makePizza(whichPizza); 16 | pizza.prepare(); 17 | pizza.bake(); 18 | pizza.cut(); 19 | pizza.box(); 20 | } 21 | } 22 | 23 | class PizzaFactory { 24 | 25 | public Pizza makePizza(String type) { 26 | Pizza pizza = null; 27 | String log = ""; 28 | if (type.equals("cheese")) { 29 | pizza = new CheesePizza(); 30 | log = "Made pizza of type " + pizza.getClass().getSimpleName(); 31 | } 32 | else if (type.equals("greek")) { 33 | pizza = new GreekPizza(); 34 | log = "Made pizza of type " + pizza.getClass().getSimpleName(); 35 | } 36 | else if (type.equals("pepperoni")) { 37 | pizza = new PepperoniPizza(); 38 | log = "Made pizza of type " + pizza.getClass().getSimpleName(); 39 | } else { 40 | pizza = new CheesePizza(); 41 | log = "We don't serve " + type +", instead we made you a " + pizza.getClass().getSimpleName(); 42 | } 43 | System.out.println(log); 44 | return pizza; 45 | } 46 | } 47 | 48 | class Pizza { 49 | 50 | public void prepare() { 51 | } 52 | 53 | public void box() { 54 | } 55 | 56 | public void cut() { 57 | } 58 | 59 | public void bake() { 60 | } 61 | } 62 | 63 | class CheesePizza extends Pizza {} 64 | class GreekPizza extends Pizza {} 65 | class PepperoniPizza extends Pizza {} 66 | 67 | -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/src/StrategyPattern.java: -------------------------------------------------------------------------------- 1 | interface Strategy { 2 | public int doOperation(int num1, int num2); 3 | } 4 | 5 | //Create concrete classes implementing the same interface. 6 | class OperationAdd implements Strategy{ 7 | @Override 8 | public int doOperation(int num1, int num2) { 9 | return num1 + num2; 10 | } 11 | } 12 | class OperationSubstract implements Strategy{ 13 | @Override 14 | public int doOperation(int num1, int num2) { 15 | return num1 - num2; 16 | } 17 | } 18 | class OperationMultiply implements Strategy{ 19 | @Override 20 | public int doOperation(int num1, int num2) { 21 | return num1 * num2; 22 | } 23 | } 24 | 25 | // create a context 26 | class Context { 27 | private Strategy strategy; 28 | 29 | public Context(Strategy strategy){ 30 | this.strategy = strategy; 31 | } 32 | 33 | public int executeStrategy(int num1, int num2){ 34 | return strategy.doOperation(num1, num2); 35 | } 36 | } 37 | 38 | // Use the Context to see change in behaviour when it changes its Strategy. 39 | public class StrategyPattern { 40 | public static void main(String[] args) { 41 | Context context = new Context(new OperationAdd()); 42 | System.out.println("10 + 5 = " + context.executeStrategy(10, 5)); 43 | 44 | context = new Context(new OperationSubstract()); 45 | System.out.println("10 - 5 = " + context.executeStrategy(10, 5)); 46 | 47 | context = new Context(new OperationMultiply()); 48 | System.out.println("10 * 5 = " + context.executeStrategy(10, 5)); 49 | } 50 | } 51 | 52 | // output 53 | // 10 + 5 = 15 54 | // 10 - 5 = 5 55 | // 10 * 5 = 50 -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/src/TestWithMock.java: -------------------------------------------------------------------------------- 1 | import org.junit.Test; 2 | import org.jmock.Mockery; 3 | import org.jmock.integration.junit4.JUnit4Mockery; 4 | 5 | import org.jmock.Expectations; 6 | 7 | public class TestWithMock { 8 | @Test 9 | public void testCalculatingMachine() { 10 | // create the context to mock classes 11 | Mockery context = new JUnit4Mockery(); 12 | 13 | // mock the classes that are not implemented yet 14 | final Printer printer = context.mock(Printer.class); 15 | final Calculator calculator = context.mock(Calculator.class); 16 | 17 | //provide expectations in the test execution 18 | //@oneOf: one invocation of the function is expected 19 | //@never: the invocation must never happen 20 | //@will(returnValue): will expect the return value specified by the argument 21 | context.checking(new Expectations() {{ 22 | oneOf(calculator).add(1, 2); 23 | // never(printer).print("result is 3"); 24 | // will(returnValue(3)); 25 | // oneOf(printer).print("result is 3"); 26 | }}); 27 | 28 | // what follows is the test execution 29 | CalculatingMachine machine = new CalculatingMachine(printer, calculator); 30 | machine.processAdd(1, 2); 31 | 32 | // fails the above test execution if any expectation is violated 33 | context.assertIsSatisfied(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/src/VisitorPatternOriginal.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | 3 | public class VisitorPatternOriginal { 4 | 5 | public static void main(String[] args){ 6 | SUTD oneSUTD = new SUTD (); 7 | 8 | ArrayList employee = oneSUTD.getEmployee(); 9 | AttributeDisplay disp = new AttributeDisplay(); 10 | 11 | // for each element implementing the interface with accept(), 12 | // pass in the functionality, which reacts to the type of element 13 | // and executes the appropriate operation 14 | for (int i =0; i < employee.size(); i++) { 15 | System.out.printf(employee.get(i).getClass().getSimpleName() + ": "); 16 | employee.get(i).accept(disp); 17 | } 18 | } 19 | } 20 | 21 | class SUTD { 22 | private ArrayList employee; 23 | 24 | public SUTD () { 25 | employee = new ArrayList(); 26 | employee.add(new Professor("Sun Jun", 0)); 27 | employee.add(new AdminStaff("Stacey", 5)); 28 | employee.add(new Student("Allan", 3)); 29 | } 30 | public ArrayList getEmployee () { 31 | return employee; 32 | } 33 | } 34 | 35 | // the visitor interface provides a schematic 36 | // to do different actions depending on 37 | // the type of element 38 | interface Visitor { 39 | void showAttributes(Professor prof); 40 | void showAttributes(AdminStaff staff); 41 | void showAttributes(Student student); 42 | } 43 | 44 | // concrete implementation of a visitor 45 | // this visitor displays different attributes 46 | // for different classes passed into it 47 | class AttributeDisplay implements Visitor { 48 | 49 | public void showAttributes(Professor prof) { 50 | System.out.printf(prof.getName() + ", "); 51 | System.out.println(prof.getNo_of_publications() + " publications"); 52 | } 53 | public void showAttributes(AdminStaff staff) { 54 | System.out.printf(staff.getName() + ", "); 55 | System.out.println(staff.getEfficiency() + " efficiency"); 56 | } 57 | public void showAttributes(Student student) { 58 | System.out.printf(student.getName() + ", "); 59 | System.out.println(student.getGPA() + " GPA"); 60 | } 61 | } 62 | 63 | // the abstract element to receive the changes 64 | // it has to accept a visitor, which specifies 65 | // the different operations we want to introduce 66 | interface Employee { 67 | void accept(Visitor v); 68 | } 69 | 70 | // concrete implementations of the elements. 71 | // when accept() is called, 'this' is passed to 72 | // the visitor and the appropriate operation is 73 | // executed. Notice that we did not have to modify 74 | // the classes and add each operation as a method. 75 | class Professor implements Employee { 76 | private String name; 77 | private int no_of_publications; 78 | 79 | public Professor (String name, int no_of_publications) { 80 | this.name = name; 81 | this.no_of_publications = no_of_publications; 82 | } 83 | public String getName () { 84 | return name; 85 | } 86 | public int getNo_of_publications() { 87 | return no_of_publications; 88 | } 89 | public void accept(Visitor v) { 90 | v.showAttributes(this); 91 | } 92 | } 93 | 94 | class AdminStaff implements Employee { 95 | private String name; 96 | private float efficiency; 97 | 98 | public AdminStaff (String name, float efficiency) { 99 | this.name = name; 100 | this.efficiency = efficiency; 101 | } 102 | public String getName() { 103 | return name; 104 | } 105 | public float getEfficiency() { 106 | return efficiency; 107 | } 108 | public void accept(Visitor v) { 109 | v.showAttributes(this); 110 | } 111 | } 112 | 113 | class Student implements Employee { 114 | private String name; 115 | private float GPA; 116 | 117 | public Student (String name, float GPA) { 118 | this.name = name; 119 | this.GPA = GPA; 120 | } 121 | public String getName() { 122 | return name; 123 | } 124 | public float getGPA() { 125 | return GPA; 126 | } 127 | public void accept(Visitor v) { 128 | v.showAttributes(this); 129 | } 130 | } 131 | 132 | // output 133 | // Professor: Sun Jun, 0 publications 134 | // AdminStaff: Stacey, 5.0 efficiency 135 | // Student: Allan, 3.0 GPA -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/src/generalized_fuzzer.py: -------------------------------------------------------------------------------- 1 | from random import randint 2 | 3 | inp = open("generalized_fuzzer_input") 4 | line_array = inp.read().splitlines() 5 | 6 | def swap(line): 7 | if (len(line) < 2): 8 | print("can't swap if only 1 char") 9 | return 10 | # implementation from ex.3 (mutation.py) 11 | position = randint(0,len(line)-2) 12 | left = line[:position] + line[position+1] 13 | right = line[position] + line[position+2:] 14 | print("swapped: "+line+ " -> "+left+right) 15 | 16 | def trim(line): 17 | if (len(line) < 2): 18 | print("can't trim if only 1 char") 19 | return 20 | position = randint(0,len(line)-2) 21 | trimmed = "trimmed: " + line + " -> " + line[:position] 22 | print(trimmed) 23 | 24 | def flip(line): 25 | flipped = "" 26 | for char in line: 27 | # choose random index to flip 28 | index = randint(0,6) 29 | binary = bin(ord(char))[2:] 30 | # ascii space is 32=2^5, so need to add a 0 in front 31 | if (len(binary) == 6): 32 | binary = "0" + binary 33 | if (binary[index] == '0'): 34 | binary = binary[:index] + '1' + binary[index+1:] 35 | elif (binary[index] == '1'): 36 | binary = binary[:index] + '0' + binary[index+1:] 37 | flipped += chr(int(binary,2)) 38 | print("flipped: " + line + " -> "+ flipped) 39 | 40 | # randomly choose a mutation 41 | mutations = { 42 | 0: swap, 43 | 1: trim, 44 | 2: flip 45 | } 46 | 47 | for line in line_array: 48 | mut = randint(0,len(mutations)-1) 49 | mutations[mut](line) -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2018-Joel/esc_notes_joel_src/src/simple-fuzzer.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main() { 7 | char* input; 8 | int index; 9 | 10 | // strings of 32 11 | srand(time(NULL)); 12 | int string_length = 32; 13 | 14 | //allocate memory for the input 15 | input = (char *) malloc ((string_length+1) * sizeof(char)); 16 | 17 | //generate a random character at each location of the string 18 | for (index = 0; index < string_length; index++) { 19 | double between_0_and_1 = (double)rand() / (double)RAND_MAX; 20 | //generate a character between ASCII 32 and 128 21 | input[index] = (int)(between_0_and_1 * 96 + 32); 22 | } 23 | input[string_length] = '\0'; 24 | // here is the input string to fuzz 25 | printf("%s\n", input); 26 | } 27 | -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2019-Siew Wen/50.003_Finals_Revision_Compiled.md: -------------------------------------------------------------------------------- 1 | # 50.003 Finals Revision 2 | 3 | As there are a lot of contents to be revised for finals, I've split up the original document into individual pages instead. 4 | 5 | Table of Contents 6 | - [Concurrency](50.003__Finals_Revision_Concurrency.md) 7 | - [UML](50.003__Finals_Revision_UML.md) 8 | - [Refactoring](50.003_Finals_Revision_Refactoring.md) 9 | - [Designing Test Cases](50.003_Finals_Revision_Test_Design.md) 10 | 11 | 12 | *Credits:* 13 | - [UMLDiagrams.org](https://www.uml-diagrams.org/use-case-diagrams.html) - UML Use Case Diagram 14 | - [Journal of Systems & Software](https://www.sciencedirect.com/science/article/pii/S0164121213002458) - UML Misuse Case Diagram 15 | - [LucidCharts](https://www.lucidchart.com/pages/uml-class-diagram) - UML Class Diagrams 16 | - [LucidCharts](https://www.youtube.com/watch?v=pCK6prSq8aw) - UML Sequence Diagram 17 | - [Guru99](https://www.guru99.com/equivalence-partitioning-boundary-value-analysis.html) - Equivalence Class Partitioning & Boundary Value Testing 18 | - [Tester Stories](http://testerstories.com/2014/06/path-testing-the-coverage/) - Control Flow Graphs 19 | - [StackOverflow](https://stackoverflow.com/questions/22351222/can-we-change-the-value-of-a-final-variable-of-a-mutable-class) - OBJ04-J's explanation on the`final` term 20 | - [Jenkov Java Concurrency Tutorials](http://tutorials.jenkov.com/java-concurrency/index.html) for some general concepts 21 | - [HowToDoInJava](https://howtodoinjava.com/java/multi-threading/best-practices-for-using-concurrenthashmap/) for CountDownLatchExample. 22 | - [JavaEUSpecialists](https://www.javaspecialists.eu/archive/Issue257.html) for CyclicBarrierExample & PhaserExample 23 | *(i renamed and changed some stuff for easier readibility)* 24 | - [Netjs](https://netjs.blogspot.com/2016/01/phaser-in-java-concurrency.html) for Phaser Explanation 25 | - 50.003 Elements of Software Construction Slides - Syllabus and some content 26 | - [Prof Sudipta](https://istd.sutd.edu.sg/people/faculty/sudipta-chattopadhyay) - Comments on Finals 27 | - [Lyqht](https://github.com/lyqht) - Compilation 28 | 29 | 30 | 31 | *not testing for 2019 ESC Finals:* 32 | - Software engineering process e.g. water fall, agile, time-based 33 | - testing tools eg. junit, selenium, evosuite, klee 34 | 35 | -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2019-Siew Wen/50.003_Finals_Revision_UML.md: -------------------------------------------------------------------------------- 1 | Table of contents 2 | - [UML Diagram Types](#uml-diagram-types) 3 | - [Use Case Diagram](#use-case-diagram) 4 | - [Limitations](#limitations) 5 | - [Sequence Diagram](#sequence-diagram) 6 | - [State Diagram](#state-diagram) 7 | - [Class Diagram](#class-diagram) 8 | - [Association](#association) 9 | - [Multiplicity](#multiplicity) 10 | # UML Diagram Types 11 | 12 | ![](https://i.imgur.com/AaMyHoG.png) 13 | 14 | > - You will be given a requirement, then you have to model each of the diagrams below. 15 | > - It is important that you finish all the UML exercises for the telephone network. These were not part of the PSET. Thus, I am assuming that many did not do it. This is probably the time to do. Do not look at the answers, try to do it yourself. As per as UML is concerned, there are way too many correct answers. While grading, we aim to find things that are WRONG, rather than matching through a pre-computed correct answer. 16 | > - Ones highlighted in red are those that are taught in class. 17 | 18 | 19 | ## Use Case Diagram 20 | A use case shows a set of use cases and actors and their relationships and represent system functionality, the requirements of the system from the user’s respective. 21 | 22 | 23 | - Use Case 24 | - A description of a set of sequences of actions, including variants, that system performs that yields an observable value to an actor. 25 | - Should ideally begin with a verb. 26 | - Think of the end goal of a user. They don't want to "login" or "sign up." That's not a use case. The use case is more like "make a purchase." 27 | 28 | - Actors 29 | - People or systems that provide or receive information from the system; they are among the stakeholders of a system, which could be human beings, other systems, timers and clocks or hardware devices. 30 | - Primary Actors: stimulate the system and are the initiators of events (active). 31 | - Secondary Actors: only receive stimuli from the system (passive). 32 | 33 | ***example***: of use case diagram 34 | ![](https://i.imgur.com/hUpEqb6.png) 35 | 36 | The customer makes many checkouts and for any payment he makes, there is only one payment service in charge of it. While checking out, he might require help and by checking out, he would need to make a payment. 37 | 38 | > **!! Note**: Usually multiplicity is not required for use case diagrams, but mandatory in class diagrams. 39 | 40 | ### Limitations 41 | - Use cases only capture how a system is used 42 | - Use cases do not consider adversarial scenarios 43 | - Abusing system functionality 44 | - Hacking and malfunctioning 45 | - In general, any non-functional requirement, especially security 46 | - Clients and customers are unlikely to provide misuse cases, the onus is on the software engineers. Hence the need for misuse case diagrams arises. 47 | 48 | ***example***: misuse diagram 49 | ![](https://i.imgur.com/8I5xVRe.png) 50 | 51 | ## Sequence Diagram 52 | ![](https://i.imgur.com/a2YUI9A.png) 53 | 54 | ## State Diagram 55 | > If I ask to draw state diagram, I will not tell you the number of states or the names of the states. Thus, you need to pay attention on how to figure out states in a state machine from arbitrary requirement. - Sudipta 56 | 57 | ***example***: state diagram 58 | 59 | ![](https://i.imgur.com/TMOAiod.png) 60 | 61 | 62 | ## Class Diagram 63 | > Understand the concepts of multiplicity and association clearly. These two are the most complex concepts as per as class diagram is concerned. - Sudipta 64 | 65 | ### Association 66 | | Type of Association | ***example***: | 67 | | ------------------- | ------------------------------------ | 68 | | Bidirectional | ![](https://i.imgur.com/jOzEg6r.png) | 69 | | Unidirectional | ![](https://i.imgur.com/JJduILa.png) | 70 | | Inheritance | ![](https://i.imgur.com/NBavVIx.png) | 71 | | Implement Interface | ![](https://i.imgur.com/XkPd9UG.png) | 72 | 73 | ### Multiplicity 74 | ![](https://i.imgur.com/u2aZ07q.png) 75 | 76 | ***example***: extensive multiplicity 77 | ![](https://i.imgur.com/joY9JqV.png) 78 | 79 | *Member Access Modifier Symbols:* 80 | Public (+) 81 | Private (-) 82 | Protected (#) 83 | Package (~) 84 | Derived (/) 85 | Static (underlined) 86 | -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2019-Siew Wen/50.003_Finals_notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.003 Elements of Software Construction/2019-Siew Wen/50.003_Finals_notes.pdf -------------------------------------------------------------------------------- /notes/50.003 Elements of Software Construction/2019-Siew Wen/basic-control-flow-graphs.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.003 Elements of Software Construction/2019-Siew Wen/basic-control-flow-graphs.jpg -------------------------------------------------------------------------------- /notes/50.005 Computer System Engineering/2018-Shaun,Joel/cse_notes_shaun.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.005 Computer System Engineering/2018-Shaun,Joel/cse_notes_shaun.pdf -------------------------------------------------------------------------------- /notes/50.005 Computer System Engineering/2019-Siew Wen/50.005_notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.005 Computer System Engineering/2019-Siew Wen/50.005_notes.pdf -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/50.012_finals_summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/50.012_finals_summary.pdf -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/50.012_midterms_summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/50.012_midterms_summary.pdf -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/50.012_notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/50.012_notes.pdf -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/Extras.md: -------------------------------------------------------------------------------- 1 | - [The Internet - Networks of networks](#the-internet---networks-of-networks) 2 | - [Broadband Access](#broadband-access) 3 | - [Digital Subscriber Line (DSL)](#digital-subscriber-line-dsl) 4 | - [Cable - Hybrid Fiber Coax (HFC)](#cable---hybrid-fiber-coax-hfc) 5 | - [Fiber to The Home (FTTH)](#fiber-to-the-home-ftth) 6 | - [Optical Network Architectures](#optical-network-architectures) 7 | - [The evolution of routers](#the-evolution-of-routers) 8 | - [Interface Message Processors (IMP)](#interface-message-processors-imp) 9 | - [DARPA Design Policy](#darpa-design-policy) 10 | 11 | # The Internet - Networks of networks 12 | 13 | ## Broadband Access 14 | 15 | Today, the most prevalent types of broadband residential access are digital subscriber line and cable. However, Fiber to The Home internet access is now rapidly gaining popularity as well in first world countries. If these 3 methods of access are unavailable then satellite link or dial-up access can also be used to connect residences, but these won't be covered in the notes. 16 | 17 | ### Digital Subscriber Line (DSL) 18 | 19 | 1. A residence obtain DSL Internet access from a telco. 20 | 2. The customer's telco is then its Internet Service Provider (ISP). 21 | 3. The home's DSL modem takes digital data and translate it to high frequency tones fortransmission over telephone wires to the Central Office 22 | 4. The Central Office hosts a DSLAM where the analog signals from theseh ouses are translated back to digital data. 23 | 5. The telephone line carries data and telephone signals simultaneously, in different speed channels. This is also known as frequency-division multiplexing, resulting in asymmetric access. 24 | - High speed downstream channel => 50kHz - 1m MHz 25 | - Medium speed upstream channel => 4 kHz - 50 kHz 26 | - 2-way telephone channel => 0 - 4 kHz 27 | 28 | ### Cable - Hybrid Fiber Coax (HFC) 29 | 30 | - It is a shared broadcast medium that makes use of the cable's tv company's existing cable tv infrastructure. 31 | - Hundreds of homes are connected via coaxial cable to a neighborhood junction. which is also connectedto a higher tier ISP (global ISP). 32 | - Cable modems are required in homes to access cable internet 33 | - Connects the home PC through an Ethernet port. 34 | - Divides the HFC network into a downstream and upstream channel. 35 | - Each packet sent by the cable head end travels downstream on every link 36 | - Each packet sent by a home travels upstream to the head end. 37 | 38 | ### Fiber to The Home (FTTH) 39 | 40 | - The mainstream mode of internet access nowadays 41 | - A optical fiber path is provided from the Central Office directly to home. Usually many homes share a single fiber from the CO, but when the fiber gets relatively close to the homes, then it is split into individual customer-specific fibers. This splitting can be done through 2 different architectures. 42 | 43 | #### Optical Network Architectures 44 | 45 | 1. Active Optical Networks (AONs): switched Ethernet (_covered later_) 46 | 2. Passive Optical Networks (PON) 47 | 1. Each home has an optical network terminator (ONT) which is connected by dedicated optical fiber to a neighborhood splitter. 48 | 2. The splitter combines the homes onto a single, shared optical fiber which connects to an optical line terminator (OLT) 49 | 50 | ## The evolution of routers 51 | 52 | ### Interface Message Processors (IMP) 53 | 54 | The IMP are the First Generation of Routers. 55 | 56 | ## DARPA Design Policy 57 | 58 | [Anatomy of a data packet](https://www.techrepublic.com/article/exploring-the-anatomy-of-a-data-packet/) 59 | -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/Finals-Summary.md: -------------------------------------------------------------------------------- 1 | # Finals Summary 2 | 3 | | Topic | Specific Notes | 4 | | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 5 | | TCP Congestion Control | [Lecture 10 - Congestion Control](Lecture10-CongestionControl.md),
[Lecture 11 - TCP Wrapup](Lecture11-TCPWrapup.md) | 6 | | Network Layer | [Lecture13 - Network Layer Overview](Lecture13-NetworkLayerOverview.md),
[Lecture14 - IP Addressing](Lecture14-IPAddressing.md),
[Lecture15 - Routing Algorithms](Lecture15-RoutingAlgorithms.md),
[Lecture16 - Routing](Lecture16-Routing.md) | 7 | | Link Layer & Synthesis | [Lecture19 - Link Layer](Lecture19-Link_Layer.md) | 8 | | Wireless and Mobile Networks | [Lecture21 - Wireless Networks](Lecture21-WirelessNetworks.md) | -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/Lecture1-TransportLayer.md: -------------------------------------------------------------------------------- 1 | # Transport-layer service models 2 | - [Transport-layer service models](#transport-layer-service-models) 3 | - [Protocols](#protocols) 4 | - [TCP/UDP](#tcpudp) 5 | - [Client-server Architecture](#client-server-architecture) 6 | - [Peer-to-peer Architecture](#peer-to-peer-architecture) 7 | - [Electronic Mail](#electronic-mail) 8 | - [Mail Access Protocol](#mail-access-protocol) 9 | - [Processes](#processes) 10 | - [Message Segmentation](#message-segmentation) 11 | 12 |
13 | 14 | **Transport service requirements** 15 | 16 | - Data loss 17 | - Throughput 18 | - Time sensitivity 19 | 20 | ## Protocols 21 | 22 | ### TCP/UDP 23 | 24 | | TCP | UDP | 25 | | --------------------------------------------------------------- | ---------------------------------------------------------- | 26 | | reliable transport | unreliable data transfer between sending/receiving process | 27 | | **flow control**: sender won't overwhelm receiver | NIL | 28 | | **congestion control**: throttle sender when network overloaded | NIL | 29 | | **connection-oriented**: setup required btw client/server | no need | 30 | 31 | For both TCP & UDP, there is no encryption of data. Hence we have SSL (Secure Sockets Layer)/ TLS(Transport Layer Security) for providing an encrypted TCP connection, ensuring data integrity and end-point authentication. Apps can use SSL/ TLS APIs to do so. 32 | 33 | ## Client-server Architecture 34 | 35 | Server is always on with permanent IP address. Hosted in data centers for scaling. 36 | Clients communicate with the server and may be intermittently (irregularly) connected with the server. Could have dynamic IP addresses. Clients usually do not communicate directly with each other. 37 | 38 | ## Peer-to-peer Architecture 39 | 40 | - Server is not always on 41 | - Arbitrary End Systems directly communicate: Good for file sharing, overlay-routing 42 | - Principles: 43 | - Fault-tolerant 44 | - Fate-sharing: It's okay to fail if it's your own mistake? 45 | - Self Scalability 46 | - Peers request service from other peers and provide service in return 47 | - New peers bring new service capacity and new service demands 48 | - Challenges: 49 | - Peers are intermittently connected and change IP addresses 50 | - Chunk Poisoning 51 | 52 | ## Electronic Mail 53 | 54 | 3 Major Components: 55 | 56 | 1. User Agents 57 | 2. Mail Servers 58 | 1. Mailbox: contain incoming messages for user 59 | 2. Message Queue: Messages to be sent (outgoing) 60 | 3. Simple Mail Transfer Protocol: SMTP 61 | - uses TCP for sending emails from client to server via port 25 62 | - has 3 phases of transfer: handshake, transfer, closure. 63 | - Requires message to be in 7-bit ASCII 64 | - Uses CRLF.CRLF for determining end of message 65 | 66 | Compared to [HTTP](./Lecture3-HTTP.md), SMTP is a push rather than a pull server. 67 | Both have ASCII command/res interaction, status codes. 68 | 69 | User Agent -> SMTP -> Sender Mail Server -> SMTP -> Receiver's Mail Server -> Mail Access Protocol -> User Agent 70 | 71 | Mail server: forward mail from sender to receiver mail server. if both the client and the receiver mail server are offline, the sender's mail server will keep retrying to send the mail until it works. Back then the mail servers are not so reliable to on all the time. 72 | 73 | ### Mail Access Protocol 74 | 75 | Mail Access protocol is used for retrieval from server 76 | 77 | - POP (Post Office Protocol) 78 | - IMAP (Internet Mail Access Protocol) 79 | - HTTPs 80 | 81 | # Processes 82 | 83 | Definition of a Process: A program running within the host. It must have an identifier that includes IP address, port numbers associated with the process on host. 84 | e.g. HTTP: 80, Mail: 25 85 | 86 | Types of Process Communication 87 | 88 | - Inter-process communication: Dependent on OS 89 | - unless the process is on the application layer, then it is controlled by the app developer. 90 | - Host-to-host communication: Exchange Messages 91 | - Messages are sent/received via sockets. 92 | 93 | Types of processes 94 | 95 | - Client Process: Initiate Communication 96 | - Server Process: Waits to be contacted 97 | 98 | ## Message Segmentation 99 | 100 | - Reducing end-to-end delay. 101 | - More efficient recovery from bit error. Otherwise the whole message needs to eb retransmitted. 102 | - Huge message may block other smaller packets 103 | 104 | - Header overhead linear to the no. of packets 105 | - Cause new problem e.g. out-of-order arrival of packets -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/Lecture10-CongestionControl.md: -------------------------------------------------------------------------------- 1 | # Principles of Flow Control 2 | - Receiver controls sender so the sender won't overflow receiver's buffer by transmitting too much/too fast 3 | - Application may remove data from TCP socket buffers 4 | - Receiver includes a `rwnd` (receiver window) value in TCP header of receiver-to-sender segments 5 | - `RcvBuffer` 6 | 7 | # Principles of Congestion Control 8 | 9 | - Congestion Control $\not ={}$ Flow Control! 10 | - Manifestations 11 | - Buffer Overflow at Routers: Lost Packets 12 | - Queueing in Router buffers: Long Delay 13 | 14 | When packets are lost, any upstream transmission capacity used for that packet is wasted. 15 | 16 | ## Scenario 1: One Router w/ Infinite Buffers 17 | 18 | - Assuming no retransmission 19 | 20 | ## Scenario 2: One Router w/ Finite Buffers 21 | 22 | Assumptions for idealized case 23 | - Sender knows when router buffers available 24 | - Sender sends only when router buffers available 25 | 26 | Transfer rates 27 | - $\lambda_{in} = \lambda_{out}$: Application-layer input = output 28 | - $\lambda_{in}' >= \lambda_{in}$ Transport-layer input includes retransmissions 29 | 30 | 31 | ## TCP Congestion Controls 32 | ### Increase sender's transmission rate until loss occurs 33 | 34 | - Additive Increase: Increase `cwnd` (congestion window) by 1 MSS every RTT until loss detected 35 | - Multiplicate Increase: Reduce `cwnd` in half after loss 36 | -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/Lecture11-TCPWrapup.md: -------------------------------------------------------------------------------- 1 | - [TCP Congestion Control](#tcp-congestion-control) 2 | - [Start Connection: Slow Start](#start-connection-slow-start) 3 | - [Congestion-avoidance state](#congestion-avoidance-state) 4 | - [Explicit Congestion Notification (ECN)](#explicit-congestion-notification-ecn) 5 | - [Network-assisted congestion control](#network-assisted-congestion-control) 6 | - [Calculating TCP Throughput](#calculating-tcp-throughput) 7 | - [Calculating Segment Loss Probability $L$](#calculating-segment-loss-probability-l) 8 | - [TCP Fairness](#tcp-fairness) 9 | - [TCP Connection Management](#tcp-connection-management) 10 | 11 | # TCP Congestion Control 12 | 13 | A summary code for the sections discussed below 14 | ```python 15 | cwnd = MSS 16 | while connected: 17 | if time < slow_start_duration: 18 | cwnd *= 2 19 | if receive_ACK: 20 | cwnd+=MSS 21 | else: # congestion-avoidance state 22 | if receive_ACK: 23 | cwnd += MSS*(MSS/cwnd) 24 | ``` 25 | 26 | ![](pictures/TCPCongestionControl.PNG) 27 | 28 | ## Start Connection: Slow Start 29 | When connection begins, increase rate exponentially until first loss event. (Initial rate is slow but ramps up very fast) 30 | 31 | 1. Initial `cwnd`: 1 MSS (maximum segment size) 32 | 2. Double `cwnd` every RTT 33 | - It is doubled with the formula: $cwnd = cwnd + MSS * \frac{cwnd}{mss}$ 34 | 3. Increment `cwnd` for every ACK received 35 | 36 | ## Congestion-avoidance state 37 | 38 | Window grows exponentially in *slow start* to threshold, then grows linearly during the congestion-avoidance (CA) state. 39 | 40 | - The inexponential increase is switched to linear when `cwnd` gets to half of its value before timeout. 41 | - On loss event, `ssthresh=1/2*cwnd` before loss event. 42 | 43 | In the CA state, the congestion window is increased by $1/k$. 44 | - where $k$ = $\frac{cwnd}{mss}$ 45 | 46 | ## Explicit Congestion Notification (ECN) 47 | 48 | ### Network-assisted congestion control 49 | 50 | - 2 bits in IP header (ToS field) marked by network router to indicate congestion 51 | - Receiver sets ECE bit on ACK to notify sender of congestion 52 | 53 | ## Calculating TCP Throughput 54 | 55 | Ignoring slow start and assuming there is always data to send, 56 | 57 | $$ TCP Throughput = \frac{3}{4}*\frac{W}{RTT} $$ 58 | where 59 | - $W$: window size in bytes where loss occurs 60 | 61 | ![](pictures/TCP_throughput.png) 62 | 63 | ### Calculating Segment Loss Probability $L$ 64 | e.g. given 1500 byte segments, 100ms RTT, 10Gbps throughput, requires average 83,333 in-flight segments 65 | 66 | $$ 10^7 = \frac{1.22*1500}{100*10^{-3}*\sqrt{L}}$$ 67 | $$ L = 2 * 10^{-10} $$ 68 | 69 | ## TCP Fairness 70 | 71 | - Goal: For n TCP sessions sharing same bottleneck link of bandwidth R, each should have $\frac{R}{K}$ rate. 72 | - Implementation via Additive Increase and Multiplicate Decrease 73 | 74 | ![](pictures/tcp_fairness.PNG) 75 | 76 | # TCP Connection Management 77 | 78 | -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/Lecture14-IPAddressing.md: -------------------------------------------------------------------------------- 1 | Table of Contents 2 | - [Intro to IPv4 Addressing](#intro-to-ipv4-addressing) 3 | - [Classless InterDomain Routing (CIDR)](#classless-interdomain-routing-cidr) 4 | - [Dynamic Host Configuration Protocol (DHCP)](#dynamic-host-configuration-protocol-dhcp) 5 | - [Network Address Translation (NAT)](#network-address-translation-nat) 6 | 7 |
8 | 9 | # Intro to IPv4 Addressing 10 | 11 | Hosts/Routers typically has interfaces such as wired Ethernet, wireless 802.11. Interfaces are connections between the host/router and the physical link. 12 | 13 | Since every host and router is capable of sending and receiving IP datagrams, IP requires each host and router interface to have its own IP address. Thus, an IP address is technically associated with an interface, rather than with the host or router containing that interface 14 | 15 | - Each IP is 32 bits long (4 bytes) 16 | - Each byte of the address is written in its decimal form, separated by a period from other bytes in the address. Example: 193.32.216.9 17 | - Total of $2^{32}$ possible IP addresses. 18 | - Each IP address can be assigned to a **subnet**. Example 223.1.1.0 */24* 19 | - The *leftmost* 24 bits of the 32-bit quantity define the subnet address 20 | - So any host that has an IP address of 223.1.1.x can be identified to be under the same subnet. Any additional hosts will also be required to have the address of this format. 21 | 22 | To determine the subnets, detach each interface from its host/router, creating islands of isolated networks. An example is shown below. 23 | 24 | ![](pictures/subnet_example.png) 25 | 26 | > Core routers in Singapore are running on IPv4. Singtel currently has Singtel has OLT vendors which operate on IPv6, and most of their services are IPv6 ready. They have a tunneling protocol for translating IPv6 internally within the Singtel network to IPv4 to these core routers. 27 | 28 | 29 | ## Classless InterDomain Routing (CIDR) 30 | 31 | - Address format: `a.b.c.d/x` 32 | - *x* most significant bits in the address (the prefix) constitute the network portion of the IP address. 33 | - Organizations usually use a range of addresses with a common prefix. 34 | - Hence, when a router outside the organization forwards a datagram whose destination address is inside this organization, they only care about the prefix. 35 | - This **reduces the size of the forwarding table** in the routers, since a single entry of the form `a.b.c.d/x` will be sufficient to forward packets to any destination within organization. 36 | - Sometimes organizations may come together under a subnet for **route aggregation/ route summarization**. 37 | - The remaining *($32-x)* bits are used to distinguish among the devices within the organization. 38 | 39 | > Currently there is around 800k prefixes! 60k networks around the world. Singapore comprise of ~1k networks. 40 | 41 | ## Dynamic Host Configuration Protocol (DHCP) 42 | 43 | DHCP allows host to dynamically obtain its IP address froma network server when it join its network. 44 | 45 | **How it works - DORA** 46 | 47 | 1. Host broadcast "DHCP **D**iscover" msg [optional] 48 | 2. DHCP server hears the broadcast and responds with "DHCP **O**ffer" msg [optional] 49 | 3. Host requests IP address: "DHCP **R**equest" msg 50 | 4. DHCP server sends address: "DHCP **A**ck" msg 51 | 52 | *Example* 53 | 54 | 1. New connecting host sends a DHCP *request* encapsulated in UDP, IP and Ethernet. 55 | 2. The Ethernet frame *broadcast* on LAN, received at router running DHCP server 56 | 3. Ethernet demuxed to IP demuxed, UDP demuxed to DHCP 57 | 4. DHCP server formulates an ACK containing 58 | - client's IP address 59 | - First-hop router for client (if requested) 60 | - Name & IP Address of DNS Server (if requested) 61 | - MASK to determine which portion is the network/host (if requested) 62 | 5. Encapsulation of DHCP server, frame forwarded to client, demuxing up to DHCP at client 63 | 6. Client obtains the info inside ACK. 64 | 65 | ## Network Address Translation (NAT) 66 | 67 | - All datagrams leaving local network must have the same single source NAT IP address, but with different src port numbers 68 | - Replace `(src IP addr, port#)` of every outgoing datagram to `(NAT IP addr, new port#)` 69 | - Record every `(src IP addr, port#)` to `(NAT IP addr, new port#)` translation pair in NAT translation table. 70 | - Allows local network to use just 1 IP for all devices in the network 71 | - The local network can change address of devices in local network without notifying outside world. 72 | - Security: Devices inside local net not explicitly addressable & visible by outside world. 73 | - Allow local network to change ISP without changing addresses of devices in local network -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/Lecture15-RoutingAlgorithms.md: -------------------------------------------------------------------------------- 1 | Table of Contents 2 | 3 | - [Routing Algorithms](#routing-algorithms) 4 | - [Link-state Broadcast Algorithm (LS Algorithm)](#link-state-broadcast-algorithm-ls-algorithm) 5 | - [Properties of the Algorithm](#properties-of-the-algorithm) 6 | - [How it works](#how-it-works) 7 | - [*Time Complexity*](#time-complexity) 8 | - [*Possible Pitfall Scenario - Unequal link costs $c(u,v) \not ={} c(v,y)$*](#possible-pitfall-scenario---unequal-link-costs-mathsemanticsmrowmicmimo-stretchy%22false%22momiumimo-separator%22true%22momivmimo-stretchy%22false%22momo%cc%b8momrowmrowmicmimo-stretchy%22false%22momivmimo-separator%22true%22momiymimo-stretchy%22false%22momrowannotation-encoding%22applicationx-tex%22cuv-not--cvyannotationsemanticsmathcuv%ee%80%a0%e2%80%8bcvy) 9 | - [Distance Vector (DV)](#distance-vector-dv) 10 | - [Properties of the algorithm](#properties-of-the-algorithm-1) 11 | - [Bellman-Ford equation for Least Cost](#bellman-ford-equation-for-least-cost) 12 | - [How it works](#how-it-works-1) 13 | - [Pitfall - Count to infinity problem when a link cost increases](#pitfall---count-to-infinity-problem-when-a-link-cost-increases) 14 | - [Comparison of LS and DV Algorithms](#comparison-of-ls-and-dv-algorithms) 15 | 16 |
17 | 18 | # Routing Algorithms 19 | 20 | ## Link-state Broadcast Algorithm (LS Algorithm) 21 | 22 | ### Properties of the Algorithm 23 | 24 | - Centralized: Use global information. Requires each node to first obtain a complete map of the network before running the Dijkstra algorithm. 25 | 26 | ### How it works 27 | Watch this for explanation of how it the algorithm works: https://www.youtube.com/watch?v=ue-BDS-7Ikw. 28 | 29 | 30 | ### *Time Complexity* 31 | 32 | - Total number of nodes we need to search through over all the iterations is $n(n + 1)/2$ 33 | - First iteration n, 2nd iteration n-1 and so on. 34 | - $n + n-1 + ... + 1 = n(n+1)/2$ 35 | - Hence, **worst case time complexity** = $O(n^2)$ 36 | - If we implement the data structure as a heap, can reduce to logarithmic complexity. 37 | 38 | ### *Possible Pitfall Scenario - Unequal link costs $c(u,v) \not ={} c(v,y)$* 39 | 40 | For most algorithms, it is assumed that the link costs depend on the traffic carried. And here, the load carried on both directions are not equal. 41 | 42 | ![](pictures/djikstra_oscillations.png) 43 | 44 | - Initialization 45 | - Both *x and z* originates a unit of traffic destined for *w*, 46 | - *y* injects an amount of traffic equal to e, also 47 | destined for *w*. 48 | - 1st run 49 | - *y* 50 | - determines that the clockwise path to *w* has a cost of 1, while the counterclockwise path to *w* (which it had been using) has a cost of 1 + e. 51 | - So the least-cost path for *y* is now clockwise. 52 | - *x* 53 | - determines that the least-cost path is also clockwise. 54 | - 2nd run 55 | - *x, y, and z* all detect a zero-cost path to *w* in the 56 | counterclockwise direction, and all route their traffic to the counterclockwise routes. 57 | - 3rd run 58 | - *x, y, and z* all detect a zero-cost path to *w* in the 59 | clockwise direction, and all route their traffic to the clockwise routes. 60 | 61 | *Solutions* 62 | 63 | 1. Mandate that link costs do not depend on the amount of traffic carried 64 | 2. Not all routers run the LS algorithm at the same time 65 | - even though they initially execute the algorithm with the same period but at different instants of time, the algorithm execution instance can eventually become, and remain, synchronized at the routers. To avoid this, randomize the time it sends out a link advertisement. 66 | 67 | ## Distance Vector (DV) 68 | 69 | ### Properties of the algorithm 70 | - Iterative 71 | - this process continues on until no more information is exchanged between neighbors 72 | - requires no signal to ask it to stop 73 | - Asynchronous 74 | - does not require all of the nodes to operate in lockstep with each other 75 | - Distributed 76 | - each node receives some information from one or more of its directly attached neighbors, performs a calculation, and then distributes the results of its calculation back to its neighbors. 77 | 78 | ### Bellman-Ford equation for Least Cost 79 | $$ d_{x,y} = \min_v \{ c(x,v) + d_v(y) \} $$ 80 | 81 | ### How it works 82 | 83 | Watch this: https://www.youtube.com/watch?v=x9WIQbaVPzY 84 | 85 | - A node *x* updates its distance-vector estimate when it 86 | either sees a cost change in one of its directly attached links or receives a distancevector update from some neighbor. 87 | - To update its own forwarding table for a given destination *y* 88 | - what node x really needs to know is not the shortest-path 89 | distance to y but instead the neighboring node v*(y) that is the next-hop router along the shortest path to y. 90 | 91 | ### Pitfall - Count to infinity problem when a link cost increases 92 | *Good news travel fast (Lower cost), Bad news travel slow (Higher cost)* 93 | 94 | *Solution* 95 | 96 | - Poisoned Reverse: if z routes through y to get to destination x, then z will advertise to y that its distance to x is infinity. z will continue telling this *little white lie* to y as long as it routes to x via y. 97 | - However, does not work for loops involving three or more nodes (rather than simply two immediately neighboring nodes) 98 | 99 | ## Comparison of LS and DV Algorithms -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/Lecture16-Routing.md: -------------------------------------------------------------------------------- 1 | Table of Contents 2 | - [Scalable Routing](#scalable-routing) 3 | - [Inter-AS: Border Gateway Protocol (BGP)](#inter-as-border-gateway-protocol-bgp) 4 | - [BGP Route Selection](#bgp-route-selection) 5 | - [Intra-AS: IGP](#intra-as-igp) 6 | 7 | 8 |
9 | 10 | # Scalable Routing 11 | 12 | Routers are usually aggregated into domains known as *autonomous systems* (AS) 13 | 14 | | Intra-AS routing | Inter-AS Routing | 15 | | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | 16 | | Gateway has links to routers in other AS | Gateways perform inter-domain routing and intra-domain routing | 17 | | All routers in AS must run same intra-domain protocol | Routers in different AS can run different intra-domain routing, but all routers would need torun the same inter-domain protocol | 18 | | Single admin, so no policy decisions needed | Admin wants to control over how its traffic is routed, who routes through its net. | 19 | | Scalability less of an issue, can always use hierarchical routing to reduce scale | Scalability is critical | 20 | | Focus on performance | Policy may dominate over performance | 21 | 22 | ## Inter-AS: Border Gateway Protocol (BGP) 23 | 24 | - It is a **path-vector** protocol 25 | - Link cost is not the priority; **the routing policy is the most important** for BGP Routing. 26 | - `CIDRized Prefix` + `AS-path` + `Next-hop` 27 | - Next-hop: IP addr of gateway router to enter the path (You cannot route AS, only route routers.) 28 | - AS-path: Enforce import-policy for paths, avoid looping 29 | - Provides each AS a means to 30 | - **eBGP**: Obtain subnet reachability information from neighbor AS 31 | - **iBGP**: Propagate reachability information to all AS-internal routers 32 | - BGP messages are exchanged between peers over semi-permanent TCP connection to advertise paths to different destination network prefixes 33 | - OPEN: *open TCP connection* to remote BGPpeer and authenticate sending BGP peer 34 | - UPDATE: Advertises new path / withdraw old path 35 | - KEEPALIVE: Keeps connection alive *in absence of UPDATES*. ACKs OPEN request 36 | - NOTIFICATION: Report errors in previous msg / Close Connection. 37 | 38 | ### BGP Route Selection 39 | 40 | - BGP *sequentially* invokes these rules to select a route 41 | 1. Local Preference value attribute: Policy Decision 42 | 2. Shortest AS-Path 43 | 3. Closest Next-Hop router: Hot Potato Routing 44 | 4. Additional Criteria e.g. 45 | - **Hot Potato Routing**: Choose local gateway that has the **least intra-domain cost**, without caring about inter-domain cost. 46 | - *Habit of Keeping quiet*: If a network X does not want to route from B to C via X, X will not advertise to B a route to C. 47 | 48 | ## Intra-AS: IGP 49 | 50 | Routing with *Interior Gateway Protocols (IGP)*. 51 | - RIP: Routing Information Protocol 52 | - OSPF: Open Shortest Path First** 53 | - Area Border: Summarize distances to nets in own area then advertise to other Area Border routers 54 | - Backbone: run OSPF routing limited tobackbone 55 | - Boundary: Connect to other AS 56 | - IGRP: Interior Gateway Routing Protocol 57 | -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/Lecture17-SDN.md: -------------------------------------------------------------------------------- 1 | # Software defined Networking (SDN) 2 | 3 | - Separation of Control plane and Data plane 4 | - **Centralized Control Plane**: A distinct remote controller interact swith local control agents (CAs) in routers to compute forwarding tables and distribute 5 | - Easier network management: Avoid Router misconfigurations, greater flexibility of traffic flows 6 | - Table-based forwarding allows "programmable" routers 7 | - Data Plane Switches that implement generalized data-plane forwarding in its hardware can focus on making routing fast 8 | 9 | - Incorporated for *Service Function Chaining* 10 | - Enterprise Virtual Services: 11 | - Subscriber, application or destination based granular traffic steering 12 | - Consumer Virtual Home Gateway 13 | - PNF: Firewall 14 | - VNFs: Parent Control, TCP/HTTP optimization, IPv4/IPv6 NAT 15 | 16 | 17 | ## OpenFlow Protocol 18 | 19 | - TCP is used to exchange messages, with default port `6653`. 20 | - There are 3 classes of messages 21 | 1. Controller-to-switch 22 | 2. Asynchronous (Switch to Controller) 23 | 3. Symmetric (misc) 24 | 25 | -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/Lecture2-HTTP.md: -------------------------------------------------------------------------------- 1 | Table of Contents 2 | - [HTTP](#http) 3 | - [HTTP Methods](#http-methods) 4 | - [Proxy](#proxy) 5 | - [Forward Proxy](#forward-proxy) 6 | - [Reverse Proxies](#reverse-proxies) 7 | 8 |
9 | 10 | # HTTP 11 | 12 | Each HTTP message designed to be *self-contained*: 13 | 14 | - it bring as much detail asthe server needs to servethatrequest 15 | - server does not maintain state 16 | 17 | **Protocols that maintain state** are complex 18 | 19 | - Past History must be maintained 20 | - If server/client crash, the state that is stored on either host will be inconsistent 21 | - however doing so is likely to improve performance 22 | 23 | ## HTTP Methods 24 | 25 | ***Safe*** Methods e.g. GET, HEAD: 26 | 27 | - enable caching and loading distribution 28 | - does not modify resources on server 29 | 30 | ***Idempotent*** Methods e.g. Multiple DELETE: 31 | 32 | - _Definition_: An effort that can be applied multiple times without changing the result beyond the initial application. 33 | 34 | - Handle lost confirmations by re-sending 35 | - May modify resources on the server 36 | - Can be executed multiple times without changing outcome 37 | 38 | - counter.e.g. Multiple POST 39 | 40 | # Proxy 41 | 42 | 43 | _Definition_: An entity **authorized to act on behalf of another** e.g. an intermediatory server performing requests for us 44 | 45 | - Serve as a single point access of control to enforce security protocols 46 | 47 | **Common traits of proxies**: 48 | 49 | - Single access of control 50 | - Load Balancing: Distribute incoming requests to a cluster of servers, all provide the same kind of service 51 | 52 | ## Forward Proxy 53 | 54 | When a client makes a connection attempt to that file transfer server on the Internet, its requests usually have to *pass through the forward proxy first*, where a firewall will be behind it. 55 | 56 | 1. Depending on the forward proxy's settings, a request can be allowed or denied. 57 | 2. If allowed, then the request is forwarded to the firewall and then to the file transfer server. 58 | 3. From the point of view of the file transfer server, it is the proxy server that issued the request, not the client. So when the server responds, it addresses its response to the proxy. 59 | 4. When the forward proxy receives the response, it recognizes it as a response to the request that went through earlier. And so it in turn sends that response to the client that made the request. 60 | 61 | Applications: 62 | 63 | - Content Logging & Eavesdropping 64 | - Accessing Services Anonymously 65 | 66 | ## Reverse Proxies 67 | 68 | The reverse proxy does the exact opposite of what a forward proxy does. It accepts requests from external clients on behalf of servers stationed behind it. The firewall is between the client and reverse proxy instead of being in between the forward proxy and the servers. 69 | 70 | 1. Depending on the reverse proxy'settings, a request can be allowed or denied. 71 | 2. From the perspective ofthe client, it is the reverse proxy that is providing file transfer services. 72 | 73 | Applications: 74 | 75 | - A/B testing, Multivariete testing 76 | - Distribute load 77 | -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/Lecture3-WebAPI.md: -------------------------------------------------------------------------------- 1 | # Web API 2 | 3 | API specifies how 2 software components should interact. 4 | 5 | **Types of API Protocols** 6 | 7 | - [SOAP](#soap) 8 | - [REST](#rest) 9 | - [Resources in REST](#resources-in-rest) 10 | - [Running HTTP Requests with curl](#running-http-requests-with-curl) 11 | - [PUT vs POST](#put-vs-post) 12 | - [MIME](#mime) 13 | 14 | ## SOAP 15 | Simple Object Access Protocol (SOAP) is the specific protocol for XML-based data exchange, popular in enterprise M-M communication. 16 | - However, Specific protocol seems to add overhead in many cases 17 | 18 | 19 | Web service definition language (WSDL) is used to specify available service to client 20 | - client-side functions to call API can be automatically generated 21 | - auto-completion for API calls 22 | 23 | ## REST 24 | 25 | Representational State Transfer (REST) is not a protocol, but rather an architectural style. 26 | 27 | - Pros: Simple, scalable, general, high performance 28 | - Cons: No-built-in ACID & Under-fetching/Over-fetching 29 | - ACID: Atomicity, Consistency, Isolation, Durability 30 | - Over-fetching: You might get more data than you need, but the end point is designed to give you that specific data. 31 | - Underfetching: You might get less data than you need, because there is no end point designed to give you the data you need from that server. 32 | 33 | ### Resources in REST 34 | 35 | - 2 Types 36 | 1. Collections 37 | 2. Instances 38 | - Referenced in the HTTP header 39 | 40 | | Simple Static Settings | Dynamic Settings | 41 | | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | 42 | | Each resource corresponds to single file | The server will interpret the URL as parameters and dynamically create content for the provided parameters. So the content at the resource URL may not exist yet. | 43 | 44 | ### Running HTTP Requests with curl 45 | 46 | At any point of time, if you want to understand more about the flags that you pass into curl to test your http requests, run `curl --help` 47 | 48 | Examples of sending a get request and giving the -v flag to show more information on exchanged messages. 49 | ![](./demo_rest_api.png) 50 | 51 | For a patch request, you can run 52 | ```bash 53 | curl -H "Content-Type: application/json" -X PATCH -d '{"title":"test"}' http://jsonplaceholder.typicode.com/todos/199 54 | ``` 55 | The result will be 56 | ``` 57 | { 58 | "userId": 10, 59 | "id": 199, 60 | "title": "test", 61 | "completed": true 62 | } 63 | ``` 64 | 65 | #### PUT vs POST 66 | 67 | PUT: Used to update an existing resource. Reply will be 200. 68 | POST: Used to create an element in a collection. Reply will be 201 with URL of created element. 69 | 70 | # MIME 71 | 72 | Multipurpose Internet Mail Extensions (MIME) is an Internet standard that extends the format of email messages to support text in character sets other than ASCII, as well attachments of audio, video, images, and application programs. Message bodies may consist of multiple parts, and header information may be specified in non-ASCII character sets. 73 | -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/Lecture5-NetworkApplications.md: -------------------------------------------------------------------------------- 1 | # Multimedia Network Applications 2 | Table of Contents 3 | - [Streaming stored video](#streaming-stored-video) 4 | - [Steraming multimedia: DASH](#steraming-multimedia-dash) 5 | - [Voice over IP (VoIP)](#voice-over-ip-voip) 6 | - [Adaptive Playout Delay](#adaptive-playout-delay) 7 | - [Adaptively Estimate Packet Delay](#adaptively-estimate-packet-delay) 8 | - [Exponentially Weighted Moving Average ( EWMA )](#exponentially-weighted-moving-average--ewma) 9 | - [Average deviation of delay](#average-deviation-of-delay) 10 | 11 |
12 | 13 | ## Streaming stored video 14 | 15 | - Use Redundancy within and between images to decrease # bits required to encode image 16 | - Spatial (within image) 17 | - Temporal (from one image to next) 18 | - Encoding Rate 19 | - CBR (Constant Bit Rate): Fixed encoding rate 20 | - VBR (Variable Bit Rate): Changes as amount of spatial, temporal coding changes 21 | - Challenges 22 | - Continuous playout constraint: Once client playout begins, playback must match original timing 23 | - Network Delay e.g. queue delay are variable--> need client side buffer to match playout requirements 24 | - Client Interactivity: Allow pause, fast-forward, rewind and jump through video 25 | - Video packets may be lost, need to retransmit 26 | - Packets may be received slower than it is being sent, so some packets might be skipped. 27 | 28 | ### Steraming multimedia: DASH 29 | 30 | Dynamic, Adaptive Streaming over HTTP (DASH) 31 | Other adaptive solutions: Apple's HTTP Live Streaming (HLS) solution, Adobe Systems HTTP Dynamic Streaming, Microsoft Smooth Streaming 32 | 33 | - Server 34 | - encodes vid file into multiple versions 35 | - each version stored, encoded at a different rate 36 | - manifest file: provide URLs for different versions 37 | - Client 38 | - Handles most of the streaming logic: 39 | - When to request chunk 40 | - What encoding rate to request 41 | - Where to request 42 | 43 | ## Voice over IP (VoIP) 44 | 45 | VoIP end-end-delay requirement: <150 msec good, > 400msec bad 46 | 47 | - For delay jitter, we aim to minimize client playout delay 48 | - Receiver attempts to playout each chunk exactly q msecs after chunk is generated 49 | - Large q: less packet loss 50 | - Small q: better interactive experience 51 | 52 | ### Adaptive Playout Delay 53 | 54 | #### Adaptively Estimate Packet Delay 55 | 56 | ##### Exponentially Weighted Moving Average ( EWMA ) 57 | $d_i = (1-\alpha)d_{i-1} + \alpha(r_i - t_i)$ 58 | 59 | where: 60 | - $d_i$ is the delay estimate after ith packet 61 | - $\alpha$ is a small constat 62 | - $r_i$ is the time received, $t_i$is the time sent 63 | - so $r_i - t_i$ is the measured delay of ith packet 64 | 65 | ##### Average deviation of delay 66 | $v_i = (1-\Beta)v_{i-1} + \Beta|r_i - t_i - d_i|$ 67 | 68 | $d_i$, $v_i$ are calculated for every received packet, but used only at the start of talk spurt. 69 | 70 | - 1st packet in talkspurt: $playout-time_i = t_i + d_i + Kv_i $ 71 | - longer playback delay 72 | - Remaining packets are played out periodically -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/Lecture6-CDN-and-PNP.md: -------------------------------------------------------------------------------- 1 | Table of Contents 2 | 3 | - [Content Distribution Networks (CDN)](#content-distribution-networks-cdn) 4 | - [CDN Server](#cdn-server) 5 | - [Types of CDN](#types-of-cdn) 6 | - [Choice of Placement](#choice-of-placement) 7 | - [Server Selection](#server-selection) 8 | - [Routing the Content](#routing-the-content) 9 | - [Content Replication](#content-replication) 10 | - [Peer-to-peer architecture](#peer-to-peer-architecture) 11 | - [File distribution time (lower bound)](#file-distribution-time-lower-bound) 12 | - [Client-server](#client-server) 13 | 14 |
15 | 16 | # Content Distribution Networks (CDN) 17 | 18 | Problem Background: Sreaming Content to hundred of thousands of simultaneous users 19 | 20 | Possible solutions 21 | 22 | 1. Single mega server: doesn't scale 23 | - point of network congestion 24 | - long path to distant clients 25 | - single point of failure 26 | - multiple copies of vid sent over outgoing link 27 | 2. Store/serve multiple copies of videos at multiple geographically distributed sites (CDN) 28 | 29 | CDN Operators stores copies of content at CDN Nodes. 30 | 31 | ## CDN Server 32 | 33 | ### Types of CDN 34 | 35 | - Commercial CDN 36 | - e.g. Akamai, Cloudflare 37 | - Content provider's own CDN 38 | - e.g. Google, netflix 39 | - Telco CDN 40 | 41 | ### Choice of Placement 42 | 43 | - Push CDN servers deep into many access ISPs so that they are close to users 44 | - Smaller no. of larger clusters in IXPs near access ISPs 45 | 46 | ### Server Selection 47 | 48 | Points of consideration 49 | 50 | - Geographically close 51 | - Performance: Real-time measurement 52 | - Load-balancing 53 | - Cost: CDN may need to pay its provider ISP 54 | - Fault-tolerance 55 | 56 | ### Routing the Content 57 | 58 | After selection, we still have a routing problem. We can route content access in 3 diff ways: 59 | 60 | 1. DNS-based 61 | 2. Application Driven 62 | - Multiple connection setup, name lookups 63 | 3. Routing(anycast)-based 64 | 65 | ### Content Replication 66 | 67 | Mechanisms: 68 | 69 | - Push: Use of off-peak bandwidth optimization 70 | - Pull: More Adapative 71 | 72 | e.g. Netflix 73 | 74 | - has prepared content 75 | - so push content to CDN during off-peak hours whose CDN servers pull & cache content by user demand. 76 | 77 | e.g. Youtube 78 | 79 | - people can upload content anytime 80 | - so CDN servers pull content by user demand at all time 81 | 82 | # Peer-to-peer architecture 83 | 84 | - Arbitrary end systems directly communicate as peers 85 | - Peers are intermittently connected and may change IP addresses 86 | 87 | e.g. VoIP (Skype), Mulmedia Streaming (Kan kan), File Distribution (BitTorrent) 88 | 89 | ## File distribution time (lower bound) 90 | 91 | - $d_{min}$: min client download rate 92 | - $\frac{F}{d_{min}}$: min client download time 93 | - $\frac{F}{u_s}$: server upload time for one copy of file 94 | 95 | ### Client-server 96 | 97 | - Server must sequentially upload N file copies (to N clients) 98 | - Each client must download file copy 99 | 100 | **Time to distribute F to N clients** 101 | $$ D_{c-s} >= \max(N\frac{F}{u_s}, \frac{F}{d_{min}}) $$ 102 | 103 | P2P: 104 | 105 | - Server must upload at least one copy 106 | - each client must download one file copy 107 | - Clients asaggregate must download $NF$ bits 108 | 109 | **Time to distribute F to N clients** 110 | $$ D_{p2p} >= \max(\frac{F}{u_s},\frac{F}{d_{min}}, N\frac{F}{u_s+\sum{u_i}} ) $$ 111 | 112 | Another simplification of the third term of the equation: 113 | $$N\frac{F}{u_s+\sum{u_i}} = \frac{F}{u_s/N+u} $$ 114 | 115 | -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/Lecture8-RDTPipelines.md: -------------------------------------------------------------------------------- 1 | 2 | # Pipelined protocols 3 | 4 | Pipelining allows for increased utilizaiton of the link. 5 | 6 | | without pipeline | with pipeline | 7 | | ------------------------------------ | --------------------------------- | 8 | | ![](pictures/rdt3.0_stopandwait.PNG) | ![](pictures/rdt3.0_pipeling.PNG) | 9 | 10 | **Consequences of pipelining** 11 | 12 | - The range of `seq_num` must be increased, since each in-transit packet must have a unique number and there may be multiple, in-transit, unack packets. (not counting retransmissions) 13 | - Minimally, the sender will have to buffer packets that have been trasnmitted but not ack yet. 14 | 15 | There are 2 basic approaches towards pipelined error recovery: 16 | 1. Go-Back-N (GNB): [Interactive Animation](https://media.pearsoncmg.com/aw/ecs_kurose_compnetwork_7/cw/content/interactiveanimations/go-back-n-protocol/index.html) 17 | 2. Selective Repeat (SR): [Interactive Animation](https://media.pearsoncmg.com/aw/ecs_kurose_compnetwork_7/cw/content/interactiveanimations/selective-repeat-protocol/index.html) 18 | 19 | **Types of Pipeline Protocols** 20 | - [Go-Back-N (GNB)](#go-back-n-gnb) 21 | - [Selective Repeat (SR)](#selective-repeat-sr) 22 | - [Comparison with GBN](#comparison-with-gbn) 23 | - [Limitations of small range of `seq_num`](#limitations-of-small-range-of-seqnum) 24 | 25 | ## Go-Back-N (GNB) 26 | 27 | **Sender** 28 | 29 | The sender is allowed to transmit multiple packets without waiting for an ack, where: 30 | 31 | - `N`: the no. unack packets in the pipeline / the window size. 32 | - `base`: the `seq_num` of the oldest unack packet. 33 | - `nextseqnum`: smallest unused `seq_num`, the index of the next packet to be sent. 34 | - `seq_num_space`: range of [$0$, $2^k-1$] 35 | - `seq_num` with $k$ number of bits for the packet sequence number field in the packet header. 36 | 37 | ![](pictures/GNB.PNG) 38 | 39 | This results in the following array of packets at the sender's side. 40 | ```python 41 | data = seq_num_space 42 | ack_pkts = data[0:base] 43 | window = data[base:base+N] 44 | sent_unack_pkts = data[base:nextseqnum] 45 | avail_pkts_to_send = data[nextseqnum:base+N] 46 | outside_window = data[base+N::] 47 | ``` 48 | 49 | As such, it is refer to the **sliding-window protocol**. 50 | 51 | **Receiver** 52 | 53 | The receiver always send ack for pkt with highest in-order `seq_num`. 54 | E.g. If the receiver receives packets 1,2,4,5 (pkt 3 is lost) 55 | - assuming window size is 5. (packets 1-5) 56 | - it will keep resending the ack for pkt 2 and discard packets above 3 (4-5). 57 | - base is updated to 3, so after the timeout, the sender will resend packets 3-7. 58 | - If these packets are successfully received, then the sender can update base to 8 and send 8-12th packets. 59 | 60 | 61 | ## Selective Repeat (SR) 62 | 63 | ### Comparison with GBN 64 | | Similarities | Differences | 65 | | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | 66 | | Fixed window size | - | 67 | | Initialize timeout for packets at the sender's side | Timeout is initialized for each and every individual packet in SR, instead of just one timeout for one packet in the window in GNB | 68 | | The sender is allowed to transmit multiple packets without waiting for an ack | For out-of-order packets (due to lost packets), instead of discarding them, they are buffered instead in SR. | 69 | 70 | ### Limitations of small range of `seq_num` 71 | 72 | - The receiver may intepret duplicate data as new data. 73 | - The `seq_num_size` should be $2n$ to avoid this problem. -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/Lecture9-TCP_RDT_CC_Principles.md: -------------------------------------------------------------------------------- 1 | - [TCP](#tcp) 2 | - [TCP Segment Structure](#tcp-segment-structure) 3 | - [RTT, Timeout](#rtt-timeout) 4 | - [Estimate RTT](#estimate-rtt) 5 | - [Estimate SampleRTT](#estimate-samplertt) 6 | - [Timeout Interval](#timeout-interval) 7 | - [TCP RDT](#tcp-rdt) 8 | - [Fast retransmit](#fast-retransmit) 9 | - [other RDT](#other-rdt) 10 | - [GBN](#gbn) 11 | - [SR](#sr) 12 | 13 | 14 | # TCP 15 | 16 | ## TCP Segment Structure 17 | 18 | - Cumulative ACK: TCP sends an ACK with `seq_num` of next byte expected from the other side, instead of replying which packet it has received 19 | - similar to Go-back-N 20 | - Out-of-order packets: TCP will buffer, and not discard them. 21 | 22 | ## RTT, Timeout 23 | 24 | ### Estimate RTT 25 | - $SampleRTT$: an average of recent measurements of time from segment transmission untli ACK receipt 26 | - Ignore retransmissions 27 | 28 | Exponential Moving Average Equation 29 | $$ EstimatedRTT = (1-\alpha)*EstimatedRTT + \alpha*SampleRTT$$ 30 | 31 | - Influence of past samples decreases exponentially fast 32 | - typical $\alpha=0.125$ 33 | 34 | ### Estimate SampleRTT 35 | 36 | $$ DevRTT = (1-\beta)DevRTT + \beta|SmapleRTT-EstimatedRTT| $$ 37 | - typical $\beta$ = 0.25 38 | 39 | #### Timeout Interval 40 | 41 | $$ TimeoutInterval = EstimatedRTT + 4*DevRTT $$ 42 | - $4*DevRTT$ is a safety margin 43 | - too short will result in premature timeout and unnecessary retransmissions 44 | - too long will result in slow reactions to segment loss 45 | 46 | ## TCP RDT 47 | 48 | ![](pictures/TCP_sender_simple.PNG) 49 | 50 | ### Fast retransmit 51 | 52 | - If sender receives 3 duplicate (extra) ACKs for same data, it will resend unACKed segment with smallest `seq_num`. 53 | 54 | # other RDT 55 | 56 | ## GBN 57 | 58 | - Requirement for k-bit `seq_num` in packet header : $2^k > N$ 59 | - Receiver window size: 1 (`expected_seq_num`). 60 | - Relationship among `expected_seq_num`, `send_base`, `next_seq_num`: $send_base <= next_seq_num <= expected_seq_num $ 61 | 62 | ## SR 63 | 64 | rcv_base = next_seq_num if all packets uptonext_seq_num are received 65 | 66 | - Requirement for k-bit `seq_num` in packet header : $2^k > 2N$ 67 | - Receiver window size: 1 (`expected_seq_num`). 68 | - Relationship among `expected_seq_num`, `send_base`, `next_seq_num`: $send_base < next_seq_num < expected_seq_num $ 69 | -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/Midterm-Summary.md: -------------------------------------------------------------------------------- 1 | # Midterms Summary 2 | 3 | | Week | Topic | Specific Notes | 4 | | ---- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 5 | | 1-2 | Internet Overview, Application Layer | [Lecture 1: Transport Layer](Lecture1-TransportLayer.md),
[Lecture 2: HTTP](Lecture2-HTTP.md),
[Lecture 3: WebAPI](Lecture3-WebAPI.md) | 6 | | 3 | Multimedia Networking and CDN | [Lecture 5: Network Applications](Lecture5-NetworkApplications.md),
[Lecture 6: CDN and PNP](Lecture6-CDN-and-PNP.md) | 7 | | 4-5 | Transport Layer Principles:
Reliable Data Transfer and Congestion Control | [Lecutre 7: RDT](Lecture7-RDT.md),
[Lecture 8: RDT Pipelines](Lecture8-RDTPipelines.md),
[Lecture 9: TCP and RDT Principles](Lecture9-TCP_RDT_CC_Principles.md),
[Lecture10: Congestion Control](lecture10-Congestion-Control.pdf) | 8 | | 6 | TCP | [Lecture 11: TCP Wrap up ](Lecture11-TCPWrapup.md) | 9 | 10 | **Resources for practice** 11 | 12 | Problem sets: http://gaia.cs.umass.edu/kurose_ross/interactive/index.php 13 | 14 | # Learning Checklist 15 | ## Week 1-2: Internet Overview and Application Layer 16 | 17 | **Overview** 18 | - [ ] Internet Structure: ISPs 19 | - [ ] The Internet Protocol Stack: APTNLP 20 | - [ ] Network Performance: Throughput, Delay and Loss Probability 21 | - [ ] 4 Sources of Packet Delay 22 | - [ ] Space-Time Diagrams 23 | - [ ] Circuit Switching vs. Packet Switching 24 | 25 | **Application Layer** 26 | - [ ] Application Architectures 27 | - [ ] Process Communication 28 | - [ ] Addressing processes with *identifiers* 29 | - [ ] What are Sockets 30 | - [ ] Internet Transport Protocol Services: TCP vs. UDP 31 | - [ ] Socket Programming: Establishment and Usage 32 | - [ ] Protocol definitions 33 | - [ ] Electronic Mail Application Protocols 34 | - [ ] SMTP Interaction and DATA Format 35 | - [ ] HTTP 36 | - [ ] Web API 37 | - [ ] URI, URL, URNs 38 | - [ ] Architectural Style: REST 39 | - [ ] Idempotence and safe methods 40 | 41 | ## Week 3 : Multimedia Networking 42 | - [ ] Streaming Stored Media 43 | - [ ] Role of UDP 44 | - [ ] DASH: Dynamic Adaptive Streaming over HTTP 45 | - [ ] Interpreting plots for data transmission and playout rate 46 | - [ ] VoIP (Voice-over-IP) 47 | - [ ] Adaptive Playout Delay: Average Estimate of Packet Delay, Average Deviation of Delay, Playout time for packets in talk spurts 48 | - [ ] Recovery From Packet Loss: Simple Forward Error Correction (FEC) 49 | - [ ] Streaming Live Media 50 | - [ ] Content Distribution Networks (CDN) and concerns of CDN Operators 51 | - [ ] CDN Server Placement 52 | - [ ] CDN Server Selection 53 | - [ ] CDN Content Routing 54 | - [ ] CDN Content Replication 55 | 56 | ## Week 4: Transport Layer 57 | 58 | - [ ] Multiplexing/Demultiplexing 59 | - [ ] Connectionless 60 | - [ ] Connection-oriented 61 | - [ ] UDP 62 | - [ ] Segment Header 63 | - [ ] Checksum 64 | - [ ] Reliable Data Transfer 65 | - [ ] Flow Control 66 | - [ ] Congestion Control 67 | - [ ] TCP Connection Management 68 | 69 | -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/README.md: -------------------------------------------------------------------------------- 1 | # Table of Contents 2 | 3 | > For a breakdown of the topics based on Midterms / Finals instead, Midterm Summary (including checklist) [here](Midterm-Summary.md) and Finals Summary [here](Finals-Summary.md). 4 | 5 | | Topic | Specific Notes | 6 | | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 7 | | Internet Overview, Application Layer | [Lecture 1: Transport Layer](Lecture1-TransportLayer.md),
[Lecture 2: HTTP](Lecture2-HTTP.md),
[Lecture 3: WebAPI](Lecture3-WebAPI.md) | 8 | | Multimedia Networking and CDN | [Lecture 5: Network Applications](Lecture5-NetworkApplications.md),
[Lecture 6: CDN and PNP](Lecture6-CDN-and-PNP.md) | 9 | | Transport Layer Principles:
Reliable Data Transfer and Congestion Control | [Lecutre 7: RDT](Lecture7-RDT.md),
[Lecture 8: RDT Pipelines](Lecture8-RDTPipelines.md),
[Lecture 9: TCP and RDT Principles](Lecture9-TCP_RDT_CC_Principles.md),
[Lecture10: Congestion Control](lecture10-Congestion-Control.pdf) | 10 | | TCP | [Lecture 11: TCP Wrap up ](Lecture11-TCPWrapup.md) | 11 | | TCP Congestion Control | [Lecture10 - Congestion Control](Lecture10-CongestionControl.md),
[Lecture 11 - TCP Wrapup](Lecture11-TCPWrapup.md) | 12 | | Network Layer | [Lecture13 - Network Layer Overview](Lecture13-NetworkLayerOverview.md),
[Lecture14 - IP Addressing](Lecture14-IPAddressing.md),
[Lecture15 - Routing Algorithms](Lecture15-RoutingAlgorithms.md),
[Lecture16 - Routing](Lecture16-Routing.md) | 13 | | Link Layer & Synthesis | [Lecture19 - Link Layer](Lecture19-Link_Layer.md) | 14 | | Wireless and Mobile Networks | [Lecture21 - Wireless Networks](Lecture21-WirelessNetworks.md) | -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/GNB.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/GNB.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/GNB_receiver.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/GNB_receiver.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/GNB_sender.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/GNB_sender.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/IPv4_vs_IPv6.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/IPv4_vs_IPv6.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/SR.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/SR.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/SR_dillema.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/SR_dillema.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/TCPCongestionControl.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/TCPCongestionControl.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/TCP_sender_simple.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/TCP_sender_simple.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/code-division-multiple-access-cdma.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/code-division-multiple-access-cdma.jpg -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/control_plane.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/control_plane.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/demo_rest_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/demo_rest_api.png -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/djikstra_oscillations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/djikstra_oscillations.png -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/forwarding_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/forwarding_diagram.png -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/hol_blocking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/hol_blocking.png -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/input_port2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/input_port2.png -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/output_port.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/output_port.png -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/rdt2.1_receiver.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/rdt2.1_receiver.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/rdt2.1_sender.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/rdt2.1_sender.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/rdt2.2_receiver.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/rdt2.2_receiver.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/rdt2.2_sender.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/rdt2.2_sender.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/rdt3.0_pipeling.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/rdt3.0_pipeling.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/rdt3.0_receiver.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/rdt3.0_receiver.jpg -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/rdt3.0_sender.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/rdt3.0_sender.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/rdt3.0_stopandwait.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/rdt3.0_stopandwait.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/rdt_noack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/rdt_noack.png -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/rdt_noack2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/rdt_noack2.png -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/rdt_noack3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/rdt_noack3.png -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/routing_architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/routing_architecture.png -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/stopandwait_vs_pipeline.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/stopandwait_vs_pipeline.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/subnet_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/subnet_example.png -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/switching_bus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/switching_bus.png -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/switching_crossbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/switching_crossbar.png -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/switching_memory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/switching_memory.png -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/tcp_fairness.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/tcp_fairness.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/pictures/tcp_throughput.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.012 Networks/2019-Siew Wen/pictures/tcp_throughput.PNG -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/tcp_sample.py: -------------------------------------------------------------------------------- 1 | from socket import * 2 | 3 | # server 4 | server_socket = socket(AF_INET, SOCK_STREAM) 5 | server_socket.bind(("", 12000)) 6 | server_socket.listen(1) 7 | 8 | # client 9 | client_socket = socket(AF_INET, SOCK_STREAM) 10 | client_socket.connect("localhost", 12000) 11 | 12 | server_socket.close() -------------------------------------------------------------------------------- /notes/50.012 Networks/2019-Siew Wen/udp_sample.py: -------------------------------------------------------------------------------- 1 | from socket import * 2 | 3 | # server 4 | server_port = 12000 5 | server_socket = socket(AF_INET, SOCK_DGRAM) 6 | server_socket.bind("localhost",server_port) 7 | print("The server ready to receive requests") 8 | while True: 9 | message, client_address = server_socket.recvfrom(2048) 10 | modified_message = message.decode().upper() 11 | server_socket.sendto(modified_message.encode(), client_address) 12 | 13 | # client 14 | 15 | server_name = 'hostname' 16 | server_port = 12000 17 | client_socket = socket(AF_INET, SOCK_DGRAM) 18 | message = "hi".encode() 19 | client_socket.sendto(message,server_name, server_port) 20 | modified_message, server_address =client_socket.recvfrom(2048) 21 | print(modified_message.decode()) 22 | client_socket.close() 23 | -------------------------------------------------------------------------------- /notes/50.021 Artificial Intelligence/2021-huikang/README.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.021 Artificial Intelligence/2021-huikang/README.pdf -------------------------------------------------------------------------------- /notes/50.021 Artificial Intelligence/2021-huikang/assets/alpha-beta-pruning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.021 Artificial Intelligence/2021-huikang/assets/alpha-beta-pruning.png -------------------------------------------------------------------------------- /notes/50.021 Artificial Intelligence/2021-huikang/assets/backtracking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.021 Artificial Intelligence/2021-huikang/assets/backtracking.png -------------------------------------------------------------------------------- /notes/50.021 Artificial Intelligence/2021-huikang/assets/cheatsheet-page-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.021 Artificial Intelligence/2021-huikang/assets/cheatsheet-page-1.png -------------------------------------------------------------------------------- /notes/50.021 Artificial Intelligence/2021-huikang/assets/cheatsheet-page-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.021 Artificial Intelligence/2021-huikang/assets/cheatsheet-page-2.png -------------------------------------------------------------------------------- /notes/50.021 Artificial Intelligence/2021-huikang/assets/cheatsheet-page-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.021 Artificial Intelligence/2021-huikang/assets/cheatsheet-page-3.png -------------------------------------------------------------------------------- /notes/50.021 Artificial Intelligence/2021-huikang/assets/cheatsheet-page-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.021 Artificial Intelligence/2021-huikang/assets/cheatsheet-page-4.png -------------------------------------------------------------------------------- /notes/50.034 Introduction to Probability and Statistics/2018-Jing Yu/pns_notes_kjy.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.034 Introduction to Probability and Statistics/2018-Jing Yu/pns_notes_kjy.pdf -------------------------------------------------------------------------------- /notes/50.038 Computational Data Science/2019-Siew Wen/50.038 exam-checklist.md: -------------------------------------------------------------------------------- 1 | # Study Checklist for 50.038 Computational Data Science 2 | > You can click on ❔ for relevant links on topics more in-depth outside of the lecture notes. 3 | 4 | - Week 1: BIG DATA, Hadoop and MapReduce 5 | - [ ] The 3 V's of Big Data 6 | - [ ] CAP Theorem 7 | - [ ] Hadoop Ecosystem 8 | - [ ] What is MapReduce 9 | - Week 2: Feature vectors, dimension reduction, evaluation 10 | - [ ] Types of Features 11 | - [ ] Ordinal, Nominal, Interval, Ratio 12 | - [ ] Discrete, Continuous 13 | - [ ] Discretization, Binarization 14 | - [ ] Curse of Dimensionality 15 | - [ ] PCA, SVD 16 | - [ ] Token Normalization 17 | - [ ] TF-IDF 18 | - Week 3: Data Visualization 19 | - [ ] How to emphasize certain data 20 | - [ ] Reading Charts e.g. Boxplot, Scatterplot, Spider Charts, Violin Plots etc... 21 | - Week 4: Regression algorithms – Time series 22 | - [ ] Train, validation, test sets 23 | - [ ] Types of cross-validation 24 | - [ ] leave-one-out 25 | - [ ] k-fold 26 | - [ ] Random Sampling, Stratified Sampling 27 | - [ ] How to measure the quality of a classifier 28 | - [ ] Accuracy 29 | - [ ] Precision 30 | - [ ] Recall 31 | - [ ] F-score 32 | - [ ] Receiver Operating Curve (ROC) 33 | - Week 5: Classification algorithms 34 | - [ ] Decision Tree 35 | - [ ] Measuring Node Impurity 36 | - [ ] GINI index 37 | - [ ] Entropy 38 | - [ ] Misclassification Error 39 | - [ ] Addressing Overfit and Underfit 40 | - [ ] K-means 41 | - [ ] Elbow Method for determining optimal K 42 | - [ ] Ensemble Methods [❔](https://blog.statsbot.co/ensemble-learning-d1dcd548e936) 43 | - [ ] Bagging 44 | - [ ] Boosting 45 | - [ ] Stacking 46 | - Week 6: Intro to Deep Learning 47 | - [ ] Activation Functions: Sigmoid, Softmax, tanh, RELU, leaky RELU 48 | - [ ] How Softmax is an extension of Sigmoid 49 | - [ ] Why leaky RELU when there is RELU 50 | - [ ] Neural Networks 51 | - [ ] Backpropagation 52 | - [ ] Gradient Descent 53 | - [ ] Underfit, Overfit - When to stop training 54 | - Week 9: Word Embeddings [❔](https://pathmind.com/wiki/word2vec#bert) 55 | - [ ] One-hot vectors vs Bag of Words (BOW) vs Word Embeddings 56 | - [ ] Text Representation Models 57 | - [ ] Word2Vec: cBOW vs Skip-gram 58 | - [ ] Doc2Vec: dBOW vs dM [❔](https://medium.com/wisio/a-gentle-introduction-to-doc2vec-db3e8c0cce5e) 59 | - [ ] Extensions of Word Embeddings: GloVe, Elmo, BERT 60 | - Week 10: Convolutional neural networks (CNN) [❔](https://www.superdatascience.com/ppt-the-ultimate-guide-to-convolutional-neural-networks-cnn/) 61 | - [ ] Image Detection/ Filter Kernel 62 | - [ ] Dimensions of output in relation to Stride size 63 | - [ ] Padding with zeros 64 | - [ ] Activation Maps 65 | - [ ] Max Pooling and Average Pooling 66 | - [ ] Flattening 67 | - [ ] Methods of Data Augmentation 68 | - Week 11: Recurrent Neural Networks (RNN) 69 | - [ ] Types of RNN: Many-to-many, one-to-many 70 | - [ ] Problem of Vanilla RNNs: Vanishing/Exploding Gradient [❔](https://medium.com/datadriveninvestor/how-do-lstm-networks-solve-the-problem-of-vanishing-gradients-a6784971a577) 71 | - [ ] Resolution: Long Short-term Memory (LSTM) [❔](http://colah.github.io/posts/2015-08-Understanding-LSTMs/) 72 | - [ ] LSTM Variants: Peephole, Combined Forget/Input Gates, Gated Recurrent Units -------------------------------------------------------------------------------- /notes/50.038 Computational Data Science/2019-Siew Wen/50.038-exam-checklist.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.038 Computational Data Science/2019-Siew Wen/50.038-exam-checklist.pdf -------------------------------------------------------------------------------- /notes/50.039 Theory and Practice of Deep Learning/2021-huikang/README.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.039 Theory and Practice of Deep Learning/2021-huikang/README.pdf -------------------------------------------------------------------------------- /notes/50.039 Theory and Practice of Deep Learning/2021-huikang/assets/finals-cheatsheet-page-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.039 Theory and Practice of Deep Learning/2021-huikang/assets/finals-cheatsheet-page-1.png -------------------------------------------------------------------------------- /notes/50.039 Theory and Practice of Deep Learning/2021-huikang/assets/finals-cheatsheet-page-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.039 Theory and Practice of Deep Learning/2021-huikang/assets/finals-cheatsheet-page-2.png -------------------------------------------------------------------------------- /notes/50.039 Theory and Practice of Deep Learning/2021-huikang/assets/midterms-cheatsheet-page-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.039 Theory and Practice of Deep Learning/2021-huikang/assets/midterms-cheatsheet-page-1.png -------------------------------------------------------------------------------- /notes/50.039 Theory and Practice of Deep Learning/2021-huikang/assets/midterms-cheatsheet-page-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.039 Theory and Practice of Deep Learning/2021-huikang/assets/midterms-cheatsheet-page-2.png -------------------------------------------------------------------------------- /notes/50.039 Theory and Practice of Deep Learning/2021-huikang/assets/q-table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.039 Theory and Practice of Deep Learning/2021-huikang/assets/q-table.png -------------------------------------------------------------------------------- /notes/50.039 Theory and Practice of Deep Learning/2021-huikang/assets/transformer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.039 Theory and Practice of Deep Learning/2021-huikang/assets/transformer.png -------------------------------------------------------------------------------- /notes/50.045 Information Retrieval/2021-huikang/README.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.045 Information Retrieval/2021-huikang/README.pdf -------------------------------------------------------------------------------- /notes/50.045 Information Retrieval/2021-huikang/assets/NDCG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.045 Information Retrieval/2021-huikang/assets/NDCG.png -------------------------------------------------------------------------------- /notes/50.045 Information Retrieval/2021-huikang/assets/query-likelihood-model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSUTD/course-notes/edec7500de149483451bd2a3b2910c763988d8d2/notes/50.045 Information Retrieval/2021-huikang/assets/query-likelihood-model.png --------------------------------------------------------------------------------