Dear Fabian,
I saw your code and there are some errors there.
First, the TreeBagger (function/class) does not accept as argument 'TreeArguments'. So it is not possible to creat a cell-array (the case of your code), or a structure and simple pass it to the Trebagger as an argument.
One way to run your code is the following:
maxNumSplits = 3; %Maximal number of decision splits, positive integer
minLeafSize = 3; %Mini um number of leaf node observations, positive integer
minParentSize = 3; %Minimum number of brach node observation, positive integer
numberPredictorsToSample = 3; %number of random feature for each decision, default = squareroot of the total number of features
numTrees = 500; %Scalar value equal to the number of desicion trees
method = 'regression'; %or 'classification'
%% training a TreeBagger.
% It is a random forests since the numberPredictorsToSample is less
% than the amount of inputs in the trainingData, used to train the RF.
% Otherwise, we have a simple bagged ensemble of trees.
% assuming:
% - trainingData is a table
% - y_label is a string with the output name
RF = TreeBagger(numTrees,trainingData,y_label,...
'Method',method,... %you have to say whether it is a regression or classification problem
'MaxNumSplits',maxNumSplits,...
'MinLeafSize',minLeafSize,...
'NumPredictorsToSample',numberPredictorsToSample);
I left out the 'MinParentSize', because an error occurred, namely:
"Error using TreeBagger/init (line 1414)
TreeBagger does not accept 'MinParentSize' and 'SplitMin' input parameters. Use 'MinLeafSize'."
I didn't try to solve this problem. Perhaps, a possible solution is to set this parameter by using templateTree, and pass it to TreeBagger, something like this:
t = templateTree('MinParentSize',number);
RF = TreeBagger(numTrees,trainingData,y_label,...
'Method',method,... %you have to say whether it is a regression or classification problem
'MaxNumSplits',maxNumSplits,...
'MinLeafSize',minLeafSize,...
'NumPredictorsToSample',numberPredictorsToSample,...
'Learners',t); %passing the created templateTree object