131A_1_train_filter

131A_1_train_filter - % % EE131A: Probabilities % % File:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % EE131A: Probabilities % % File: train_filter.m % % Author: Nikolaos Kontorinis % % Date: 12/01/04 % % Description: Computes the spam probabilities of the words contained % in the training files bad_freq.txt and good_freq.txt % ATTENTION: % The two files bad_freq.txt and good_freq.txt should be % in the same directory with the .m files. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear all; %Open the two files with the training sets fid_bad = fopen('bad_freq.txt','r'); fid_good = fopen('good_freq.txt','r'); Number_bad_words=370; Number_good_words=276; %Read the bad words and their frequencies for m = 1:Number_bad_words n=1; temp = fscanf(fid_bad,'%1c',1); temp = fscanf(fid_bad,'%1c',1); %Without this end %--Ian Salman % temp = fscanf(fid_bad,'%1c',1); %Read one char each time. bad(m,n)=temp;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

131A_1_train_filter - % % EE131A: Probabilities % % File:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online