packages feed

bindings-svm (empty) → 0.1.0

raw patch · 4 files changed

+163/−0 lines, 4 filesdep +basedep +bindings-DSLsetup-changed

Dependencies added: base, bindings-DSL

Files

+ LICENSE view
@@ -0,0 +1,26 @@+Copyright (c) 2009, Paulo Tanimoto
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+- Redistributions of source code must retain the above copyright notice,
+  this list of conditions and the following disclaimer.
+- Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+- Neither the names of the copyright owners nor the names of the
+  contributors may be used to endorse or promote products derived
+  from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ bindings-svm.cabal view
@@ -0,0 +1,35 @@+name:                bindings-svm+version:             0.1.0+synopsis:            Low level bindings to libsvm.+description:+  Low level bindings to libsvm <http://www.csie.ntu.edu.tw/~cjlin/libsvm/>.+  .+license:             BSD3+license-file:        LICENSE+author:              Paulo Tanimoto <ptanimoto@gmail.com>+maintainer:          Paulo Tanimoto <ptanimoto@gmail.com>+homepage:            http://github.com/tanimoto/bindings-svm+bug-reports:         http://github.com/tanimoto/bindings-svm/issues+category:            FFI++build-type:          Simple+cabal-version:       >= 1.2.3++library+  hs-source-dirs:+    src+  exposed-modules:+    Bindings.SVM+  build-depends:+    base         >= 3   && < 5,+    bindings-DSL >= 1.0 && < 1.1+  ghc-options:+    -Wall+  extensions:+    ForeignFunctionInterface+  includes:+    svm.h+  extra-libraries:+    svm+  pkgconfig-depends:+    libsvm >= 2.8
+ src/Bindings/SVM.hsc view
@@ -0,0 +1,100 @@+{-|+For a high-level description of the C API, refer to the README file+included in the libsvm archive, available for download at+<http://www.csie.ntu.edu.tw/~cjlin/libsvm/>.+-}++#include <bindings.dsl.h>+#include <svm.h>++module Bindings.SVM where+#strict_import++-- libsvm_version+#globalvar libsvm_version , CInt++-- svm_node+#starttype struct svm_node+#field index , CInt+#field value , CDouble+#stoptype++-- svm_problem+#starttype struct svm_problem+#field l , CInt+#field y , Ptr CDouble+#field x , Ptr (Ptr <svm_node>)+#stoptype++-- svm_type+#num C_SVC+#num NU_SVC+#num ONE_CLASS+#num EPSILON_SVR+#num NU_SVR++-- kernel_type+#num LINEAR+#num POLY+#num RBF+#num SIGMOID+#num PRECOMPUTED++-- svm_parameter+#starttype struct svm_parameter+#field svm_type , CInt+#field kernel_type , CInt+#field degree , CInt+#field gamma , CDouble+#field coef0 , CDouble++#field cache_size , CDouble+#field eps , CDouble+#field C , CDouble++#field nr_weight , CInt+#field weight_label , Ptr CInt+#field weight , Ptr CDouble+#field nu , CDouble++#field p , CDouble+#field shrinking , CInt+#field probability , CInt+#stoptype++-- svm_model+#opaque_t svm_model++-- training+#ccall svm_train , Ptr <svm_problem> -> Ptr <svm_parameter> -> IO (Ptr <svm_model>)++-- cross validation+#ccall svm_cross_validation , Ptr <svm_problem> -> Ptr <svm_parameter> -> CInt -> Ptr CDouble -> IO ()++-- saving models+#ccall svm_save_model , CString -> Ptr <svm_model> -> IO ()++-- loading models+#ccall svm_load_model , CString -> IO (Ptr <svm_model>)++-- getting properties+#ccall svm_get_svm_type , Ptr <svm_model> -> IO CInt+#ccall svm_get_nr_class , Ptr <svm_model> -> IO CInt+#ccall svm_get_labels , Ptr <svm_model> -> Ptr CInt -> IO ()+#ccall svm_get_svr_probability , Ptr <svm_model> -> IO CDouble++-- predictions+#ccall svm_predict_values , Ptr <svm_model> -> Ptr <svm_node> -> Ptr CDouble -> IO ()+#ccall svm_predict , Ptr <svm_model> -> Ptr <svm_node> -> IO CDouble+#ccall svm_predict_probability , Ptr <svm_model> -> Ptr <svm_node> -> Ptr CDouble -> IO CDouble++-- destroying+#ccall svm_destroy_model , Ptr <svm_model> -> IO ()+#ccall svm_destroy_param , Ptr <svm_parameter> -> IO ()++-- checking+#ccall svm_check_parameter , Ptr <svm_problem> -> Ptr <svm_parameter> -> IO CString+#ccall svm_check_probability_model , Ptr <svm_model> -> IO CInt++-- printing+#ccall svm_print_string , FunPtr (CString -> IO ())