Hello
I am currently tasked with fitting 2 sets of data. I extracted 5 datapoints as a training set and I created a function that works the percentage differnce between the two sets which is as follows;
function erfun = per_dif(img, adam, thresh, siz)
tota = 0;
totb = 0;
for i = 1:5
err = abs((round(sum(sum(img{i}.*img{i}>thresh == 1)))/siz)-adam(i));
tota = tota + err;
totb = totb + adam(i);
end
erfun = tota/totb;
end
In reality, the 'thresh' & 'siz' variables are unknown, I set a function as follows;
fun = @(x)per_dif(adam_im,adam_count,x(1),x(2))
and I used the fminsearch function on it as follows
x0 = [0.5,1];
x = fminsearch(f,x0)
I used the values of x on the test set and I got a result that makes sense.
Now, I want to increase the accuracy of my model using the bootstrp method. Instead of setting aside 5 training and 5 test data points, I want to use my whole set, and iterate through a random 5 of them to get multiple values of x (and then use mean and standard deviation).
It isjust that I cant seem to get the code working. This is what i have right now;
f = @(x)fminsearch(per_dif(adam_im, adam_count,x(1),x(2)),x0);
bootstat = bootstrp(200,@f,[adam_im,adam_count])