Code Monkey home page Code Monkey logo

androidlibsvm's Introduction

AndroidLibSvm

use the latest libsvm 3.2 in Android via Java-Native-Interface (JNI)

Features

Usage

Once you import the whole project to your Android Studio and run it on your device. The svm model and prediction output file will be located at /sdcard/libsvm of your device. You can also check the livsvm output at your logcat output.

In java, you can call the original "./svm-train options" function as:

	jniSvmTrain(String options);

In a similar way, the the origianl "./svm-predict options" function is equivalent to:

	jniSvmPredict(String options);

An example usage in Java could be:

	jniSvmTrain("-t 2 your_train_data_path your_model_file_path");
	jniSvmPredict("your_predict_data_path your_model_file_path your_output_file_path");

By reading and analyze the output file, most applications can easily enjoy the powerful libsvm functionaility with this project.

Include this project to existing Android project

To use this project in your existing Android project, you need to do the following actions:

  • copy the whole AndroidLibSvm/app/src/main/jni/ to your project (with the same relative path)
  • edit AndroidLibSvm/app/src/main/jni/jnilibsvm.cpp to replace any occurance of "edu_umich_eecs_androidlibsvm_MainActivity" to your package and activity name. For example, if your package name is com.happy.project and your activity name is HappyActivity, you should change the prefix to com_happy_project_HappyActivity (see this link to know the name convention in JNI: http://journals.ecs.soton.ac.uk/java/tutorial/native1.1/implementing/declare.html).
  • copy the AndroidLibSvm/app/build.gradle to your project and ensure ndk-build is installed (see this link for further reference about compiling ndk functions in Android: http://www.shaneenishry.com/blog/2014/08/17/ndk-with-android-studio/).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.