Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4710761

Browse files
Merge pull request#73 from alexzwanenburg/dev1.4.4
Merge version 1.4.4 with main branch
2 parents2397e0f +93c5601 commit4710761

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

‎DESCRIPTION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: familiar
22
Title: End-to-End Automated Machine Learning and Model Evaluation
3-
Version: 1.4.3
3+
Version: 1.4.4
44
Authors@R: c(
55
person("Alex", "Zwanenburg",
66
email = "alexander.zwanenburg@nct-dresden.de",

‎NEWS.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
#Version 1.4.4 (Quixotic Quail)
2+
3+
##Bug fixes
4+
5+
- Prevented an error that could occur when computing net benefit for decision curves of models that would predict class probabilities of exactly 1. This was a very rare error, as it would only occur if predicted class probabilities would have at most two distinct values, one of which is 1.0.
6+
7+
- Prevented an issue that could occur when computing linear calibration fits where the fit can be computed without residual errors. This would prevent the t-statistic and p-value from being correctly computed for binomial, multinomial and survival outcomes.
8+
9+
- Prevented an issue when computing linear calibration fits when all the expected values are the same. The model will then lack a slope. We now add a slope of 0, with an infinite confidence interval, if this is the case.
10+
111
#Version 1.4.3 (Puzzled Prawn)
212

313
##Bug fixes

‎R/FamiliarDataComputationCalibrationData.R‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -971,11 +971,23 @@ setMethod(
971971
# Get coefficients for intercept and slope
972972
fit_coef<-stats::coef(fit)
973973

974+
# Determine if there is no slope.
975+
no_slope<- is.na(fit_coef["expected"])&&data.table::uniqueN(calibration_data$expected)
976+
if (no_slope)fit_coef["expected"]<-0.0
977+
974978
# Get confidence intervals
975979
fit_conf_int<- suppressWarnings(stats::confint(fit))
980+
if (no_slope)fit_conf_int["expected", ]<- c(-Inf,Inf)
976981

977982
# Get summary
978983
fit_summary<- suppressWarnings(stats::summary.lm(fit))$coefficients
984+
if (no_slope) {
985+
fit_summary<- rbind(
986+
fit_summary,
987+
matrix(data= c(0.0,Inf,0.0,1.0),ncol=4)
988+
)
989+
rownames(fit_summary)<- c("(Intercept)","expected")
990+
}
979991

980992
# Correct for having multiple overlapping groups in binomial and multinomial
981993
# tests.
@@ -989,6 +1001,7 @@ setMethod(
9891001

9901002
# Recompute the t-score
9911003
fit_summary[,3]<-fit_summary[,1]/fit_summary[,2]
1004+
fit_summary[,3][fit_summary[,2]==0.0]<-Inf
9921005

9931006
# Recompute the p-value
9941007
fit_summary[,4]<-2.0*stats::pt(abs(fit_summary[,3]),fit$df.residual,lower.tail=FALSE)
@@ -1235,12 +1248,12 @@ setMethod(
12351248
if(method=="linear"){
12361249
# Interpolate observed values. Return NA values outside the known expected
12371250
# range.
1238-
observed_interpolated<-stats::approx(
1251+
observed_interpolated<-suppressWarnings(stats::approx(
12391252
x=data$expected,
12401253
y=data$observed,
12411254
xout=expected_interpolated,
12421255
method="linear",
1243-
rule=1)$y
1256+
rule=1)$y)
12441257

12451258
}elseif(method=="loess"){
12461259
# Set up the loess model.

‎R/FamiliarDataComputationDecisionCurveAnalysis.R‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,12 @@ setMethod("extract_decision_curve_data", signature(object="familiarEnsemble"),
479479
# Determine net benefit.
480480
data[,":="("net_benefit"=n_true_positive/n-n_false_positive/n* (probability/ (1.0-probability)))]
481481

482+
# Net benefit should be numeric.
483+
data<-data[is.finite(net_benefit)]
484+
485+
# Check if the data has more than 1 row.
486+
if (nrow(data)<=1)return(NULL)
487+
482488
# If the predicted probability occurs more than once, select the lowest net
483489
# benefit.
484490
data<-data[,list("net_benefit"=min(net_benefit)),by="probability"]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp