vendredi 4 mars 2016

How to fix the occurrence of random numbers

I have the following code:

Accuracy=off(data,z)
for i=1:100
    n = size(data,1);
    data_rand = data(randperm(n),:);
    m = ceil(n/20);
    k = 1:m:n-m;
    test = data_rand(k:k+m-1,:);
    train = [data_rand(1:k-1,:); data_rand(k+m:end,:)];
    %/  code to calculate auc
end
accuracy=mean(auc)

Every iteration the values of train and test are changed, so the value of auc is changed every time.

Say the final result is accuracy=0.7654 and another time accuracy=0.6543 or accuracy=0.4657. I want to fixed a specific result, say 0.6543, i.e if I run previous code more times I want to obtain the same result (0.6543).




Aucun commentaire:

Enregistrer un commentaire