function [ output ] = generateStatistics( actual, ePrediction, Indices )
    Class = categories(actual);
    NumberOfInstanceAsClass = countcats(actual);
    NumberOfClass = length(Class);
    ROC = zeros(NumberOfClass, 1);
    NumberOfInstance = length(actual);
    %Number of Instances
    output.NOI = NumberOfInstance;
    
    %Set Confusion Matrix
    ConfusionMatrix = confusionmat(actual, ePrediction);
    %Calculated True Positive
    TP = diag(ConfusionMatrix) ./ sum(ConfusionMatrix,2);
    %Calculated False Positive
    FP = (sum(ConfusionMatrix,1)' - diag(ConfusionMatrix)) ./ (length(actual) - sum(ConfusionMatrix,2));
    %Calculated Precision
    Precision = diag(ConfusionMatrix) ./ sum(ConfusionMatrix,1)';
    %Calculated Recall
    Recall = TP;
    %Calculated F-Measure
    F_Measure = (2*Precision.*Recall)./(Precision+Recall);
    
    %Calculated Cohen's Kappa Statistic
    pA = trace(ConfusionMatrix) / NumberOfInstance;
    pE = sum((sum(ConfusionMatrix,2).*sum(ConfusionMatrix,1)') ./ (NumberOfInstance*NumberOfInstance));
    output.Kappa = (pA-pE)/(1-pE);
    
    predict = (actual == ePrediction);
    meanPredict = mean(predict);
    sumPredict = sum(predict);
    %Calculated Mean Absolute Error
    output.MAE = 1-meanPredict;
    %Calculated Root Mean Squared Error
    output.RMSE = sqrt(1-meanPredict);
    %Calculated Relative Absolute Error
    output.RAE = sumPredict / sum(abs(meanPredict-double(predict)));
    %Calculated Root Relative Squared Error
    output.RRSE = sqrt(sumPredict / sum((meanPredict-double(predict)).^2));
    
    %Calculated TPR as each Classes
    last = 0;
    TPR = zeros(length(actual), NumberOfClass);
    for i = 1 : NumberOfClass
        first = last + 1;
        last = last + NumberOfInstanceAsClass(i);
        row = 1;
        for j = first : last
            TPR(row, i) = sum(ePrediction(first:j) == Class(i)) / NumberOfInstanceAsClass(i);
            row = row + 1;
        end
        TPR(row:end, i) = TPR(row-1, i);
    end
    
    %Calculated Area Under ROC
    for i = 1 : NumberOfClass
        ROC(i) = TP(i)*(1-FP(i));%trapz(sort(1-(sum(TPR(:,setdiff(1:NumberOfClass,i)),2)./(NumberOfClass-1))), TPR(:,i));
    end

    %Detailed Accuracy By Class
    Class{NumberOfClass+1} = '';
    RowNames = cell(NumberOfClass+1,1);
    for i = 1 : NumberOfClass
        RowNames(i) = cellstr(int2str(i));
    end
    RowNames(end) = cellstr('Weighted Avg.');
    
    output.DetailedAccuracyByClass = table([TP; mean(TP)], [FP; mean(FP)], [Precision; mean(Precision)], ...
                                    [Recall; mean(Recall)], [F_Measure; mean(F_Measure)], [ROC; mean(ROC)], ...
                                    cellstr(Class), ...
                                    'VariableNames', {'TP', 'FP', 'Precision', 'Recall', 'FMeasure', 'ROC', 'Class'}, ...
                                    'RowNames', RowNames);%{'.', '..', 'Weighted Avg.'});

    %Feature Indices
    output.Indices = Indices;
    %Predicted Output
    output.Prediction = ePrediction;
    %Correctly Classified Instances
    output.CCI = trace(ConfusionMatrix);
    %Incorrectly Classified Instances
    output.ICI = length(actual) - trace(ConfusionMatrix);
    %Confusion Matrix
    CM = table;
    for i = 1 : NumberOfClass
        CM(:,i) = num2cell(ConfusionMatrix(:,i));
    end
    CM.Properties.VariableNames = Class(1:end-1);
    CM.Properties.RowNames = Class(1:end-1);
    output.ConfusionMatrix = CM;
end