diff --git a/inst/Classification/ClassificationPartitionedModel.m b/inst/Classification/ClassificationPartitionedModel.m index b081d19c..25e7d865 100644 --- a/inst/Classification/ClassificationPartitionedModel.m +++ b/inst/Classification/ClassificationPartitionedModel.m @@ -136,7 +136,7 @@ error ("ClassificationPartitionedModel: too few input arguments."); endif - ## Check for valid object types + ## Check for valid Classification object validTypes = {'ClassificationDiscriminant', 'ClassificationGAM', ... 'ClassificationKNN', 'ClassificationNeuralNetwork', ... 'ClassificationSVM'}; @@ -144,6 +144,11 @@ error ("ClassificationPartitionedModel: unsupported model type."); endif + ## Check for valid cvpartition object + if (! strcmp (class (Partition), "cvpartition")) + error ("ClassificationPartitionedModel: invalid 'cvpartition' object."); + endif + ## Set properties this.X = Mdl.X; this.Y = Mdl.Y; @@ -670,6 +675,9 @@ %!error ... %! ClassificationPartitionedModel (RegressionGAM (ones (40,2), ... %! randi ([1, 2], 40, 1)), cvpartition (randi ([1, 2], 40, 1), 'Holdout', 0.3)) +%!error ... +%! ClassificationPartitionedModel (ClassificationKNN (ones (4,2), ... +%! ones (4,1)), 'Holdout') ## Test for kfoldPredict %!test