covartech / PRT

Pattern Recognition Toolbox for MATLAB
http://covartech.github.io/
MIT License
145 stars 70 forks source link

plotDensity in prtDataSetClass is broken #44

Closed dimapitt closed 8 years ago

dimapitt commented 8 years ago

Breaks on line 762 of prtDataSetClass:

xLoc = sort(cat(1,xLoc(:),ds.getObservations(:,iFeature)),'ascend');

More specifically:

ds.getObservations(:,iFeature)

'Input arguments to function include colon operator. To input the colon character, use ':' instead.'

Not sure if it has something to do with using a newer version of MATLAB (breaks in 2015b and 2016a), or a change made in ds.getObservations.

Changing the line in question to:

xLoc = sort(cat(1,xLoc(:),ds.X(:,iFeature)),'ascend');

fixes the problem.

covartech commented 8 years ago

Ahhh. Yes. I think we knew this was coming. So TMW changed whats allowed in function calls and no longer string-ifies colons for you.... Unfortunately this is all over the place in the PRT.

I went through and found this or similar problems in the following files:

prtPreProcHistEqKde prtPreProcLogDiscPostPlsda prtDataGenContextDependent prtDataSetClass prtClass prtDataSetInMem prtPreProcLogDisc prtRvKde

prtClassSvmPegasos prtClassFld prtClassRvm prtClassSvmMcode prtPreProcHistEq prtRegressRvm

They should all be fixed now. If you find any more, please let us know. The easy fix is what you described - .getObservations --> .X and .getTargets --> .Y.

Thanks Dima!

dimapitt commented 8 years ago

I just found another example of the same issue popping up on line 116 of prtClassBinaryToMaryOneVsAll.

cDataSet = dataSet.setTargets(dataSet.getTargetsAsBinaryMatrix(:,iY));

As suggested by the resulting error, I just changed : to ':' to fix the issue.

Same issue on line 173 of prtClassBinaryToMaryOneVsAll

peterTorrione commented 8 years ago

Weird - is your PRT up to date? Those lines don't have that code in my PRT (which I think is up to date)

dimapitt commented 8 years ago

Nope, it wasn't. Sorry about that! All works great now :).

peterTorrione commented 8 years ago

No prob! Glad to know you're using it! And always feel free to report bugs or problems you find.