Kiyoshika / CppEZML

A work in progress C++ machine learning library designed to be very easy to use. Everything pretty much written from scratch.
0 stars 0 forks source link

Implement KDE #25

Closed Kiyoshika closed 3 years ago

Kiyoshika commented 3 years ago

Implement kernel density estimation.

Kiyoshika commented 3 years ago

Implemented.

#include <iostream>
#include "data/DataSet.h"
#include "stats/Density/KernelDensity.h"

using namespace std;

int main() {

    DataSet mydata;
    mydata.load("test.csv");

    KernelDensity kd;
    kd.fit(mydata.cast_target_double());

    cout << kd.evaluate(3) << "\n";
    cout << kd.integrate(1, 3) << "\n";
    cout << kd.cdf(3) << "\n";
    cout << kd.inverse_cdf(0.5) << "\n";

    return 0;
}