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++.

3
votes
1answer
98 views

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,...
0
votes
0answers
17 views

Area interaction model sufficient statistics calculation algorithm

I'm currently trying to write a simulation algorithm in Rcpp for a point process model which requires calculating the sufficient statistics for an Area interaction point process model. It entails a ...
1
vote
1answer
39 views

Clustering large 3D dataset into many clusters

I have a 3D point cloud with several million points and I need to partition it into roughly 50k clusters. As the clusters have to be spherical, usually a drawback of k-means, k-means seems pretty ...
1
vote
0answers
40 views

Effective representation of a sparse connected neural network. is it possible? [closed]

I have neural network constructor written in C. To represent connections between neurons in layers I use matrix. Initial weights are given by user or random. But I need to remove some connections ...
1
vote
0answers
203 views

Why SVM with RBF kernel always classify to one group?

I've downloaded Dog vs Cat from kaggle dataset and utilize OpenCv 3.2 Machine Learning library and c++ language, And I choose 60-40(percent for train/test) from training set(kaggle test set do not ...
1
vote
2answers
151 views

Normal Neural Network for Image 100X100?

Thank you in advance for any help at all. So, I have created a neural network using back propagation and sigmoid function. It seems to work for XOR and images with size of 28X28. However, When I ...
0
votes
0answers
167 views

How to fit a gaussian curve to data for a goodness-of-fit C++? [duplicate]

I've given a dataset of N samples like: (x,y) (-100,1), (-90, 30), (-50,60), (-10,90), (0,100), (10, 90), (30, 20),(100,4) Now I would like to determine how well the data fits a perfect gaussian (...
2
votes
1answer
828 views

Standard library for Funk SVD or other gradient descent SVD/eigenvalue

I want to get the first few eigenvectors of real symmetric matrices with missing values. Since it has missing values, I won't be able to use the common linear programming techniques, but stochastic ...
0
votes
1answer
397 views

Influence of Normalization and PCA on Distance Metrics

After standardizing my dataset, I perform a principal component analysis. Then I do a nearest neighbour search. I observed then after performing the PCA, even though I kept (for testing purposes) all ...
1
vote
4answers
6k views

Determine the number of clusters for K-means automatically

Since a couple of days I research for a method to determine the number of clusters for K-means automatically, I found elbow method but I can not till now understand its principle. Is there any ...
0
votes
0answers
549 views

Fastest way of determining Threshold of Weak classifier (adaboost)

I am trying to implement a faster way of determining the threshold of my weak classifier. Currently I have a function that takes in a positive vector and a negative vector of values. Along with the ...
1
vote
1answer
388 views

About implementing convolutional neural network

I want to implement a convolutional neural network using the tiny-cnn implmentation for c++. I have downloaded it and tried the MNIST example in there, but I'm having trouble implementing it for my ...
1
vote
0answers
203 views

Having trouble understanding/implementing backpropagation algorithm

I have a simple feedforward neural network with 2 input neurons (and 1 bias neuron), 4 hidden neurons (and 1 bias neuron), and one output neuron. The feedforward mechanism seems to be working fine, ...
3
votes
1answer
2k views

Implementing Convolutional Neural Network - Problems

Recently I have started to implement my own Convolutional Neural Network. I have few questions. I will talk with reference to an example, so that we all remain on the same page. Suppose, input: ...
2
votes
0answers
513 views

Two dimensional Kolmogorov-Smirnov test

For a one dimensional Kolmogorov-Smirnov test there is a theoretical result, one can compare his or her test results directly by theoretical one, which is infinite sum (notice this formula is for big ...
1
vote
3answers
564 views

Random Forest Underfitting

I am running a random forest for different sets of data, with an attempt to make it dynamic enough to optimize for all sets of data (they are are similar data sets). There are around 150 predictor ...
2
votes
1answer
526 views

Calculate logarithm of Beta function for large alpha, beta in C++?

I want to calculate the logarithm of $\mathrm{B}_x(\alpha,\beta)$ for very large values of $\alpha,\beta$ (on the order of the thousands), where $\mathrm{B}_x(\alpha,\beta)$ is the incomplete Beta ...
3
votes
1answer
746 views

KFold Cross Validation Package/Library in C++?

I need to do some cross validation work in C++. Is there any existing package/library that you'd recommend? I performed a search on Google but prefer to get advice from field experts here. Thank you ...
5
votes
1answer
5k views

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

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 ...
2
votes
1answer
333 views

Recommendation: Fast algorithm for logistic random effects?

What is the fastest algorithm for fitting a simple logistic 'random effects' type model, with only one level of categorical predictors? Another way of putting it might be a logistic regression with ...
1
vote
1answer
469 views

Neural Network Predicting Live Market Data (fun project for BTC prediction)

Made it just for fun - not for profit, wrote a neural network application that is predicting output from live data from exchange markets dealing with Bitcoin. Now just to clarify, i am not asking if ...
1
vote
1answer
666 views

How to use gsl_linalg_cholesky_ decomp to composite the lower triangular matrix?

As we know, Cholesky decomposition of $A = L*L^T$. I tried to write a simple function to decompose the lower triangular matrix $L$. I know there is a C++ function of ...
1
vote
1answer
547 views

Automatically fitting a mixture distribution with two univariate scaled noncentral student's t components

So far my own trials to fit such a mixture distribution to simulated or real data in R were unsuccessful (even if the data was simulated from a two-component t mixture!!!). I'm about to try the same ...
1
vote
0answers
1k views

Anderson-Darling vs Kolmogorov-Smirnov (Many points in sample)

Previous question In my previous question (Kolmogorov-Smirnov test - reliability) I misused two-sample KS test for normality testing of one-sample data. I was given an advice that I should use one-...
0
votes
1answer
339 views

Expectation maximization and Gaussian mixtures - bad results

I am supposed to find parameters of individual gaussians in a 1D mixture with a known number of components. I use my own implementation of EM algorithm; however, I am not able to find the right ...
4
votes
0answers
2k views

How to calculate pvalue for the Spearman correlation test

I'm trying to code up the spearman correlation coefficient test of R in C++. ...
7
votes
4answers
7k views

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 ...
3
votes
3answers
2k views

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 ...
21
votes
1answer
10k views

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,...
3
votes
0answers
1k views

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 ...
29
votes
2answers
67k views

libsvm data format [closed]

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 ...
3
votes
1answer
1k views

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 ...
2
votes
0answers
552 views

Activation value at output neuron equals 1, and the network doesn't learn anything [duplicate]

I'm implementing a typical neural network with 1 hidden layer. The network does well with the logic XOR and other simple problems, but fails miserably when encountering a (16-input, 20~30 hidden, 3 ...
1
vote
1answer
3k views

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 ...
3
votes
1answer
796 views

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?
3
votes
2answers
926 views

On ARIMA and its implementation

I am interested in ARMA/ARIMA models. First off, is there any material online about how to identify such models? It is done via acf and pacf, but I find the material I found online somewhat misleading....
0
votes
1answer
831 views

Difference between simultaneous fitting and separate fitting

I get from a specific experiment 3 outputs. Each is the information of some physical quantity in the direction x,y or z. The way we extract the information from those signals is by fitting. In the ...
3
votes
1answer
3k views

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 ...
0
votes
1answer
130 views

About the GMRFlib [closed]

I am trying to access the GMRFlib as mentioned in the link http://www.math.ntnu.no/~hrue/GMRFsim/doc/html/. However, I think it is not available anymore. I couldn't see the tarball mentioned. Does ...
22
votes
4answers
11k views

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 ...
10
votes
1answer
9k views

Translate R to C++ (eventually with Rcpp) [closed]

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 . ...