SpamOrHam path
haf opened this issue · 0 comments
haf commented
Trying to use SpamOrHam on OS X:
➜ SpamOrHam git:(spam-ham-xplat) fsharpi NaiveBayes.fsx
System.IO.DirectoryNotFoundException: Could not find a part of the path "/Users/h/dev/haf/machine-learning-projects-for-dot-net-developers/chapter-2/Data/SMSSpamCollection".
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) in <filename unknown>:line 0
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, System.String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) in <filename unknown>:line 0
at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool)
at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost) in <filename unknown>:line 0
at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) in <filename unknown>:line 0
at System.IO.StreamReader..ctor (System.String path, Boolean detectEncodingFromByteOrderMarks) in <filename unknown>:line 0
at System.IO.StreamReader..ctor (System.String path) in <filename unknown>:line 0
at (wrapper remoting-invoke-with-check) System.IO.StreamReader:.ctor (string)
at System.IO.File.OpenText (System.String path) in <filename unknown>:line 0
at System.IO.File.ReadAllLines (System.String path) in <filename unknown>:line 0
at <StartupCode$FSI_0001>.$FSI_0001.main@ () in <filename unknown>:line 0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) in <filename unknown>:line 0
Stopped due to error
➜ SpamOrHam git:(spam-ham-xplat) ls ..
Data SpamOrHam SpamOrHam.sln
➜ SpamOrHam git:(spam-ham-xplat) pwd
/Users/h/dev/haf/machine-learning-projects-for-dot-net-developers/chapter-2/SpamOrHam/SpamOrHam
➜ SpamOrHam git:(spam-ham-xplat) ls ../..
SpamOrHam
Editing to:
let path = Path.Combine(__SOURCE_DIRECTORY__, "../Data/SMSSpamCollection")
➜ SpamOrHam git:(spam-ham-xplat) fsharpi NaiveBayes.fsx
Based on 'txt', correctly classified: 0.877
Aways Ham, correctly classified: 0.848