Coder Social home page Coder Social logo

ashokpant / accuracy-evaluation-java Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 3.0 9 KB

A java implementation for calculating the accuracy metrics (Accuracy, Error Rate, Precision(micro/macro), Recall(micro/macro), Fscore(micro/macro)) for classification tasks based on the paper http://www.sciencedirect.com/science/article/pii/S0306457309000259 and MATLAB confusion implementation.

License: MIT License

Java 100.00%

accuracy-evaluation-java's Introduction

Accuracy evaluation

A java implementation for calculating the accuracy metrics (Accuracy, Error Rate, Precision(micro/macro), Recall(micro/macro), Fscore(micro/macro)) for classification tasks based on the paper [A systematic analysis of performance measures for classification tasks] (http://www.sciencedirect.com/science/article/pii/S0306457309000259) and MATLAB confusion implementation.

Uses

  public static void main(String[] args) {
        // targets: SxQ (S:Classes; Q:Samples)
        // outputs: SxQ (S:Classes; Q:Samples)

        double[][] targets = {
                {1, 1, 0, 0, 0, 0},
                {0, 0, 1, 1, 0, 0},
                {0, 0, 0, 0, 1, 1}
        };
        double[][] outputs = {
                {0.1, 0.86, 0.2, 0.1, .02, 0.1},
                {0.4, 0.12, 0.768, 0.145, 0.1, 0.8},
                {0.454, 0.35, 0.21, 0.0, 0.89, 0.9999}
        };

        Confusion confusion = new Confusion(targets, outputs);
        confusion.print();

        Evaluation evaluation = new Evaluation(confusion);
        evaluation.print();
  }

Output

Confusion Results

Confusion value
	c = 0.17
Confusion Matrix
	1 0 1 
	0 2 0 
	0 0 2 
Indices
	[1]		[]		[0]
	[]		[2,3]		[]
	[]		[]		[4,5]
Percentages
	0.2 0.0 1.0 0.8 
	0.0 0.0 1.0 1.0 
	0.0 0.33 0.67 1.0 

Accuracy Evaluation Results

Average Accuracy(%)       : 91.11
Error(%)                  : 8.89
Precision (Micro)(%)      : 88.89
Recall (Micro)(%)         : 93.02
Fscore (Micro)(%)         : 90.91
Precision (Macro)(%)      : 88.89
Recall (Macro)(%)         : 94.44
Fscore (Macro)(%)         : 91.58

Note

For C++ Implementation, visit accuracy-evaluation-cpp

For MATLAB Implementation, visit accuracy-evaluation-matlab

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.