
while 1    
    numPos = 1000;
    numNeg = 1000;
    lambda = 1;
    
	% create numPos points from cluster 1 drawn from a normal distribution
    muClass1 = [randi(20) randi(20)];%
    sigmaClass1 = [rand(1)*randi(5) rand(1)*randi(5)];
    Class1 = getDataClouds(muClass1, sigmaClass1,numPos);
    
	% create numNeg points from cluster 2 drawn from a normal distribution
    muClass2 = [randi(20) randi(20)];
    sigmaClass2 = [rand(1)*randi(5) rand(1)*randi(5)];
    Class2 = getDataClouds(muClass2, sigmaClass2,numNeg);
    
	% show created data points
    clf;
    figure(1);
    plot(Class1(:,1),Class1(:,2),'rx');
    hold on;
    plot(Class2(:,1),Class2(:,2),'bx');
    
    % create dataset and add constant 1 to each example
    data = [Class1; Class2];
    % add constant 1 to learn offset w_0
    data = [ones(size(data,1),1), data];
    label = [ones(size(Class1,1), 1);...
        ones(size(Class2,1), 1) * -1];
    
	% learn a model
    w = learnRegERMLearningRate(data , label, lambda, @hinge, @omega2);
    
	% label the datapoints with learned model
    labels = classRegERM(w,data);
    
    % get two points on boundary
    xVals = [-5 ; 25];
    Boundary = zeros(length(xVals),2);
    for i = 1:length(xVals)
        Boundary(i,1) = xVals(i);
        Boundary(i,2) = (-w(1) - xVals(i) * w(2)) / w(3);
    end
    
	% plot the decision boundary
    plot(Boundary(:,1), Boundary(:,2));    
    
    hold off;
    pause;
end