Chapter 20 Part 1 Study Guide Solution ======================================= Q: Define the bag of words features. To make things simpler, let's use a small window side: plus and minus 2 around the target word. In our simple example, we are choosing just 4 features. Note that words like "can" and "a" are excluded because they are stop words. **TRAINING DATA** S1: How can a band of vociferous and woolly-minded objectors deny the hope of life to thousands of young sufferers by stopping this vital research for the sake of a few unformed embryonic cells? BOW["vociferous"] = 1 BOW["woolly-minded"] = 1 BOW["objectors"] = 1 S2: The voices of Sarah Gilbertson and Tony Mansell were joined by three more from the band as the Moonlight Serenaders to give us the cool harmonies of Miller's original Modernairs. BOW["Moonlight"] = 1 BOW["Serenaders"] = 1 S3: In the process they've lost a certain edge, for at the end The Cateran had the rage and the fury of a band at its peak falling apart. BOW["fury"] = 1 BOW["peak"] = 1 BOW["falling"] = 1 BOW["apart"] = 1 S4: The band played with fury at peak. BOW["fury"] = 2 BOW["peak"] = 2 BOW["played"] = 1 S5: The vociferous band of objectors made its way to the palace. BOW["vociferous"] = 2 BOW["objectors"] = 2 Choose the top 4 most frequent. So, we have one feature for each of "fury", "peak", "vociferous", and "objectors". S1: 0,0,1,1 S2: 0,0,0,0 S3: 1,1,0,0 S4: 1,1,0,0 S5: 0,0,1,1 *** TEST DATA *** S6: The band, at their peak, just finished a tour supporting Soul II Soul are currently playing PAs around the county. S6: 0,1,0,0 S7: The malts vary so much that a growing band of objectors are making themselves heard. S7: 0,0,0,1