Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

sdmg15/cppmarkov

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cppmarkov

A Markov chain is a mathematical system which keeps track of transitions between different states and tells you the probability of a transition occurring between two states.

This repository is an implementation in C++17 of that stochastic process.

Compiling and running the example

Requirements

  • CMake 3.10.2 or greater
  • A C++ compiler (GCC or Clang etc. ) that supports C++17

Compiling

In order to compile just run

~ $ cmake --build . 

And the resulting binary will be in the bin folder.

Code example

#include <iostream>
#include "Markov.hpp"

auto main() -> int {

Markov::Chain chain(1);

chain.add("I am sam");
chain.add("I am an Engineer");
chain.add("I like coding");

Markov::Ngram currentState = {"Engineer"};
Markov::NextState ns("$"); 

std::cout << chain.transitionProbability(ns,currentState) << "\n"; // Printing 1

return 1;
}

About

Implementation of markov chains in Cpp

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.