load artificial.mat

echo on

% This code demonstrates some of the helper functions associated with this pset.

% First plot the data 
figure(1)
clf
plot_data(input, target);

% Hit a key to continue
pause

% Fit a gaussian to each class a plot.
[ms, sigs, ps] = fit_gaussians(input, target);
plot_gaussians(ms, sigs);
axis equal
% Hit a key to continue
pause

% Classify each training example with these gaussians
pred = gaussian_classify(input, ms, sigs, ps);
figure(2)
clf
plot_data(input, pred);
plot_gaussians(ms, sigs);
axis equal
% Hit a key to continue
pause

% Generate an exhaustive testing set and classify each 
% point...
testdata = make_test_data;
testdens = gaussian_density(testdata, ms, sigs, ps);
testclass = gaussian_classify(testdata, ms, sigs, ps);
figure(4)
clf
plot_data(testdata, testclass);
plot_gaussians(ms, sigs);
axis equal

