문제

I want to use the accord.net framework to generate a decision tree from a set of data.

I read the guide in this link http://crsouza.blogspot.com/2012/01/decision-trees-in-c.html

I was able to generate the tree by following it. However How to use it to predict new inputs?

what i mean is after creating the tree i want to use it (as a if-else statement to know the output of new inputs)

it is stated that I can convert it to an expression var expression = tree.ToExpression(); but how can I use it ?

Thanks for any help

도움이 되었습니까?

해결책

I suggest you read the example in the guide carefully. At the very end of the procedure they generate the expression tree with var expression = tree.ToExpression(); and compile it:

var func = expression.Compile();

The result is a delegate that you can simply execute to get a decision for a given input. In the example, you could do something like

bool willPlayTennis = func(new double[] {1.0, 1.0, 1.0, 1.0}) == 1;

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top