Thanks Alon, very much appreciated.  The --embed-file method worked 
easily.  Haven't had time yet to look at the FS library.  The following 
worked for libsvm 3.17 (comparing the gcc compiled version and the emcc 
one):

====================================

$ make svm-train && ./svm-train heart_scale 
c++ -O2 -c svm.cpp
c++ -O2 svm-train.c svm.o -o svm-train -lm
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior 
is deprecated
*
optimization finished, #iter = 162
nu = 0.431029
obj = -100.877288, rho = 0.424462
nSV = 132, nBSV = 107
Total nSV = 132
$ mkdir data && cp heart_scale data && emcc -O2 svm.cpp svm-train.c -o 
svm-test.js --embed-file data/ && node svm-test.js data/heart_scale
*
optimization finished, #iter = 162
nu = 0.431029
obj = -100.877288, rho = 0.424462
nSV = 132, nBSV = 107
Total nSV = 132

====================================

On Friday, February 28, 2014 4:00:40 PM UTC-5, Alon Zakai wrote:
>
> Are you using the filesystem to set up access to that file? See
>
> https://github.com/kripken/emscripten/wiki/Filesystem-Guide
> https://github.com/kripken/emscripten/wiki/Filesystem-API
>
> Look for NODEFS for letting code running in node access local files.
>
> - Alon
>
>
>
> On Fri, Feb 28, 2014 at 12:42 PM, David Dreisigmeyer 
> <[email protected]<javascript:>
> > wrote:
>
>> Hi,
>>
>> I'm been trying to get libsvm working with emscripten.  Others on the 
>> group have had success with this.  Here's what I've done and the output:
>>
>> ---------------
>>
>> $ emcc -O2 svm.cpp -o svm.bc && emcc -O2 svm-train.cpp -o svm-train.bc && 
>> emcc -O2 svm.bc svm-train.bc -o svm-test.js && node svm-test.js && node 
>> svm-test.js heart_scale
>> Usage: svm-train [options] training_set_file [model_file]
>> options:
>> -s svm_type : set type of SVM (default 0)
>>     0 -- C-SVC        (multi-class classification)
>>     1 -- nu-SVC        (multi-class classification)
>>     2 -- one-class SVM
>>     3 -- epsilon-SVR    (regression)
>>     4 -- nu-SVR        (regression)
>> -t kernel_type : set type of kernel function (default 2)
>>     0 -- linear: u'*v
>>     1 -- polynomial: (gamma*u'*v + coef0)^degree
>>     2 -- radial basis function: exp(-gamma*|u-v|^2)
>>     3 -- sigmoid: tanh(gamma*u'*v + coef0)
>>     4 -- precomputed kernel (kernel values in training_set_file)
>> -d degree : set degree in kernel function (default 3)
>> -g gamma : set gamma in kernel function (default 1/num_features)
>> -r coef0 : set coef0 in kernel function (default 0)
>> -c cost : set the parameter C of C-SVC, epsilon-SVR, and nu-SVR (default 
>> 1)
>> -n nu : set the parameter nu of nu-SVC, one-class SVM, and nu-SVR 
>> (default 0.5)
>> -p epsilon : set the epsilon in loss function of epsilon-SVR (default 0.1)
>> -m cachesize : set cache memory size in MB (default 100)
>> -e epsilon : set tolerance of termination criterion (default 0.001)
>> -h shrinking : whether to use the shrinking heuristics, 0 or 1 (default 1)
>> -b probability_estimates : whether to train a SVC or SVR model for 
>> probability estimates, 0 or 1 (default 0)
>> -wi weight : set the parameter C of class i to weight*C, for C-SVC 
>> (default 1)
>> -v n: n-fold cross validation mode
>> -q : quiet mode (no outputs)
>> can't open input file heart_scale
>> The error is: No such file or directory
>>
>> =======================================
>>
>> The file heart_scale is definitely in that directory.  The libsvm code is 
>> here: http://www.csie.ntu.edu.tw/~cjlin/libsvm/.  (Note: I modified the 
>> svm-train.cpp file a little in read_problem to give perror.)
>>
>> Thanks,
>>
>> -Dave
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "emscripten-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to