function [predictedValue] = myPLSR(testSet, trainSet)

% indicate components to retain 
if size(trainSet,2) <=2
    componentsToRetain = 1;
else
    componentsToRetain = 2;
end

% get the size of training data
[n,p] = size(trainSet(:,1:(size(trainSet,2)-1)));

% generate a regression on the training data
[Xloadings,Yloadings,Xscores,Yscores,betaPLS] = plsregress(trainSet(:,1:(size(trainSet,2)-1)), trainSet(:,size(trainSet,2)),componentsToRetain);
% [XL,YL,XS] = plsregress(trainSet(:,1:(size(trainSet,2)-1)), trainSet(:,size(trainSet,2)),10);
predictedValue = abs([ones(1,1) testSet(:,1:(size(testSet,2)-1))]*betaPLS);

end