function [accuracy] = classify_samples(x_star, a, a0, nbNode, nbGroup, nbNodePerGroup, nbTestSample, spaceDim)

    nbLambda = size(x_star, 2);
    assert(nbLambda >= 1);
    assert(nbNode == nbGroup*nbNodePerGroup);
    
    % Initialize the accuracy array. The accuracy is given for each
    % lambda
    % and is the average accuracy of each node accuracy.
    
    accuracy = zeros([nbLambda, 1]);
    
    % We treat each group separately
    % Each group has its own "ground truth" separating hyperplane [b', b0]'
    for i=1:nbGroup

         % Generate the samples
        groupSamples = normrnd(0, 1, [nbTestSample, spaceDim]);
        
        % Then the labels
        groundTruthLabels = sign(groupSamples * a(:, i) + a0(i));
        
        % How well does each node perform?
        % We have to check for each lambda
        for l=1:nbLambda
            
            % For each node in the group
            for n=1:nbNodePerGroup
                nodeIndex = (nbNodePerGroup * (i-1)) + n;
                node_hyperplane = x_star{l}{nodeIndex};
                estimatedLabels = sign(groupSamples * node_hyperplane(1:spaceDim) + node_hyperplane(end));
                node_accuracy = nnz(groundTruthLabels == estimatedLabels)/nbTestSample;
                accuracy(l) = accuracy(l) + node_accuracy;
            end
        end

    end

    accuracy = accuracy / nbNode;
end