Biostatistics 615/815 Lecture 10: Hidden Markov Models

Size: px
Start display at page:

Download "Biostatistics 615/815 Lecture 10: Hidden Markov Models"

Transcription

1 Biostatistics 615/815 Lecture 10: Hidden Markov Models Hyun Min Kang October 4th, 2012 Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

2 Manhattan Tourist Problem Let C(r, c) be the optimal cost from (0, 0) to (r, c) Let h(r, c) be the weight from (r, c) to (r, c + 1) Let v(r, c) be the weight from (r, c) to (r + 1, c) We can recursively define the optimal cost as { C(r 1, c) + v(r 1, c) min r > 0, c > 0 C(r, c 1) + h(r, c 1) C(r, c) = C(r, c 1) + h(r, c 1) r = 0, c > 0 C(r 1, c) + v(r 1, c) r > 0, c = 0 0 r = 0, c = 0 Once C(r, c) is evaluated, it must be stored to avoid redundant computation Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

3 Edit Distance Problem Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

4 Dynamic Programming for Edit Distance Problem Input strings are x[1,, m] and y[1,, n] Let x i = x[1,, i] and y j = y[1,, j] be substrings of x and y Edit distance d(x, y) can be recursively defined as follows i j = 0 j i = 0 d(x i, y j ) = d(x i 1, y j ) + 1 min d(x i, y j 1 ) + 1 otherwise d(x i 1, y i 1 ) + I(x[i] y[j]) Similar to the Manhattan tourist problem, but with 3-way choice Time complexity is Θ(mn) Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

5 Hidden Markov Models (s) A Markov model where actual state is unobserved Transition between states are probabilistically modeled just like the Markov process Typically there are observable outputs associated with hidden states The probability distribution of observable outputs given an hidden states can be obtained Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

6 An example of 346$ 345$!"#!$ %&'$ 347$ 348$ 3466$ ()**+$ 3493$ 3493$,-)/+$ 3483$ 3435$ 012*+$ 34:3$ Direct Observation : (SUNNY, CLOUDY, RAINY) Hidden States : (HIGH, LOW) Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

7 Mathematical representation of the example States S = {S 1, S 2 = (HIGH, LOW) Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

8 Mathematical representation of the example States S = {S 1, S 2 = (HIGH, LOW) Outcomes O = {O 1, O 2, O 3 = (SUNNY, CLOUDY, RAINY) Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

9 Mathematical representation of the example States S = {S 1, S 2 = (HIGH, LOW) Outcomes O = {O 1, O 2, O 3 = (SUNNY, CLOUDY, RAINY) Initial States π i = Pr(q 1 = S i ), π = {07, 03 Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

10 Mathematical representation of the example States S = {S 1, S 2 = (HIGH, LOW) Outcomes O = {O 1, O 2, O 3 = (SUNNY, CLOUDY, RAINY) Initial States π i = Pr(q 1 = S i ), π = {07, 03 Transition A ij = Pr(q t+1 = S j q t = S i ) A = ( Emission B ij = b qt (o t ) = b Si (O j ) = Pr(o t = O j q t = S i ) B = ) ( ) Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

11 Unconditional marginal probabilities What is the chance of rain in the day 4? ( ) ( ) Pr(q4 = S f(q 4 ) = 1 ) = (A T ) π = Pr(q 4 = S 2 ) 0331 Pr(o 4 = O 1 ) 0621 g(o 4 ) = Pr(o 4 = O 2 ) = B T f(q 4 ) = 0266 Pr(o 4 = O 3 ) 0233 The chance of rain in day 4 is 233% Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

12 Marginal likelihood of data in Let λ = (A, B, π) For a sequence of observation o = {o 1,, o t, Pr(o λ) = q Pr(o q, λ) Pr(q λ) t t Pr(o q, λ) = Pr(o i q i, λ) = b qi (o i ) Pr(q λ) = π q1 t Pr(o λ) = q i=1 i=1 i=2 a qi 1 q i π q1 b q1 (o 1 ) t a qi 1 q i b qi (o i ) i=2 Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

13 Naive computation of the likelihood Pr(o λ) = q t π q1 b q1 (o 1 ) a qi 1 q i b qi (o i ) i=2 Number of possible q = 2 t are exponentially growing with the number of observations Computational would be infeasible for large number of observations Algorithmic solution required for efficient computation Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

14 More Markov Chain Question If the observation was (SUNNY,SUNNY,CLOUDY,RAINY,RAINY) from day 1 through day 5, what is the distribution of hidden states for each day? Need to know Pr(q t o, λ) Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

15 Forward and backward probabilities q t = (q 1,, q t 1 ), q + t = (q t+1,, q T ) o t = (o 1,, o t 1 ), o + t = (o t+1,, o T ) Pr(q t = i o, λ) = Pr(q t = i, o λ) Pr(q = t = i, o λ) Pr(o λ) n j=1 Pr(q t = j, o λ) Pr(q t, o λ) = Pr(q t, o t, o t, o + t λ) = Pr(o + t q t, λ) Pr(o t q t, λ) Pr(o t q t, λ) Pr(q t λ) = Pr(o + t q t, λ) Pr(o t, o t, q t λ) = β t (q t )α t (q t ) If α t (q t ) and β t (q t ) is known, Pr(q t o, λ) can be computed in a linear time Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

16 DP algorithm for calculating forward probability Key idea is to use (q t, o t ) o t q t 1 Each of q t 1, q t, and q t+1 is a Markov blanket α t (i) = Pr(o 1,, o t, q t = i λ) n = Pr(o t, o t, q t 1 = j, q t = i λ) = = j=1 n Pr(o t, q t 1 = j λ) Pr(q t = i q t 1 = j, λ) Pr(o t q t = i, λ) j=1 n α t 1 (j)a ji b i (o t ) j=1 α 1 (i) = π i b i (o 1 ) Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

17 Conditional dependency in forward-backward algorithms Forward : (q t, o t ) o t q t 1 Backward : o t+1 o + t+1 q t+1!"!" "#$ % " % "&$ %!"! "#$%! "%! "&$%!"!" ' "#$% ' "% ' "&$%!" Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

18 DP algorithm for calculating backward probability Key idea is to use o t+1 o + t+1 q t+1 β t (i) = Pr(o t+1,, o T q t = i, λ) n = Pr(o t+1, o + t+1, q t+1 = j q t = i, λ) = = β T (i) = 1 j=1 n Pr(o t+1 q t+1, λ) Pr(o + t+1 q t+1 = j, λ) Pr(q t+1 = j q t = i, λ) j=1 n β t+1 (j)a ij b j (o t+1 ) j=1 Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

19 Putting forward and backward probabilities together Conditional probability of states given data Pr(q t = i o, λ) = = Pr(o, q t = S i λ) n j=1 Pr(o, q t = S j λ) α t (i)β t (i) n j=1 α t(j)β t (j) Time complexity is Θ(n 2 T) Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

20 Finding the most likely trajectory of hidden states Given a series of observations, we want to compute Define δ t (i) as arg max Pr(q o, λ) q δ t (i) = max Pr(q, o λ) q Use dynamic programming algorithm to find the most likely path Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

21 The algorithm Initialization δ 1 (i) = πb i (o 1 ) for 1 i n Maintenance δ t (i) = max j δ t 1 (j)a ji b i (o t ) ϕ t (i) = arg max j δ t 1 (j)a ji Termination Max likelihood is max i δ T (i) Optimal path can be backtracked using ϕ t (i) Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

22 An example Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

23 An example path When observations were (walk, shop, clean) Similar to Manhattan tourist problem Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

24 A working example : Occasionally biased coin A generative Observations : O = {1(Head), 2(Tail) Hidden states : S = {1(Fair), 2(Biased) Initial states : π = {05, 05 ( ) Transition probability : A(i, j) = a ij = ( ) Emission probability : B(i, j) = b i (j) = Questions Given coin toss observations, estimate the probability of each state Given coin toss observations, what is the most likely series of states? Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

25 Implementing - Matrix615h #ifndef MATRIX_615_H #define MATRIX_615_H #include <vector> // to avoid multiple inclusion of same headers template <class T> class Matrix615 { public: std::vector< std::vector<t> > data; Matrix615(int nrow, int ncol, T val = 0) { dataresize(nrow); // make n rows for(int i=0; i < nrow; ++i) { data[i]resize(ncol,val); // make n cols with default value val int rownums() { return (int)datasize(); int colnums() { return ( datasize() == 0 )? 0 : (int)data[0]size(); ; #endif // MATRIX_615_H Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

26 Implementations - 615h #ifndef 615_H #define 615_H #include "Matrix615h" class 615 { public: // parameters int nstates; // n : number of possible states int nobs; // m : number of possible output values int ntimes; // t : number of time slots with observations std::vector<double> pis; // initial states std::vector<int> outs; // observed outcomes Matrix615<double> trans; // trans[i][j] corresponds to A_{ij Matrix615<double> emis; // storages for dynamic programming Matrix615<double> alphas, betas, gammas, deltas; Matrix615<int> phis; std::vector<int> path; Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

27 Implementations - 615h 615(int states, int obs, int times) : nstates(states), nobs(obs), ntimes(times), trans(states, states, 0), emis(states, obs, 0), alphas(times, states, 0), betas(times, states, 0), gammas(times, states, 0), deltas(times, states, 0), phis(times, states, 0) { pisresize(nstates); pathresize(ntimes); void forward(); // given below void backward(); // void forwardbackward(); // given below void viterbi(); // ; #endif // 615_H Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

28 Implementations - 615::forward() void 615::forward() { for(int i=0; i < nstates; ++i) { alphasdata[0][i] = pis[i] * emisdata[i][outs[0]]; for(int t=1; t < ntimes; ++t) { for(int i=0; i < nstates; ++i) { alphasdata[t][i] = 0; for(int j=0; j < nstates; ++j) { alphasdata[t][i] += (alphasdata[t-1][j] * transdata[j][i] * emisdata[i][outs[t]]); Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

29 Implementations - 615::backward() void 615::backward() { for(int i=0; i < nstates; ++i) { betasdata[ntimes-1][i] = 1; for(int t=ntimes-2; t >=0; --t) { for(int i=0; i < nstates; ++i) { betasdata[t][i] = 0; for(int j=0; j < nstates; ++j) { betasdata[t][i] += (betasdata[t+1][j] * transdata[i][j] * emisdata[j][outs[t+1]]); Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

30 Implementations - 615::forwardBackward() void 615::forwardBackward() { forward(); backward(); for(int t=0; t < ntimes; ++t) { double sum = 0; for(int i=0; i < nstates; ++i) { sum += (alphasdata[t][i] * betasdata[t][i]); for(int i=0; i < nstates; ++i) { gammasdata[t][i] = (alphasdata[t][i] * betasdata[t][i])/sum; Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

31 Implementations - 615::viterbi() void 615::viterbi() { for(int i=0; i < nstates; ++i) { deltasdata[0][i] = pis[i] * emisdata[i][ outs[0] ]; for(int t=1; t < ntimes; ++t) { for(int i=0; i < nstates; ++i) { int maxidx = 0; double maxval = deltasdata[t-1][0] * transdata[0][i] * emisdata[i][ outs[t] ]; for(int j=1; j < nstates; ++j) { double val = deltasdata[t-1][j] * transdata[j][i] * emisdata[i][ outs[t] ]; if ( val > maxval ) { maxidx = j; maxval = val; deltasdata[t][i] = maxval; phisdata[t][i] = maxidx; Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

32 Implementations - 615::viterbi() (cont d) // backtrack viterbi path double maxdelta = deltasdata[ntimes-1][0]; path[ntimes-1] = 0; for(int i=1; i < nstates; ++i) { if ( maxdelta < deltasdata[ntimes-1][i] ) { maxdelta = deltasdata[ntimes-1][i]; path[ntimes-i] = i; for(int t=ntimes-2; t >= 0; --t) { path[t] = phisdata[t+1][ path[t+1] ]; Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

33 Implementations - biasedcoincpp #include <iostream> #include <iomanip> int main(int argc, char** argv) { std::vector<int> toss; std::string tok; while( std::cin >> tok ) { if ( tok == "H" ) tosspush_back(0); else if ( tok == "T" ) tosspush_back(1); else { std::cerr << "Cannot recognize input " << tok << std::endl; return -1; int T = tosssize(); 615 hmm(2, 2, T); hmmtransdata[0][0] = 095; hmmtransdata[0][1] = 005; hmmtransdata[1][0] = 02; hmmtransdata[1][1] = 08; Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

34 Implementations - biasedcoincpp hmmemisdata[0][0] = 05; hmmemisdata[0][1] = 05; hmmemisdata[1][0] = 09; hmmemisdata[1][1] = 01; hmmpis[0] = 05; hmmpis[1] = 05; hmmouts = toss; hmmforwardbackward(); hmmviterbi(); std::cout << "TIME\tTOSS\tP(FAIR)\tP(BIAS)\tMLSTATE" << std::endl; std::cout << std::setiosflags(std::ios::fixed) << std::setprecision(4); for(int t=0; t < T; ++t) { std::cout << t+1 << "\t" << (toss[t] == 0? "H" : "T") << "\t" << hmmgammasdata[t][0] << "\t" << hmmgammasdata[t][1] << "\t" << (hmmpath[t] == 0? "FAIR" : "BIASED" ) << std::endl; return 0; Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

35 Example runs $ cat ~hmkang/public/615/data/toss20txt ~hmkang/public/615/bin/biasedcoin TIME TOSS P(FAIR) P(BIAS) MLSTATE 1 H FAIR 2 T FAIR 3 H FAIR 4 T FAIR 5 H FAIR 6 H FAIR 7 T FAIR 8 H BIASED 9 H BIASED 10 H BIASED 11 H BIASED 12 H BIASED 13 H BIASED 14 T BIASED 15 H BIASED 16 H BIASED 17 H BIASED 18 H BIASED 19 H BIASED 20 H BIASED Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

36 Today - Hidden Markov Models algorithm algorithm Example Next Week Basic Usage of STL containers Using Eigen Library Interfacing between R and C++ Hyun Min Kang Biostatistics 615/815 - Lecture 10 October 4th, / 33

Biostatistics 615/815 Lecture 11: Hidden Markov Models, Standard Template Library, and Boost Library

Biostatistics 615/815 Lecture 11: Hidden Markov Models, Standard Template Library, and Boost Library Biostatistics 615/815 Lecture 11: Hidden Markov Models, Standard Template Library, and Library Hyun Min Kang October 9th, 2012 Hyun Min Kang Biostatistics 615/815 - Lecture 11 October 9th, 2012 1 / 38

More information

Biostatistics 615/815 Lecture 9: Dynamic Programming

Biostatistics 615/815 Lecture 9: Dynamic Programming Biostatistics 615/815 Lecture 9: Dynamic Programming Hyun Min Kang October 4th, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 8 October 4th, 2011 1 / 40 Direct address tables Direct address table

More information

Biostatistics 615/815 Lecture 23: The Baum-Welch Algorithm Advanced Hidden Markov Models

Biostatistics 615/815 Lecture 23: The Baum-Welch Algorithm Advanced Hidden Markov Models Biostatistics 615/815 Lecture 23: The Algorithm Advanced Hidden Markov Models Hyun Min Kang April 12th, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 22 April 12th, 2011 1 / 35 Annoucement Homework

More information

Recap: Hash Tables. Recap : Open hash. Recap: Illustration of ChainedHash. Key features. Key components. Probing strategies.

Recap: Hash Tables. Recap : Open hash. Recap: Illustration of ChainedHash. Key features. Key components. Probing strategies. Recap: Hash Tables Biostatistics 5/85 Lecture : Dynamic Programming Hyun Min Kang February 3rd, 2 Hyun Min Kang Biostatistics 5/85 - Lecture February 3rd, 2 / 3 Key features Θ() complexity for Insert,

More information

Biostatistics 615/815 Lecture 13: Programming with Matrix

Biostatistics 615/815 Lecture 13: Programming with Matrix Computation Biostatistics 615/815 Lecture 13: Programming with Hyun Min Kang February 17th, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 13 February 17th, 2011 1 / 28 Annoucements Computation Homework

More information

Biostatistics 615/815 Lecture 20: Expectation-Maximization (EM) Algorithm

Biostatistics 615/815 Lecture 20: Expectation-Maximization (EM) Algorithm Biostatistics 615/815 Lecture 20: Expectation-Maximization (EM) Algorithm Hyun Min Kang March 31st, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 20 March 31st, 2011 1 / 38 Recap - The Simplex Method

More information

Biostatistics 615/815 Lecture 6: Linear Sorting Algorithms and Elementary Data Structures

Biostatistics 615/815 Lecture 6: Linear Sorting Algorithms and Elementary Data Structures Biostatistics 615/815 Lecture 6: Linear Sorting Algorithms and Elementary Data Structures Hyun Min Kang Januray 25th, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 6 Januray 25th, 2011 1 / 32 Announcements

More information

Biostatistics 615/815 Lecture 22: Matrix with C++

Biostatistics 615/815 Lecture 22: Matrix with C++ Biostatistics 615/815 Lecture 22: Matrix with C++ Hyun Min Kang December 1st, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 22 December 1st, 2011 1 / 33 Recap - A case for simple linear regression

More information

Recap: The E-M algorithm. Biostatistics 615/815 Lecture 22: Gibbs Sampling. Recap - Local minimization methods

Recap: The E-M algorithm. Biostatistics 615/815 Lecture 22: Gibbs Sampling. Recap - Local minimization methods Recap: The E-M algorithm Biostatistics 615/815 Lecture 22: Gibbs Sampling Expectation step (E-step) Given the current estimates of parameters λ (t), calculate the conditional distribution of latent variable

More information

Biostatistics 615/815 Lecture 5: More on STLs, and Divide and Conquer Algorithms

Biostatistics 615/815 Lecture 5: More on STLs, and Divide and Conquer Algorithms Biostatistics 615/815 Lecture 5: More on s, and Algorithms Hyun Min Kang Januray 20th, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 5 Januray 20th, 2011 1 / 28 Announcements Homework #1 is due, late

More information

Biostatistics 615/815 Statistical Computing

Biostatistics 615/815 Statistical Computing Biostatistics 615/815 Statistical Computing Hyun Min Kang Januray 6th, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 1 Januray 6th, 2011 1 / 35 Objectives Understanding computational aspects of statistical

More information

Biostatistics 615/815 Lecture 19: Multidimensional Optimizations

Biostatistics 615/815 Lecture 19: Multidimensional Optimizations Biostatistics 615/815 Lecture 19: Multidimensional Optimizations Hyun Min Kang March 29th, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 19 March 29th, 2011 1 / 43 Annoucements Homework Homework #5

More information

Biostatistics 615/815 Lecture 5: Divide and Conquer Algorithms Sorting Algorithms

Biostatistics 615/815 Lecture 5: Divide and Conquer Algorithms Sorting Algorithms Biostatistics 615/815 Lecture 5: Algorithms Algorithms Hyun Min Kang September 20th, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 5 September 20th, 2011 1 / 30 Recap - An example C++ class #include

More information

Biostatistics 615/815 Lecture 13: Numerical Optimization

Biostatistics 615/815 Lecture 13: Numerical Optimization Biostatistics 615/815 Lecture 13: Numerical Optimization Hyun Min Kang October 27th, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 13 October 27th, 2011 1 / 35 The Problem Hyun Min Kang Biostatistics

More information

CSCI-1200 Data Structures Fall 2017 Lecture 2 STL Strings & Vectors

CSCI-1200 Data Structures Fall 2017 Lecture 2 STL Strings & Vectors Announcements CSCI-1200 Data Structures Fall 2017 Lecture 2 STL Strings & Vectors HW 1 is available on-line through the website (on the Calendar ). Be sure to read through this information as you start

More information

ECE521: Week 11, Lecture March 2017: HMM learning/inference. With thanks to Russ Salakhutdinov

ECE521: Week 11, Lecture March 2017: HMM learning/inference. With thanks to Russ Salakhutdinov ECE521: Week 11, Lecture 20 27 March 2017: HMM learning/inference With thanks to Russ Salakhutdinov Examples of other perspectives Murphy 17.4 End of Russell & Norvig 15.2 (Artificial Intelligence: A Modern

More information

CSCI-1200 Data Structures Spring 2015 Lecture 2 STL Strings & Vectors

CSCI-1200 Data Structures Spring 2015 Lecture 2 STL Strings & Vectors Announcements CSCI-1200 Data Structures Spring 2015 Lecture 2 STL Strings & Vectors HW 1 is available on-line through the website (on the Calendar ). Be sure to read through this information as you start

More information

Biostatistics 615/815 Lecture 4: User-defined Data Types, Standard Template Library, and Divide and Conquer Algorithms

Biostatistics 615/815 Lecture 4: User-defined Data Types, Standard Template Library, and Divide and Conquer Algorithms Biostatistics 615/815 Lecture 4: User-defined Data Types, Standard Template Library, and Algorithms Hyun Min Kang September 15th, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 4 September 15th, 2011

More information

Biostatistics 615/815 - Lecture 2 Introduction to C++ Programming

Biostatistics 615/815 - Lecture 2 Introduction to C++ Programming Biostatistics 615/815 - Lecture 2 Introduction to C++ Programming Hyun Min Kang September 6th, 2012 Hyun Min Kang Biostatistics 615/815 - Lecture 2 September 6th, 2012 1 / 31 Last Lecture Algorithms are

More information

Hidden Markov Models. Slides adapted from Joyce Ho, David Sontag, Geoffrey Hinton, Eric Xing, and Nicholas Ruozzi

Hidden Markov Models. Slides adapted from Joyce Ho, David Sontag, Geoffrey Hinton, Eric Xing, and Nicholas Ruozzi Hidden Markov Models Slides adapted from Joyce Ho, David Sontag, Geoffrey Hinton, Eric Xing, and Nicholas Ruozzi Sequential Data Time-series: Stock market, weather, speech, video Ordered: Text, genes Sequential

More information

Announcements. Biostatistics 615/815 Lecture 7: Data Structures. Recap : Radix sort. Recap : Elementary data structures. Another good and bad news

Announcements. Biostatistics 615/815 Lecture 7: Data Structures. Recap : Radix sort. Recap : Elementary data structures. Another good and bad news Announcements Biostatistics 615/815 Lecture 7: Data Structures Hyun Min Kang Januray 27th, 2011 Another good and bad news Homework #2 is finally announced Due is on Feb 7th, but better start earlier 815

More information

Parallel HMMs. Parallel Implementation of Hidden Markov Models for Wireless Applications

Parallel HMMs. Parallel Implementation of Hidden Markov Models for Wireless Applications Parallel HMMs Parallel Implementation of Hidden Markov Models for Wireless Applications Authors Shawn Hymel (Wireless@VT, Virginia Tech) Ihsan Akbar (Harris Corporation) Jeffrey Reed (Wireless@VT, Virginia

More information

Announcements. Biostatistics 615/815 Lecture 8: Hash Tables, and Dynamic Programming. Recap: Example of a linked list

Announcements. Biostatistics 615/815 Lecture 8: Hash Tables, and Dynamic Programming. Recap: Example of a linked list Announcements Biostatistics 615/815 Lecture 8:, and Dynamic Programming Hyun Min Kang February 1st, 2011 Homework #2 For problem 3, assume that all the input values are unique Include the class definition

More information

Biostatistics 615/815 - Statistical Computing Lecture 1 : Introduction to Statistical Computing

Biostatistics 615/815 - Statistical Computing Lecture 1 : Introduction to Statistical Computing Biostatistics 615/815 - Statistical Computing Lecture 1 : Introduction to Statistical Computing Hyun Min Kang September 4th, 2012 Hyun Min Kang Biostatistics 615/815 - Lecture 1 September 4th, 2012 1 /

More information

Hidden Markov Model for Sequential Data

Hidden Markov Model for Sequential Data Hidden Markov Model for Sequential Data Dr.-Ing. Michelle Karg mekarg@uwaterloo.ca Electrical and Computer Engineering Cheriton School of Computer Science Sequential Data Measurement of time series: Example:

More information

Statistical Methods for NLP

Statistical Methods for NLP Statistical Methods for NLP Information Extraction, Hidden Markov Models Sameer Maskey * Most of the slides provided by Bhuvana Ramabhadran, Stanley Chen, Michael Picheny Speech Recognition Lecture 4:

More information

Announcements. Biostatistics 615/815 Lecture 5: More on STLs, and Divide and Conquer Algorithms. Recap on STL : vector.

Announcements. Biostatistics 615/815 Lecture 5: More on STLs, and Divide and Conquer Algorithms. Recap on STL : vector. Announcements Biostatistics 615/815 Lecture 5: More on s, and Algorithms Hyun Min Kang Januray 20th, 2011 Homework #1 is due, late submission will be better than no submission For 815 project, rank your

More information

CSCI-1200 Data Structures Fall 2017 Lecture 12 Advanced Recursion

CSCI-1200 Data Structures Fall 2017 Lecture 12 Advanced Recursion CSCI-1200 Data Structures Fall 2017 Lecture 12 Advanced Recursion Review from Lecture 11 & Lab 6 Limitations of singly-linked lists Doubly-linked lists: Structure Insert Remove Our own version of the STL

More information

Working with Batches of Data

Working with Batches of Data Hartmut Kaiser hkaiser@cct.lsu.edu http://www.cct.lsu.edu/ hkaiser/fall_2012/csc1254.html 2 Abstract So far we looked at simple read a string print a string problems. Now we will look at more complex problems

More information

Biostatistics 615/815 - Statistical Computing Lecture 1 : Introduction to Statistical Computing

Biostatistics 615/815 - Statistical Computing Lecture 1 : Introduction to Statistical Computing Biostatistics 615/815 - Statistical Computing Lecture 1 : Introduction to Statistical Computing Hyun Min Kang September 6th, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 1 September 6th, 2011 1 /

More information

CSCI 135 Software Design and Analysis, C++ Homework 8 Solution

CSCI 135 Software Design and Analysis, C++ Homework 8 Solution CSCI 135 Software Design and Analysis, C++ Homework 8 Solution Saad Mneimneh Computer Science Hunter College of CUNY Problem 1: Two-dimensional arrays and the 15 puzzle The 15 puzzle consist of 15 pieces

More information

Biostatistics 615/815 Lecture 16: Importance sampling Single dimensional optimization

Biostatistics 615/815 Lecture 16: Importance sampling Single dimensional optimization Biostatistics 615/815 Lecture 16: Single dimensional optimization Hyun Min Kang November 1st, 2012 Hyun Min Kang Biostatistics 615/815 - Lecture 16 November 1st, 2012 1 / 59 The crude Monte-Carlo Methods

More information

Biostatistics 615/815 - Lecture 2 Introduction to C++ Programming

Biostatistics 615/815 - Lecture 2 Introduction to C++ Programming Biostatistics 615/815 - Lecture 2 Introduction to C++ Programming Hyun Min Kang September 8th, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 2 September 8th, 2011 1 / 47 BIOSTAT615/815 - Objectives

More information

Biostatistics 615/815 Implementing Fisher s Exact Test

Biostatistics 615/815 Implementing Fisher s Exact Test Biostatistics 615/815 Implementing Fisher s Exact Test Hyun Min Kang Januray 13th, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 3 Januray 13th, 2011 1 / 22 Recap - helloworld - Have all tried? Writing

More information

CSCI-1200 Data Structures Fall 2014 Lecture 12 Recursion

CSCI-1200 Data Structures Fall 2014 Lecture 12 Recursion CSCI-1200 Data Structures Fall 2014 Lecture 12 Recursion Announcements: Test 2 Information Test 2 will be held Tuesday, October 14th, 2014 from 6-7:50pm in DCC 308 (Sections 1-5) and DCC 324 (Sections

More information

Biostatistics 615/815 - Lecture 3 C++ Basics & Implementing Fisher s Exact Test

Biostatistics 615/815 - Lecture 3 C++ Basics & Implementing Fisher s Exact Test Biostatistics 615/815 - Lecture 3 C++ Basics & Implementing Fisher s Exact Test Hyun Min Kang September 11th, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 3 September 11th, 2011 1 / 37 helloworldcpp

More information

Programmazione. Prof. Marco Bertini

Programmazione. Prof. Marco Bertini Programmazione Prof. Marco Bertini marco.bertini@unifi.it http://www.micc.unifi.it/bertini/ Hello world : a review Some differences between C and C++ Let s review some differences between C and C++ looking

More information

Biostatistics 615/815 Lecture 13: R packages, and Matrix Library

Biostatistics 615/815 Lecture 13: R packages, and Matrix Library Computation Biostatistics 615/815 Lecture 13: R packages, and Library Hyun Min Kang October 18th, 2012 Hyun Min Kang Biostatistics 615/815 - Lecture 13 October 18th, 2012 1 / 23 Writing an R package Computation

More information

Modeling time series with hidden Markov models

Modeling time series with hidden Markov models Modeling time series with hidden Markov models Advanced Machine learning 2017 Nadia Figueroa, Jose Medina and Aude Billard Time series data Barometric pressure Temperature Data Humidity Time What s going

More information

Conditional Random Fields and beyond D A N I E L K H A S H A B I C S U I U C,

Conditional Random Fields and beyond D A N I E L K H A S H A B I C S U I U C, Conditional Random Fields and beyond D A N I E L K H A S H A B I C S 5 4 6 U I U C, 2 0 1 3 Outline Modeling Inference Training Applications Outline Modeling Problem definition Discriminative vs. Generative

More information

Biostatistics 615/815 - Lecture 3 C++ Basics & Implementing Fisher s Exact Test

Biostatistics 615/815 - Lecture 3 C++ Basics & Implementing Fisher s Exact Test Biostatistics 615/815 - Lecture 3 C++ Basics & Implementing Fisher s Exact Test Hyun Min Kang September 13th, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 3 September 13th, 2011 1 / 31 helloworldcpp

More information

CSCI-1200 Data Structures Spring 2017 Lecture 13 Advanced Recursion

CSCI-1200 Data Structures Spring 2017 Lecture 13 Advanced Recursion CSCI-1200 Data Structures Spring 2017 Lecture 13 Advanced Recursion Announcements: Test 2 Information Test 2 will be held Monday, Mar. 6th from 6-8pm. Your test room & zone assignment is posted on the

More information

An Introduction to Hidden Markov Models

An Introduction to Hidden Markov Models An Introduction to Hidden Markov Models Max Heimel Fachgebiet Datenbanksysteme und Informationsmanagement Technische Universität Berlin http://www.dima.tu-berlin.de/ 07.10.2010 DIMA TU Berlin 1 Agenda

More information

Spare Matrix Formats, and The Standard Template Library

Spare Matrix Formats, and The Standard Template Library Annotated slides CS319: Scientific Computing (with C++) Spare Matrix Formats, and The Standard Template Library Week 10: 9am and 4pm, 20 March 2019 1 Sparse Matrices 2 3 Compressed Column Storage 4 (Not)

More information

CSCI-1200 Data Structures Fall 2013 Lecture 9 Iterators & Lists

CSCI-1200 Data Structures Fall 2013 Lecture 9 Iterators & Lists Review from Lecture 8 CSCI-1200 Data Structures Fall 2013 Lecture 9 Iterators & Lists Explored a program to maintain a class enrollment list and an associated waiting list. Unfortunately, erasing items

More information

Unified Modeling Language a case study

Unified Modeling Language a case study Unified Modeling Language a case study 1 an online phone book use case diagram encapsulating a file 2 Command Line Arguments arguments of main arrays of strings 3 Class Definition the filesphonebook.h

More information

Signals, Instruments, and Systems W2. C Programming (continued)

Signals, Instruments, and Systems W2. C Programming (continued) Signals, Instruments, and Systems W2 C Programming (continued) 1 Resources 2 Remember man? You can use man to show information about functions in the standard libraries of C: e.g. man printf or man atan2

More information

Part XI. Algorithms and Templates. Philip Blakely (LSC) C++ Introduction 314 / 370

Part XI. Algorithms and Templates. Philip Blakely (LSC) C++ Introduction 314 / 370 Part XI Algorithms and Templates Philip Blakely (LSC) C++ Introduction 314 / 370 STL Algorithms Outline 44 STL Algorithms 45 Templates 46 Summing an array 47 Templated classes Philip Blakely (LSC) C++

More information

BITG 1113: Array (Part 1) LECTURE 8

BITG 1113: Array (Part 1) LECTURE 8 BITG 1113: Array (Part 1) LECTURE 8 1 1 LEARNING OUTCOMES At the end of this lecture, you should be able to: 1. Describe the fundamentals of arrays 2. Describe the types of array: One Dimensional (1 D)

More information

COMP6771 Advanced C++ Programming

COMP6771 Advanced C++ Programming 1. COMP6771 Advanced C++ Programming Week 7 Part One: Member Templates and 2016 www.cse.unsw.edu.au/ cs6771 2. Member Templates Consider this STL code: 1 #include 2 #include 3 #include

More information

Biostatistics 615/815 Lecture 23: Using C++ code in R

Biostatistics 615/815 Lecture 23: Using C++ code in R Biostatistics 615/815 Lecture 23: Using C++ code in Hyun Min Kang December 6th, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 23 December 6th, 2011 1 / 30 ecommended Skill Sets for Students 1 One

More information

Structuur van Computerprogramma s 2

Structuur van Computerprogramma s 2 Structuur van Computerprogramma s 2 dr. Dirk Deridder Dirk.Deridder@vub.ac.be http://soft.vub.ac.be/ Vrije Universiteit Brussel - Faculty of Science and Bio-Engineering Sciences - Computer Science Department

More information

Functions and Recursion

Functions and Recursion Functions and Recursion 1 some useful problems 2 Function: power Power iteration Power recursive #include #include 3 using std::cout; using std::cin; using std::endl; // function prototype

More information

1 #include <iostream > 3 using std::cout; 4 using std::cin; 5 using std::endl; 7 int main(){ 8 int x=21; 9 int y=22; 10 int z=5; 12 cout << (x/y%z+4);

1 #include <iostream > 3 using std::cout; 4 using std::cin; 5 using std::endl; 7 int main(){ 8 int x=21; 9 int y=22; 10 int z=5; 12 cout << (x/y%z+4); 2 3 using std::cout; 4 using std::cin; using std::endl; 6 7 int main(){ 8 int x=21; 9 int y=22; int z=; 11 12 cout

More information

Recursion Examples. Factorial Recursive: Factorial Iterative: #include <iostream> using namespace std; long fact(long n) { if (n == 1) return 1;

Recursion Examples. Factorial Recursive: Factorial Iterative: #include <iostream> using namespace std; long fact(long n) { if (n == 1) return 1; Recursion Examples Factorial Recursive: long fact(long n) if (n == 1) return 1; return n*fact(n-1); int main() long n; cout > n; cout

More information

Regularization and Markov Random Fields (MRF) CS 664 Spring 2008

Regularization and Markov Random Fields (MRF) CS 664 Spring 2008 Regularization and Markov Random Fields (MRF) CS 664 Spring 2008 Regularization in Low Level Vision Low level vision problems concerned with estimating some quantity at each pixel Visual motion (u(x,y),v(x,y))

More information

Dynamic Programming. Ellen Feldman and Avishek Dutta. February 27, CS155 Machine Learning and Data Mining

Dynamic Programming. Ellen Feldman and Avishek Dutta. February 27, CS155 Machine Learning and Data Mining CS155 Machine Learning and Data Mining February 27, 2018 Motivation Much of machine learning is heavily dependent on computational power Many libraries exist that aim to reduce computational time TensorFlow

More information

Informatik I (D-ITET) Übungsstunde 9, Hossein Shafagh

Informatik I (D-ITET) Übungsstunde 9, Hossein Shafagh Informatik I (D-ITET) Übungsstunde 9, 20.11.2017 Hossein Shafagh shafagh@inf.ethz.ch Self-Assessment III 1) Characters: FILO - 2P for the completely correct answer - 0P otherwise 2) Pointers Self-Assessment

More information

Using Hidden Markov Models to analyse time series data

Using Hidden Markov Models to analyse time series data Using Hidden Markov Models to analyse time series data September 9, 2011 Background Want to analyse time series data coming from accelerometer measurements. 19 different datasets corresponding to different

More information

Lecture 21 : A Hybrid: Deep Learning and Graphical Models

Lecture 21 : A Hybrid: Deep Learning and Graphical Models 10-708: Probabilistic Graphical Models, Spring 2018 Lecture 21 : A Hybrid: Deep Learning and Graphical Models Lecturer: Kayhan Batmanghelich Scribes: Paul Liang, Anirudha Rayasam 1 Introduction and Motivation

More information

Announcements. Lecture 05a Header Classes. Midterm Format. Midterm Questions. More Midterm Stuff 9/19/17. Memory Management Strategy #0 (Review)

Announcements. Lecture 05a Header Classes. Midterm Format. Midterm Questions. More Midterm Stuff 9/19/17. Memory Management Strategy #0 (Review) Announcements Lecture 05a Sept. 19 th, 2017 9/19/17 CS253 Fall 2017 Bruce Draper 1 Quiz #4 due today (before class) PA1/2 Grading: If something is wrong with your code, you get sympathy PA3 is due today

More information

use static size for this buffer

use static size for this buffer Software Design (C++) 4. Templates and standard library (STL) Juha Vihavainen University of Helsinki Overview Introduction to templates (generics) std::vector again templates: specialization by code generation

More information

Shahram Rahatlou. Static Data Members Enumeration std::pair, std::vector, std::map. Computing Methods in Physics

Shahram Rahatlou. Static Data Members Enumeration std::pair, std::vector, std::map. Computing Methods in Physics Static Data Members Enumeration std::pair, std::vector, std::map Shahram Rahatlou Computing Methods in Physics http://www.roma1.infn.it/people/rahatlou/cmp/ Anno Accademico 2018/19 Class Datum Use static

More information

CS 223: Data Structures and Programming Techniques. Exam 2

CS 223: Data Structures and Programming Techniques. Exam 2 CS 223: Data Structures and Programming Techniques. Exam 2 Instructor: Jim Aspnes Work alone. Do not use any notes or books. You have approximately 75 minutes to complete this exam. Please write your answers

More information

Biology 644: Bioinformatics

Biology 644: Bioinformatics A statistical Markov model in which the system being modeled is assumed to be a Markov process with unobserved (hidden) states in the training data. First used in speech and handwriting recognition In

More information

D A S U N A N K A R A B B I N A K A F A R A K O M A I. 1

D A S U N A N K A R A B B I N A K A F A R A K O M A I. 1 D A S U N A N K A R A B B I N A K A F A R A K O M A I abdussalam@sbu.ac.ir 1 HEPfit a real-world display scientific computing uses S. AbdusSalam Department of Physics, Shahid Beheshti University, Islamic

More information

Filtering (I) Agenda. Getting to know images. Image noise. Image filters. Dr. Chang Shu. COMP 4900C Winter 2008

Filtering (I) Agenda. Getting to know images. Image noise. Image filters. Dr. Chang Shu. COMP 4900C Winter 2008 Filtering (I) Dr. Chang Shu COMP 4900C Winter 008 Agenda Getting to know images. Image noise. Image filters. 1 Digital Images An image - rectangular array of integers Each integer - the brightness or darkness

More information

CSE 100: STREAM I/O, BITWISE OPERATIONS, BIT STREAM I/O

CSE 100: STREAM I/O, BITWISE OPERATIONS, BIT STREAM I/O CSE 100: STREAM I/O, BITWISE OPERATIONS, BIT STREAM I/O PA2: encoding/decoding ENCODING: 1.Scan text file to compute frequencies 2.Build Huffman Tree 3.Find code for every symbol (letter) 4.Create new

More information

BITG 1233: Array (Part 1) LECTURE 8 (Sem 2, 17/18)

BITG 1233: Array (Part 1) LECTURE 8 (Sem 2, 17/18) BITG 1233: Array (Part 1) LECTURE 8 (Sem 2, 17/18) 1 LEARNING OUTCOMES At the end of this lecture, you should be able to: 1. Describe the fundamentals of arrays 2. Describe the types of array: One Dimensional

More information

CS 251 INTERMEDIATE SOFTWARE DESIGN SPRING C ++ Basics Review part 2 Auto pointer, templates, STL algorithms

CS 251 INTERMEDIATE SOFTWARE DESIGN SPRING C ++ Basics Review part 2 Auto pointer, templates, STL algorithms CS 251 INTERMEDIATE SOFTWARE DESIGN SPRING 2011 C ++ Basics Review part 2 Auto pointer, templates, STL algorithms AUTO POINTER (AUTO_PTR) //Example showing a bad situation with naked pointers void MyFunction()

More information

1/29/2011 AUTO POINTER (AUTO_PTR) INTERMEDIATE SOFTWARE DESIGN SPRING delete ptr might not happen memory leak!

1/29/2011 AUTO POINTER (AUTO_PTR) INTERMEDIATE SOFTWARE DESIGN SPRING delete ptr might not happen memory leak! //Example showing a bad situation with naked pointers CS 251 INTERMEDIATE SOFTWARE DESIGN SPRING 2011 C ++ Basics Review part 2 Auto pointer, templates, STL algorithms void MyFunction() MyClass* ptr( new

More information

Professor Terje Haukaas University of British Columbia, Vancouver C++ Programming

Professor Terje Haukaas University of British Columbia, Vancouver  C++ Programming C++ Programming C++ code is essentially a collection of statements terminated by a semicolon, such as (spaces not needed): a = b + c; Most C++ code is organized into header files and cpp files, i.e., C++

More information

Filtering (I) Dr. Chang Shu. COMP 4900C Winter 2008

Filtering (I) Dr. Chang Shu. COMP 4900C Winter 2008 Filtering (I) Dr. Chang Shu COMP 4900C Winter 008 Agenda Getting to know images. Image noise. Image filters. Digital Images An image - rectangular array of integers Each integer - the brightness or darkness

More information

Communication With the Outside World

Communication With the Outside World Communication With the Outside World Program Return Code Arguments From the Program Call Aborting Program Calling Other Programs Data Processing Course, I. Hrivnacova, IPN Orsay I. Hrivnacova @ Data Processing

More information

Hidden Markov Models in the context of genetic analysis

Hidden Markov Models in the context of genetic analysis Hidden Markov Models in the context of genetic analysis Vincent Plagnol UCL Genetics Institute November 22, 2012 Outline 1 Introduction 2 Two basic problems Forward/backward Baum-Welch algorithm Viterbi

More information

GCC : From 2.95 to 3.2

GCC : From 2.95 to 3.2 GCC : From 2.95 to 3.2 Topics Simple changes name of standard include files, std::endl, iostream, throw statements, vector iterators More complicated changes string streams, parameterized macros, hash_map

More information

EMBEDDED SYSTEMS PROGRAMMING Language Basics

EMBEDDED SYSTEMS PROGRAMMING Language Basics EMBEDDED SYSTEMS PROGRAMMING 2014-15 Language Basics (PROGRAMMING) LANGUAGES "The tower of Babel" by Pieter Bruegel the Elder Kunsthistorisches Museum, Vienna ABOUT THE LANGUAGES C (1972) Designed to replace

More information

C++ Basics. Brian A. Malloy. References Data Expressions Control Structures Functions. Slide 1 of 24. Go Back. Full Screen. Quit.

C++ Basics. Brian A. Malloy. References Data Expressions Control Structures Functions. Slide 1 of 24. Go Back. Full Screen. Quit. C++ Basics January 19, 2012 Brian A. Malloy Slide 1 of 24 1. Many find Deitel quintessentially readable; most find Stroustrup inscrutable and overbearing: Slide 2 of 24 1.1. Meyers Texts Two excellent

More information

Decision-Making and Repetition

Decision-Making and Repetition 2.2 Recursion Introduction A recursive method is a method that call itself. You may already be familiar with the factorial function (N!) in mathematics. For any positive integer N, N! is defined to be

More information

PHY4321 Summary Notes

PHY4321 Summary Notes PHY4321 Summary Notes The next few pages contain some helpful notes that summarize some of the more useful material from the lecture notes. Be aware, though, that this is not a complete set and doesn t

More information

Introduction to Languages for Scientific Computing, winter semester 14/15: Final Exam

Introduction to Languages for Scientific Computing, winter semester 14/15: Final Exam Introduction to Languages for Scientific Computing, winter semester 14/15: Final Exam Lecture given by: Paolo Bientinesi First exam, 10.02.2015 The following document is a transcript from memory created

More information

HW3a solution. L1 implies there must be an f1 in Base L2 implies there must be an f2 in Base. So we know there is an f1 and f2 in Base

HW3a solution. L1 implies there must be an f1 in Base L2 implies there must be an f2 in Base. So we know there is an f1 and f2 in Base HW 3 Solution int main(int argc, char **argv) { Base *b = new Base( ); Derived *d = new Derived( ); b->f1( ); // prints "Base f1" L1 b->f2( ); // prints "Base f2" L2 d->f1( ); // prints "Base f1" L3 d->f2(

More information

Main differences with Java

Main differences with Java Signals, Instruments, and Systems W2 C Programming (continued) C Main differences with Java C is NOT object oriented. (C++ is OO) C code is directly translated into binary that can be directly executed

More information

Lab 7: Bayesian analysis of a dice toss problem using C++ instead of python

Lab 7: Bayesian analysis of a dice toss problem using C++ instead of python Lab 7: Bayesian analysis of a dice toss problem using C++ instead of python Due date: Monday March 27, 11:59pm Short version of the assignment Take your python file from lab 6 and convert it into lab7

More information

CSE 333 Lecture 9 - intro to C++

CSE 333 Lecture 9 - intro to C++ CSE 333 Lecture 9 - intro to C++ Hal Perkins Department of Computer Science & Engineering University of Washington Administrivia & Agenda Main topic: Intro to C++ But first: Some hints on HW2 Labs: The

More information

Modeling web-crawlers on the Internet with random walksdecember on graphs11, / 15

Modeling web-crawlers on the Internet with random walksdecember on graphs11, / 15 Modeling web-crawlers on the Internet with random walks on graphs December 11, 2014 Modeling web-crawlers on the Internet with random walksdecember on graphs11, 2014 1 / 15 Motivation The state of the

More information

27: Hybrid Graphical Models and Neural Networks

27: Hybrid Graphical Models and Neural Networks 10-708: Probabilistic Graphical Models 10-708 Spring 2016 27: Hybrid Graphical Models and Neural Networks Lecturer: Matt Gormley Scribes: Jakob Bauer Otilia Stretcu Rohan Varma 1 Motivation We first look

More information

Biostatistics 615 / 815

Biostatistics 615 / 815 Hashing Biostatistics 615 / 815 Lecture 9 Scheduling Lectures on Hashing: October 6 & 8, 2008 Review session: October 14, 2008 Mid-term (in class): October 16, 2008 Last Lecture Merge Sort Bottom-Up Top-Down

More information

Data mining --- mining graphs

Data mining --- mining graphs Data mining --- mining graphs University of South Florida Xiaoning Qian Today s Lecture 1. Complex networks 2. Graph representation for networks 3. Markov chain 4. Viral propagation 5. Google s PageRank

More information

Why C++ is much more fun than C (C++ FAQ)?

Why C++ is much more fun than C (C++ FAQ)? From C to C++ Why C++ is much more fun than C (C++ FAQ)? 1. Classes & methods - OO design 2. Generic programming - Templates allow for code reuse 3. Stricter type system (e.g. function args) 4. Some run-time

More information

Search and Optimization

Search and Optimization Search and Optimization Search, Optimization and Game-Playing The goal is to find one or more optimal or sub-optimal solutions in a given search space. We can either be interested in finding any one solution

More information

An inline function is one in which the function code replaces the function call directly. Inline class member functions

An inline function is one in which the function code replaces the function call directly. Inline class member functions Inline Functions An inline function is one in which the function code replaces the function call directly. Inline class member functions if they are defined as part of the class definition, implicit if

More information

Genome 559. Hidden Markov Models

Genome 559. Hidden Markov Models Genome 559 Hidden Markov Models A simple HMM Eddy, Nat. Biotech, 2004 Notes Probability of a given a state path and output sequence is just product of emission/transition probabilities If state path is

More information

Simulations. buffer of fixed capacity using the STL deque. modeling arrival times generating and processing jobs

Simulations. buffer of fixed capacity using the STL deque. modeling arrival times generating and processing jobs Simulations 1 Circular Queues buffer of fixed capacity using the STL deque 2 Simulating Waiting Lines using Queues modeling arrival times generating and processing jobs MCS 360 Lecture 18 Introduction

More information

CE221 Programming in C++ Part 1 Introduction

CE221 Programming in C++ Part 1 Introduction CE221 Programming in C++ Part 1 Introduction 06/10/2017 CE221 Part 1 1 Module Schedule There are two lectures (Monday 13.00-13.50 and Tuesday 11.00-11.50) each week in the autumn term, and a 2-hour lab

More information

CSCI-1200 Data Structures Fall 2017 Test 1 Solutions

CSCI-1200 Data Structures Fall 2017 Test 1 Solutions CSCI-1200 Data Structures Fall 2017 Test 1 Solutions 1 Searching for Symbols in ASCII Art [ /24] In this problem we will search a large ASCII Art canvas for matches to a target pattern. For example, given

More information

18 October, 2013 MVA ENS Cachan. Lecture 6: Introduction to graphical models Iasonas Kokkinos

18 October, 2013 MVA ENS Cachan. Lecture 6: Introduction to graphical models Iasonas Kokkinos Machine Learning for Computer Vision 1 18 October, 2013 MVA ENS Cachan Lecture 6: Introduction to graphical models Iasonas Kokkinos Iasonas.kokkinos@ecp.fr Center for Visual Computing Ecole Centrale Paris

More information

Machine Learning. Sourangshu Bhattacharya

Machine Learning. Sourangshu Bhattacharya Machine Learning Sourangshu Bhattacharya Bayesian Networks Directed Acyclic Graph (DAG) Bayesian Networks General Factorization Curve Fitting Re-visited Maximum Likelihood Determine by minimizing sum-of-squares

More information

Hidden Markov Models. Implementing the forward-, backward- and Viterbi-algorithms

Hidden Markov Models. Implementing the forward-, backward- and Viterbi-algorithms Hidden Markov Models Implementing the forward-, backward- and Viterbi-algorithms Recursion: Viterbi Basis: Forward Recursion: Basis: Backward Recursion: Basis: Viterbi Recursion: Problem: The values in

More information

General Computer Science II Course: B International University Bremen Date: Dr. Jürgen Schönwälder Deadline:

General Computer Science II Course: B International University Bremen Date: Dr. Jürgen Schönwälder Deadline: General Computer Science II Course: 320102-B International University Bremen Date: 2004-04-28 Dr. Jürgen Schönwälder Deadline: 2004-05-14 Problem Sheet #7 This problem sheet focusses on C++ casting operators

More information