Microsoft R Machine Learning 模型的摘要。
用法
## S3 method for class `mlModel':
summary (object, top = 20, ...)
論點
object
從 MicrosoftML 分析傳回的模型物件。
top
指定要在線性模型的摘要中顯示的最高係數計數,例如 rxLogisticRegression 和 rxFastLinear。 偏差會先出現,後面接著其他權數,依其絕對值以遞減順序排序。 如果設定為 NULL,則會顯示所有非零係數。 否則,只會顯示第一個 top 係數。
...
要傳遞至 summary 方法的其他自變數。
詳細資訊
提供原始函數調用的摘要資訊,
用來定型模型的數據集,以及模型中係數的統計數據。
價值觀
summary
MicrosoftML 分析物件的 方法會傳回清單,其中包含原始函數調用和所使用的基礎參數。 方法 coef 會傳回具名權數向量,並處理來自模型對象的資訊。
針對 rxLogisticRegression,當 設定為 showTrainingStats時TRUE,下列統計數據也可能出現在摘要中。
training.size
用來定型模型之數據集的數據列計數大小。
deviance
模型偏離是由 指定, -2 * ln(L) 其中 L 是取得觀察的可能性,且所有特徵都併入模型。
null.deviance
Null 偏離是由 -2 * ln(L0) 指定,其中 L0 是從特徵取得無作用的觀察的可能性。 如果模型中有一個,Null 模型就會包含偏差。
aic
AIC (Akaike 資訊準則) 定義為 2 * k ``+ deviance,其中 k 是模型的係數數目。 偏差會算作其中一個係數。 AIC 是模型相對品質的量值。 它處理模型適合的優缺點(以偏離測量)和模型的複雜度(以係數數目來測量)。
coefficients.stats
這是一個數據框架,其中包含模型中每個係數的統計數據。 針對每個係數,會顯示下列統計數據。 偏差會出現在第一個數據列中,其餘係數會以 p 值遞增順序顯示。
- Estimate 模型的估計係數值。
- Std ErrorThis 是係數估計值之大型樣本變異數的平方根。
- z-ScoreWe 可以針對虛無假設進行測試,該假設指出係數應為零,方法是計算係數的估計和標準誤差的比率,以影響係數的意義。 在 Null 假設下,如果沒有套用正規化,則相關係數的估計會遵循平均 0 的常態分佈,而標準偏差等於上述標準誤差。 z 分數會輸出係數估計與係數標準誤差之間的比率。
- Pr(>|z|)這是 z 分數雙面測試的對應 p 值。 根據重要性層級,顯著性指標會附加至 p 值。 如果
F(x)是標準常態分配N(0, 1)的 CDF 則P(>|z|) = 2 - ``2 * F(|z|)為 。
作者(秒)
Microsoft公司 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,]