GithubHelp home page GithubHelp logo

rantengsky / kdepp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from duncanmcn/kdepp

0.0 1.0 0.0 13 KB

Kernel density estimation for C++. Multidimensional.

License: MIT License

C++ 95.98% Meson 4.02%

kdepp's Introduction

kdepp

Kernel density estimation for C++. Multidimensional.

Installation:

kdepp is a header only library.

Include the "include" folder of this repository.

Example usage:

// 1D:
#include "kdepp/kde.h"

std::vector<float> data = {-0.1, 0, 0.1, 0.1, 0.2};
kdepp::Kde1d kernel(data);

auto result = kernel.eval(0.05);
std::cout << result << std::endl;


// 2D:

#include "kdepp/kde.h"

std::array<double, 2> p1 = {0, 2}; // a point of data (x, y)
std::array<double, 2> p2 = {0.15, 2.3};
std::array<double, 2> p3 = {-0.1, 2.5};

std::vector<std::array<double, 2>> data = {p1, p2, p3};

kdepp::Kde2d kernel(data);

std::array<double, 2> test_point = {0.1, 2.5};
double result = kernel.eval(test_point);
std::cout << result << std::endl;

// Multivariate:

possible with eigen and including kdemv.h
documentation update required

Convenience typedefs:

The following are provide for convenience if you are using C++14 or lower:

// The template type is the data type.
// kdepp always takes a std::vector of the data type as the parameter in the constructor:
using Kde1d_d = Kde1d<double>;
using Kde1d_f = Kde1d<float>;
using Kde2d_vecd = Kde2d<std::vector<double>>;
using Kde2d_vecf = Kde2d<std::vector<float>>;
using Kde2d_arrd = Kde2d<std::array<double,2>>;
using Kde2d_arrf = Kde2d<std::array<float,2>>;

kdepp's People

Contributors

duncanmcn avatar

Watchers

 avatar

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.