classdef janis_ensembleParser < janis_patternParser
methods
function pp = janis_ensembleParser(classCollection)
pp = pp@janis_patternParser(classCollection);
if ~isa(classCollection,'janis_classCollection')
throw(MException('janis:WrongClass','This is not a janis_classCollection!'));
end
end
function pp = init(pp)
pp.patternLabels = zeros(pp.classCollection.patternCount,1);
actualIndex = 1;
for cl=1:pp.classCollection.size
actualClass = pp.classCollection.get(cl);
pp.patternLabels(actualIndex:actualIndex+actualClass.size-1) = cl -1;
actualIndex = actualIndex + actualClass.size;
end
for k=1:size(pp.patternMat,2)
pp.patternMat{k}.patternParser.init;
end
end
function [trainPattern, trainLabels, testPattern, testLabels] = get(pp,indices)
trainPattern = pp.patternMat;
trainLabels = indices;
testLabels = ~indices;
testPattern = testLabels;
end
function pp = addValidatorToEnsemble(pp,validatorNode)
if ~isa(validatorNode,'janis_validator')
throw(MException('janis:WrongClass','This is not a validator-Class!'));
else
pp.patternMat{size(pp.patternMat,2)+1} = validatorNode;
end
end
function pattern = reconstructFromProcessors(pp,pattern)
error('This function is not implemented!');
end
function labelsAll = getLabels(pp)
labelsAll = pp.patternLabels;
end
end
end