在SQL SERVER中, 决策树速度快,应用广泛,可以用于分类,回归,关联分析。
BOL上有详细教程,这里不赘述。
下面是一例预测查询:
select TM.fullname,
vba!format(PredictProbability([Bike Buyer]),'Percent') as [Probability]
from
[TM Decision Tree]
natural prediction join
openquery
([AdventureWorksDW2012],
'select FirstName + '' '' + LastName as FullName, DateDiff(yy,BirthDate,GetDate()) as Age,
Education, Gender, HouseOwnerFlag as [House Owner Flag],
MaritalStatus as [Marital Status], NumberChildrenAtHome
as [Number Children At Home], Occupation, TotalChildren as [Total
Children],
NumberCarsOwned as [Number Cars Owned], YearlyIncome as [Yearly Income]
from ProspectiveBuyer') as TM
where Predict([Bike Buyer]) = 1
order by PredictProbability([Bike Buyer]) desc
当模型建好,需要考虑准确,进行交叉验证。
CALL SystemGetCrossValidationResults(
[Targeted