Known bugs and problems in PRTools
- Dataset conflict with Stats toolbox (solved by PRTools5!)
- MSE clashes between DIP Image and Neural Nets (solved in PRTools 5.3)
- Sizes do not match
- Some classes have no test objects (solved in the PRTools classifiers in PRTools 5.3)
- Undesired results of Matlab’s importdata when PRTools is in the path
- Undefined function or method ‘fieldnames’ for input arguments of type ‘double’.
Dataset conflict with Stats toolbox
This problem is solved in PRTools5
The PRTools dataset
class conflicts with the dataset
class in the Matlab toolbox stats
. A typical error message is:
??? Error using ==> dataset.dataset>dataset.dataset at 238 The parameter name is unrecognized or not legal in this context.
This happens when a PRTools dataset
command is catched by the stats
toolbox. Possible solutions:
- Change the order of the search path (File ->Set Path …) such that PRTools is at the top. Save it and give
clear functions
andclear classes
at the Matlab prompt. - If this doesn’t help, change the path as in 1, quit Matlab and restart. Give a PRTools command as the first, e.g.
a = gendatb
. - If this is still not sufficient, remove the Matlab
stats
toolbox from the path.
In PRTools5 this problem has been solved by renaming the PRTools classes.
MSE clashes between DIP Image and Neural Nets
This problem is solved in PRTools 5.3
The Matlab Neural Net toolbox nnet
as well as the DIP Image Matlab interface diptools
contain a routine mse
. Both packages may be called by PRTools. An error is generated when the wrong mse
routine is called. The corresponding package should be moved to the bottom of the search
path to solve the problem.
Sizes do not match
In many ways sizes of datasets and mappings may not match in some of the PRTools routines. Usually this is an error caused by the user, but sometimes difficult to find. Possible causes are:
- A dataset
C
is applied to a mapping that has been trained by another datasetB
with a different feature size. This may be caused by first mapping a training setA
to a subspaceV
, e.g.
found by PCA and then classifying the datasetC
with the same dimensionality asA
by a classifierW
in the subspaceV
. Examples of a wrong and a correct construct:wrong V = pcam(A,0.9); B = A*V; W = fisherc(B); testc(C,W)
correct V = pcam(A,0.9); B = A*V; W = fisherc(B); testc(C*V,W)
The correct version may also be written as:
C*(A*(pcam([],0.95)*fisherc))*testc
- In the conversion of a datafile to a dataset (which may be performed automatically by PRTools duringoperations on datafiles) it is needed that every object of a datafile is represented by the same features. Especially in case the objects in the datafile are images and a pixel representation is used, it may happen that images have different sizes. The user should take care that by commands like
im_resize
objects of equal size are produced. - In complicated datafiles for which some preprocessing has been defined (e.g. by
filtm
orfiltim
) wrong feature sizes may be set. The commandsgetfeatsize
andsetfeatsize
may be helpful to create a workaround.getfeatsize
is useful for retrieving a feature size that is appropriate for the first object. This may be set bysetfeatsize
. Alternativelysetfeatsize(A,0)
may by used, which sets the feature size to 0. Size checking is now passed by. The result however may be that another, less understandable error is encountered. In setting feature sizes it should be realized that they also define the shape of images, e.g. [32 32] is really needed instead of 1024 if further image operations are defined.Please send a message with a simple, clear and runnable example if you have serious problems.
Some classes have no test objects
In performance estimation by testc
an error is generated in case the test set has for some classes no objects:
??? Error using ==> testc Some classes have no test objects
If it is not the user’s intention to estimate the performance of the classifier, but just to estimate the fraction of incorrectly classified test objects, testd
should be used instead of testc
.
In PRTools 5.3 trained classifiers will have information about all classes mentioned in the training dataset, even if these classes have no training objects but are just mentioned in the label list and class priors. If the test set is generated from a similar dataset the above error will not occur anymore.
Undesired results of Matlab’s importdata
when PRTools is in the path
In case the Matlab routine importdata
(and possibly others) tries to read a a file with the .txt extension, e.g. test.txt
, it calls inadvertently the PRTools routine txtread
. This does not generate an error, but the result might not be what is expected.
The solution is to remover txtread.m
from PRTools. It is already out-of-use for some time and is removed from recent releases of PRTools.
Undefined function or method ‘fieldnames’ for input arguments of type ‘double’.
This error pops up in some operations on an old PRTools dataset. At some moment the ident-field of dataset (now prdataset) was redefined. An automatic conversion was their for a long time. It appeared to be very time-consuming in some situations. After it has been removed the above error might be generated by getident for old datasets.
The solution is to do the conversion by hand: a = setident(a)
, for datasets generating the problem.