diff options
| author | ziejd2 | 2017-09-28 15:04:40 -0500 |
|---|---|---|
| committer | ziejd2 | 2017-09-28 15:04:40 -0500 |
| commit | 8070dc963753142bb86c4ed698d91fd623ed28e7 (patch) | |
| tree | d0f6dd8fc46a49b819aa55c1a90faa14d8448883 /sourcecodes/bnt-master/netlab3.3/dem2ddat.m | |
| parent | 7cc31810d53176e805532b2789955f4eedbce6bb (diff) | |
| download | BNW-8070dc963753142bb86c4ed698d91fd623ed28e7.tar.gz | |
BNW using Octave instead of Matlab.
This version of BNW should perform the same as the original version. The only difference is that it uses Octave instead of Matlab when running BayesNet Toolbox during parameter learning. I am calling this BNW_1.02. It can be accessed at: compbio.uthsc.edu/BNW_1.02
Diffstat (limited to 'sourcecodes/bnt-master/netlab3.3/dem2ddat.m')
| -rw-r--r-- | sourcecodes/bnt-master/netlab3.3/dem2ddat.m | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/netlab3.3/dem2ddat.m b/sourcecodes/bnt-master/netlab3.3/dem2ddat.m new file mode 100644 index 00000000..abdb7cc7 --- /dev/null +++ b/sourcecodes/bnt-master/netlab3.3/dem2ddat.m @@ -0,0 +1,48 @@ +function [data, c, prior, sd] = dem2ddat(ndata) +%DEM2DDAT Generates two dimensional data for demos. +% +% Description +% The data is drawn from three spherical Gaussian distributions with +% priors 0.3, 0.5 and 0.2; centres (2, 3.5), (0, 0) and (0,2); and +% standard deviations 0.2, 0.5 and 1.0. DATA = DEM2DDAT(NDATA) +% generates NDATA points. +% +% [DATA, C] = DEM2DDAT(NDATA) also returns a matrix containing the +% centres of the Gaussian distributions. +% +% See also +% DEMGMM1, DEMKMEAN, DEMKNN1 +% + +% Copyright (c) Ian T Nabney (1996-2001) + +input_dim = 2; + +% Fix seed for reproducible results +randn('state', 42); + +% Generate mixture of three Gaussians in two dimensional space +data = randn(ndata, input_dim); + +% Priors for the three clusters +prior(1) = 0.3; +prior(2) = 0.5; +prior(3) = 0.2; + +% Cluster centres +c = [2.0, 3.5; 0.0, 0.0; 0.0, 2.0]; + +% Cluster standard deviations +sd = [0.2 0.5 1.0]; + +% Put first cluster at (2, 3.5) +data(1:prior(1)*ndata, 1) = data(1:prior(1)*ndata, 1) * 0.2 + c(1,1); +data(1:prior(1)*ndata, 2) = data(1:prior(1)*ndata, 2) * 0.2 + c(1,2); + +% Leave second cluster at (0,0) +data((prior(1)*ndata + 1):(prior(2)+prior(1))*ndata, :) = ... + data((prior(1)*ndata + 1):(prior(2)+prior(1))*ndata, :) * 0.5; + +% Put third cluster at (0,2) +data((prior(1)+prior(2))*ndata +1:ndata, 2) = ... + data((prior(1)+prior(2))*ndata+1:ndata, 2) + c(3, 2); |
