Questions tagged [c++]

C++ is a compiled general-purpose programming language. Use this tag for any *on-topic* question that (a) involves C++ either as a critical part of the question or expected answer, & (b) is not *just* about how to use C++.

C++ is a compiled general-purpose programming language. It was developed by Bjarne Stroustrup as a set of extensions to the C programming language. C++ improved type-safety and added support for object-orientation, generic programming, exception handling, automatic resource management, and some other features.

Reference: Wikipedia entry on C++

43 questions
32
votes
2 answers

libsvm data format

I'm using the libsvm (http://www.csie.ntu.edu.tw/~cjlin/libsvm/) tool for support vector classification. However, I'm confused about the format of the input data. From the README: The format of training and testing data file is:
Siddhant Saraf
  • 421
  • 1
  • 4
  • 6
26
votes
1 answer

Converting (normalizing) very small likelihood values to probability

I am writing an algorithm where, given a model, I compute likelihoods for a list of datasets and then need to normalize (to probability) each one of the likelihood. So something like [0.00043, 0.00004, 0.00321] might be converted to may be like…
Ikram Ullah
  • 443
  • 1
  • 4
  • 10
23
votes
4 answers

C++ libraries for statistical computing

I've got a particular MCMC algorithm which I would like to port to C/C++. Much of the expensive computation is in C already via Cython, but I want to have the whole sampler written in a compiled language so that I can just write wrappers for…
JMS
  • 4,660
  • 1
  • 22
  • 32
10
votes
1 answer

Translate R to C++ (eventually with Rcpp)

I would like to learn to use Rcpp. I went through the docs on the package's CRAN website, but i feel working on a practical example (second practical, considering convolve3) would be more helpfull . I propose the following code, from the the…
user603
  • 21,225
  • 3
  • 71
  • 135
7
votes
4 answers

Open source classification algorithms, preferably in C++

I am in search of open source classification algorithms. I am working on a computer vision project that uses classification for scene recognition. I wish to bench test a range of machine learning algorithms for the classification stage. The…
hally9k
  • 173
  • 1
  • 4
6
votes
1 answer

How to implement GLM computationally in C++ (or other languages)?

I want to implement the GLM model in C++ for a commercial package (ie. this is not for fun), including but not limited to normal, binomial distribution etc. I'm not so sure how the implementation should work. Say, I want to implement the linear and…
SmallChess
  • 6,764
  • 4
  • 27
  • 48
5
votes
1 answer

How can we numerically compute the autocorrelation of a sample from a Markov chain generated by the Metropolis-Hastings algorithm?

Let $(X_n)_{n\in\mathbb N_0}$ denote a $\mathbb R^d$-valued Markov chain generated by the Metropolis-Hastings algorithm. Suppose I've run the algorithm on a computer and obtained a sample $x_0,\ldots,x_n$. How can I compute the (truncated)…
4
votes
0 answers

How to calculate pvalue for the Spearman correlation test

I'm trying to code up the spearman correlation coefficient test of R in C++. > x = runif(100) > y = runif(100) > cor.test(x,y, method="spearman") Spearman's rank correlation rho data: x and y S = 165182, p-value = 0.9306 alternative hypothesis:…
koskos
  • 41
  • 2
4
votes
3 answers

Efficient generation of chi random variables

I need to generate random variables generated from a chi distribution (not chi-squared!). There doesn't seem to be standard mechanism in C++ in (for example) Boost::Random and hence I am looking for an alternative implementation implemented in C++…
Damien
  • 635
  • 5
  • 14
4
votes
1 answer

Why do R function `eigen()' and Armadillo's `eig_sym()` give different results

I am trying to compute eigenvalues in C++ using the Armadillo function eig_sym via RcppArmadillo. The results are not entirely the same as the output of the R function eigen(): In R: set.seed(1) X=matrix(sample(1:25), 5) X # [,1] [,2] [,3] [,4]…
Alex
  • 437
  • 1
  • 5
  • 15
4
votes
1 answer

Latent Dirichlet allocation Implementation

I'm looking for some LDA implementation. I know about this one, MALLET but it is coded in Java and I need some more performant. Can someone give me some reference?
Aslan986
  • 728
  • 2
  • 7
  • 18
4
votes
1 answer

C++ library to play with statistics (detecting outliers in time series)

I am looking for a C++ library for statistics to play with outliers detection in time series (amongst other). What I need: Robust estimators, correlations, hypothesis tests, etc; No dependencies with external libraries; No GPL; Would be a…
Korchkidu
  • 141
  • 1
  • 2
3
votes
0 answers

How to calculate p-value for Cross-Correlation for two time series with delay?

I have two stationery time series that I want to see are they correlated or not. I decided to work with cross correlation, there is a good answer in Correlation between two time series but I dont know how to calculate p-value(as…
user28552
  • 31
  • 3
3
votes
1 answer

Hidden Markov model library

I am looking for a free hidden markov model libraries in C/C++. I can google and get a list, but a it is impossible to tell which free ones are industry standard and well established. Can anyone provide guidance on this. Maybe the right way to put…
John Robertson
  • 973
  • 3
  • 15
  • 25
3
votes
0 answers

Why is my QR decomposition updating code numerically off?

I apologize if this is the wrong place for this question; there are a number of potential points of failure each of which suggest either Math StackExchange or StackOverflow or here, but since the application is statistics, I think this might be the…
cgmil
  • 647
  • 4
  • 12
1
2 3