Microsoft R 机器学习模型的摘要。
用法
## S3 method for class `mlModel':
summary (object, top = 20, ...)
论据
object
从 MicrosoftML 分析返回的模型对象。
top
指定要在线性模型的摘要中显示的顶级系数计数,例如 rxLogisticRegression 和 rxFastLinear。 偏见首先出现,后跟其他权重,按其绝对值按降序排序。 如果设置为 NULL
,则显示所有非零系数。 否则,仅显示第一个 top
系数。
...
要传递给摘要方法的其他参数。
详细信息
提供有关原始函数调用的摘要信息
用于训练模型的数据集,以及模型中系数的统计信息。
价值
summary
MicrosoftML 分析对象的方法返回一个列表,其中包括原始函数调用和使用的基础参数。 该方法 coef
返回一个命名的权重向量,处理模型对象中的信息。
对于 rxLogisticRegression,当设置为 TRUE
时showTrainingStats
,摘要中也可能存在以下统计信息。
training.size
用于训练模型的数据集的大小(以行计数为单位)。
deviance
模型偏差由 -2 * ln(L)
获取 L
具有模型中所有特征的观察的可能性给出。
null.deviance
如果从特征L0
中获取观察值的可能性,则为 -2 * ln(L0)
null 偏差。 如果模型中存在偏差,则 null 模型包含偏差。
aic
AIC (Akaike 信息条件)定义为 2 * k ``+ deviance
模型 k
系数的数量。 偏差计为系数之一。 AIC 是模型相对质量的度量值。 它处理模型拟合(以偏离度量)与模型的复杂性(按系数数衡量)之间的权衡。
coefficients.stats
这是一个数据帧,其中包含模型中每个系数的统计信息。 对于每个系数,将显示以下统计信息。 偏差显示在第一行中,其余系数以 p 值升序排列。
- EstimateThe estimated coefficient value of the model.
- Std ErrorThis 是系数估计的大样本方差的平方根。
- z-ScoreWe 可以针对 null 假设进行测试,该假设指出系数应为零,通过计算系数的估计比率及其标准误差的重要性。 在 null 假设下,如果没有应用正则化,则相关系数的估计遵循正态分布,平均值为 0,标准偏差等于上面计算的标准误差。 z 分数输出系数的估计值与系数的标准误差之间的比率。
- Pr(>|z|)这是 z 分数的双面测试的相应 p 值。 根据重要性级别,将一个重要性指示器追加到 p 值。 如果
F(x)
为标准正态分布N(0, 1)
的 CDF,则P(>|z|) = 2 - ``2 * F(|z|)
为 CDF。
作者(s)
Microsoft Corporation Microsoft Technical Support
另请参阅
rxFastTrees、 rxFastForest、 rxFastLinear、 rxOneClassSvm、 rxNeuralNet、 rxLogisticRegression。
例子
# Estimate a logistic regression model
logitModel <- rxLogisticRegression(isCase ~ age + parity + education + spontaneous + induced,
transforms = list(isCase = case == 1),
data = infert)
# Print a summary of the model
summary(logitModel)
# Score to a data frame
scoreDF <- rxPredict(logitModel, data = infert,
extraVarsToWrite = "isCase")
# Compute and plot the Radio Operator Curve and AUC
roc1 <- rxRoc(actualVarName = "isCase", predVarNames = "Probability", data = scoreDF)
plot(roc1)
rxAuc(roc1)
#######################################################################################
# Multi-class logistic regression
testObs <- rnorm(nrow(iris)) > 0
testIris <- iris[testObs,]
trainIris <- iris[!testObs,]
multiLogit <- rxLogisticRegression(
formula = Species~Sepal.Length + Sepal.Width + Petal.Length + Petal.Width,
type = "multiClass", data = trainIris)
# Score the model
scoreMultiDF <- rxPredict(multiLogit, data = testIris,
extraVarsToWrite = "Species")
# Print the first rows of the data frame with scores
head(scoreMultiDF)
# Look at confusion matrix
table(scoreMultiDF$Species, scoreMultiDF$PredictedLabel)
# Look at the observations with incorrect predictions
badPrediction = scoreMultiDF$Species != scoreMultiDF$PredictedLabel
scoreMultiDF[badPrediction,]