Giter Site home page Giter Site logo

classifier's Introduction

Audio Classifier Using Statistical Learning

Experimental project for voice command intention detection based on statistical learning Java FFT and audio analysing took from audio-analysis

Testing

Execute the unit tests. More to come...

    val featureNames = mutableMapOf<String, Int>()
    for (i in 1..30) {
        featureNames["$i"] = i
    }
    
    // audio samples for training: 0.0 = YES 1.0 = NO
    val yes2 = audioToFs(0, "src/test/resources/yes2.wav", featureNames, 0.0)
    val yes3 = audioToFs(1, "src/test/resources/yes3.wav", featureNames, 0.0)
    val yes4 = audioToFs(2, "src/test/resources/yes4.wav", featureNames, 0.0)
    val no2 = audioToFs(3, "src/test/resources/no2.wav", featureNames, 1.0)
    val no3 = audioToFs(4, "src/test/resources/no3.wav", featureNames, 1.0)
    val no4 = audioToFs(5, "src/test/resources/no4.wav", featureNames, 1.0)
    
    
    val data = DataSet(arrayListOf(yes2, yes3, yes4, no2, no3, no4), featureNames.keys.toList())
    //println(data)
    
    val nb = NaiveBayes()
    
    // not known samples
    val yes1 = audioToFs(6, "src/test/resources/yes1.wav", featureNames, -1.0)
    val no1 = audioToFs(7, "src/test/resources/no1.wav", featureNames, -1.0)
    
    val stats = nb.train(data)
    
    //println(stats)
    
    val classification1 = nb.classify(yes1, stats)
    val classification2 = nb.classify(no1, stats)
    
    println(classification1.predictions)
    println(classification1.predict())
    
    println(classification2.predictions)
    println(classification2.predict())
    
    assertEquals(0.0, classification1.predict())
    assertEquals(1.0, classification2.predict())

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.