Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metrics #88

Open
Lundez opened this issue Jan 3, 2022 · 0 comments
Open

Metrics #88

Lundez opened this issue Jan 3, 2022 · 0 comments

Comments

@Lundez
Copy link
Member

Lundez commented Jan 3, 2022

Add remaining metrics

fun confusionMatrix() {
        TODO("")
    }

    fun f1() {
//        requireSameShape(test, predicted)
        TODO("")
    }

    // precision = TP / (TP + FP)
    fun <T : Number> precision(test: D2Array<T>, predicted: D2Array<T>): Double {
        requireSameShape(test, predicted)

        val truePositive = (0 until test.shape[0]).fold(0) {
                acc, row ->
            if (test[row] == predicted[row]) acc + 1 else acc
        }

        return  truePositive / test.shape[0].toDouble()
    }

    // recall = TP / (TP + FN)
    fun <T : Number> recall(test: D2Array<T>, predicted: D2Array<T>) {
        requireSameShape(test, predicted)
        TODO("")
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant