CloudRunner

... share your algorithms as a web service

Algorithm: Approx Gaussian with dirac mixture

Description:
Algorithm for approximating gaussian with dirac mixture.
Code by Henning Eberhardt.
Adjustments for cloudrunner and improved usability by Florian Pfaff and Christof Chlebek with feedback from Uwe D. Hanebeck.


Output parameters:
x - resulting dirac positions
format: matrix(dimension,diracnumber).
w - weigths of the diracs
format: matrix(1,diracnumber)
D - the ... (show more)
Tags: dirac mixture
Usage: Algorithm is public.
Viewed 3227 times, called 5240 times
Upload:
Full star Full star Full star Full star Full star
2 votes
Florian Pfaff
10/14/2012 4:21 p.m. (version #1)

Run Algorithm

: Expected value of Gaussian to be approximated
Format: matrix(dimension, 1)
: Valid covariance matrix of Gaussian to be approximated
Format: matrix(dimension, dimension)
: Number of components of Dirac Mixture approximation
Format: integer
: Allow cached result?
Close

Please Wait

Computation is running...

Plots

showing plot # of

Result Value(s)


		

Resource Usage

Execution of the algorithm took seconds.
Peak memory usage for running the algorithm was kilobytes (total usage: kilobytes).

Run ID / Link

ID of this run:
Link:

Result from Cache

Result has been delivered from cache and computed on (UTC).

Matlab log

(show)

		

Error

Using this algorithm in your local MATLAB environment is easy: Click here for instructions!

Usage Instructions for CloudRunner Client

  1. Download the CloudRunner Client by clicking here and place the downloaded file in your MATLAB working directory.

  2. Inside MATLAB, initialize the CloudRunner Client by calling CloudRunner:
    >> CloudRunner

    A login dialog will prompt for your CloudRunner mail address and password. For a start, you can leave the dialog empty and just click "Connect".

    Alternatively, you can provide the login credentials (or empty strings to skip login) as a parameter and hence skip the login dialog. This is useful when using CloudRunner in non-interactive scripts.
    >> CloudRunner('mail@example.com', 'password')

  3. Select this algorithm by its URL. Selecting an algorithm creates the lambda function that proxies calls to the algorithm to the server for execution:
    >> CloudRunnerSelect('http://www.cloudrunner.eu/algorithm/83/approx-gaussian-with-dirac-mixture/version/1/')

    For the sake of convenience, you can also use the algorithm ID instead of its URL for public algorithms.

  4. Call functions from the algorithm like any regular local function.

Note: You can find further information on the help page.

Source Code

File:

 1 function [x,w,D]=DM_Approx_Gaussian(m,S,numOfDiracs)
 2 % [x w D] = DM_Approx_Gaussian(m, S, numOfDiracs)
 3 %INPUT:
 4 %  m              - expected value of Gaussian to be approximated
 5 %                    format: matrix(dimension, 1).
 6 %  S              - valid covariance matrix of Gaussian to 
 7 %                    be approximated
 8 %                    format: matrix(dimension,dimension)
 9 %  numOfDiracs    - Number of components of Dirac Mixture approximation
10 %                    format: integer
11 %OUTPUT:
12 %  x              - resulting dirac positions
13 %                    format: matrix(dimension,diracnumber).
14 %  w              - weigths of the diracs
15 %                    format: matrix(1,diracnumber)
16 %  D              - the modified Cramer-von Mises distance
17 %                    format: float
18 
19     if rank(S)~=size(S,2) || ~isequal(S,S')
20         error('Error: S is not a valid covariance matrix');
21     elseif ndims(m)~=2 || size(m,2)~=1 || size(m,1)~=size(S,1) || length(numOfDiracs)~=1 || ~(mod(numOfDiracs,1)==0) || numOfDiracs<1
22         error('Error in input argument. Use man(''DM_Approx_Gaussian''');
23     end
24     x=randn(numOfDiracs,length(m));
25     w=ones(1,numOfDiracs)/numOfDiracs;
26 
27     [x,w,D] = cglcd_approximation(x, w', S);
28     x=x'+repmat(m,1,numOfDiracs);
29     w=w';
30 end
The file is not a text file or too large to be displayed here. You can still download the file using the link below.
The file is not a text file or too large to be displayed here. You can still download the file using the link below.
The file is not a text file or too large to be displayed here. You can still download the file using the link below.
The file is not a text file or too large to be displayed here. You can still download the file using the link below.
Download algorithm (5 files) as ZIP

Comments

Please login to post a comment.