function pred_labels = predLab(data, ei, theta)


numHidden = numel(ei.layer_sizes) - 1;
numSamples = size(data, 2);
hAct = cell(numHidden+1, 1);
stack = params2stack(theta, ei);

for l = 1 : numHidden
    if l > 1
        hAct{l} = stack{l}.W * hAct{l - 1} + repmat(stack{l}.b, 1,numSamples);
    else
        hAct{l} = stack{l}.W * data + repmat(stack{l}.b, 1, numSamples);
    end
    switch ei.activation_fun
        case 'logistic'
            hAct{l} = sigmoid(hAct{l});
        case 'relu'
            hAct{l} = relu(hAct{l});
        case 'softmax'
            hAct{l} = softmax(hAct{l}, 1);
        case 'softplus'
            hAct{l} = softplus(hAct{l});
        case 'tanh'
            hAct{l} = tanh(hAct{l});
    end
    %     size_hAct_l = size(hAct{l})
end

l = numHidden+1;
y_hat = stack{l}.W * hAct{l - 1} + repmat(stack{l}.b, 1, numSamples);
y_hat = exp(y_hat);
hAct{l} = bsxfun(@rdivide, y_hat, sum(y_hat, 1));
[pred_prob pred_labels] = max(hAct{l});
pred_prob = hAct{l};
end
