Mercurial > hg > machine-learning-hw6
view emailFeatures.m @ 3:ace890ed0ed9 default tip
Use lookup to look for all words at once
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Sat, 10 Dec 2011 15:56:02 -0500 |
parents | e0f1290d2b43 |
children |
line wrap: on
line source
function x = emailFeatures(word_indices) ##EMAILFEATURES takes in a word_indices vector and produces a feature vector ##from the word indices ## x = EMAILFEATURES(word_indices) takes in a word_indices vector and ## produces a feature vector from the word indices. ## Total number of words in the dictionary n = 1899; ## You need to return the following variables correctly. x = zeros(n, 1); x(word_indices) = 1; endfunction