function activePredictions = activePredict(myActuals, neighborMatrix,popIndex,labelCount,testIndices,distanceMatrix)

testSize = size(testIndices,2);                     % define instance size
activePredictions = -1 * ones(1,testSize);          % this keeps the predictions for 1nn 
                                                    % when i instances are labeled
  
% generate an active-train set, that keeps labeled instances only   
activeTrainSet = zeros(labelCount,size(neighborMatrix,2));
actualsActiveTrainSet = zeros(labelCount,1);
for i = 1:labelCount
    activeTrainSet(i,:) = distanceMatrix(popIndex(i),:);
    actualsActiveTrainSet(i) = myActuals(popIndex(i));
end

% now start making the predictions and allow every test instance
% to choose their closest neighbor from labelCount-many instances according to
% popularity index
for i = 1:testSize
    % for each instance, chooose closest neighbor from active-train set
    [tmpValue tmpIndex] = min(activeTrainSet(:,testIndices(i)));
    activePredictions(i) = actualsActiveTrainSet(tmpIndex);
end


end