Skip to content

Commit bf78c51

Browse files
authored
Merge pull request #163 from DoubleML/m-rename-abstract-methods
Rename abstract methods
2 parents fd2dce8 + 8efd9a4 commit bf78c51

File tree

6 files changed

+238
-383
lines changed

6 files changed

+238
-383
lines changed

R/double_ml.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ DoubleML = R6Class("DoubleML",
378378
}
379379

380380
# ml estimation of nuisance models and computation of psi elements
381-
res = private$ml_nuisance_and_score_elements(private$get__smpls())
381+
res = private$nuisance_est(private$get__smpls())
382382
private$psi_a_[, private$i_rep, private$i_treat] = res$psi_a
383383
private$psi_b_[, private$i_rep, private$i_treat] = res$psi_b
384384
if (store_predictions) {
@@ -814,7 +814,7 @@ DoubleML = R6Class("DoubleML",
814814
if (tune_on_folds) {
815815
for (i_rep in 1:self$n_rep) {
816816
private$i_rep = i_rep
817-
param_tuning = private$ml_nuisance_tuning(
817+
param_tuning = private$nuisance_tuning(
818818
private$get__smpls(),
819819
param_set, tune_settings, tune_on_folds)
820820
private$tuning_res_[[i_treat]][[i_rep]] = param_tuning
@@ -833,7 +833,7 @@ DoubleML = R6Class("DoubleML",
833833
}
834834
} else {
835835
private$i_rep = 1
836-
param_tuning = private$ml_nuisance_tuning(
836+
param_tuning = private$nuisance_tuning(
837837
private$get__smpls(),
838838
param_set, tune_settings, tune_on_folds)
839839
private$tuning_res_[[i_treat]] = param_tuning

R/double_ml_iivm.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ DoubleMLIIVM = R6Class("DoubleMLIIVM",
276276
"ml_r1" = nuisance)
277277
invisible(self)
278278
},
279-
ml_nuisance_and_score_elements = function(smpls, ...) {
279+
nuisance_est = function(smpls, ...) {
280280

281281
if (self$subgroups$always_takers == FALSE &
282282
self$subgroups$never_takers == FALSE) {
@@ -396,7 +396,7 @@ DoubleMLIIVM = R6Class("DoubleMLIIVM",
396396
}
397397
return(psis)
398398
},
399-
ml_nuisance_tuning = function(smpls, param_set, tune_settings,
399+
nuisance_tuning = function(smpls, param_set, tune_settings,
400400
tune_on_folds, ...) {
401401

402402
if (!tune_on_folds) {

R/double_ml_irm.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ DoubleMLIRM = R6Class("DoubleMLIRM",
214214
"ml_m" = nuisance)
215215
invisible(self)
216216
},
217-
ml_nuisance_and_score_elements = function(smpls, ...) {
217+
nuisance_est = function(smpls, ...) {
218218

219219
cond_smpls = get_cond_samples(
220220
smpls,
@@ -303,7 +303,7 @@ DoubleMLIRM = R6Class("DoubleMLIRM",
303303
}
304304
return(psis)
305305
},
306-
ml_nuisance_tuning = function(smpls, param_set, tune_settings,
306+
nuisance_tuning = function(smpls, param_set, tune_settings,
307307
tune_on_folds, ...) {
308308

309309
if (!tune_on_folds) {

R/double_ml_pliv.R

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -444,22 +444,22 @@ DoubleMLPLIV = R6Class("DoubleMLPLIV",
444444
names(private$params_) = param_names
445445
invisible(self)
446446
},
447-
ml_nuisance_and_score_elements = function(smpls, ...) {
447+
nuisance_est = function(smpls, ...) {
448448
if (self$partialX & !self$partialZ) {
449-
res = private$ml_nuisance_and_score_elements_partialX(smpls, ...)
449+
res = private$nuisance_est_partialX(smpls, ...)
450450

451451
} else if (!self$partialX & self$partialZ) {
452-
res = private$ml_nuisance_and_score_elements_partialZ(smpls, ...)
452+
res = private$nuisance_est_partialZ(smpls, ...)
453453

454454
} else if (self$partialX & self$partialZ) {
455-
res = private$ml_nuisance_and_score_elements_partialXZ(smpls, ...)
455+
res = private$nuisance_est_partialXZ(smpls, ...)
456456

457457
}
458458

459459
return(res)
460460
},
461461

462-
ml_nuisance_and_score_elements_partialX = function(smpls, ...) {
462+
nuisance_est_partialX = function(smpls, ...) {
463463

464464
l_hat = dml_cv_predict(self$learner$ml_l,
465465
c(self$data$x_cols, self$data$other_treat_cols),
@@ -602,7 +602,7 @@ DoubleMLPLIV = R6Class("DoubleMLPLIV",
602602
}
603603
return(psis)
604604
},
605-
ml_nuisance_and_score_elements_partialXZ = function(smpls, ...) {
605+
nuisance_est_partialXZ = function(smpls, ...) {
606606

607607
l_hat = dml_cv_predict(self$learner$ml_l,
608608
c(self$data$x_cols, self$data$other_treat_cols),
@@ -674,7 +674,7 @@ DoubleMLPLIV = R6Class("DoubleMLPLIV",
674674
return(res)
675675
},
676676

677-
ml_nuisance_and_score_elements_partialZ = function(smpls, ...) {
677+
nuisance_est_partialZ = function(smpls, ...) {
678678

679679
# nuisance r
680680

@@ -712,22 +712,22 @@ DoubleMLPLIV = R6Class("DoubleMLPLIV",
712712
},
713713

714714

715-
ml_nuisance_tuning = function(smpls, param_set, tune_settings,
715+
nuisance_tuning = function(smpls, param_set, tune_settings,
716716
tune_on_folds, ...) {
717717
if (self$partialX & !self$partialZ) {
718-
res = private$ml_nuisance_tuning_partialX(
718+
res = private$nuisance_tuning_partialX(
719719
smpls, param_set,
720720
tune_settings,
721721
tune_on_folds, ...)
722722

723723
} else if (!self$partialX & self$partialZ) {
724-
res = private$ml_nuisance_tuning_partialZ(
724+
res = private$nuisance_tuning_partialZ(
725725
smpls, param_set,
726726
tune_settings,
727727
tune_on_folds, ...)
728728

729729
} else if (self$partialX & self$partialZ) {
730-
res = private$ml_nuisance_tuning_partialXZ(
730+
res = private$nuisance_tuning_partialXZ(
731731
smpls, param_set,
732732
tune_settings,
733733
tune_on_folds, ...)
@@ -736,7 +736,7 @@ DoubleMLPLIV = R6Class("DoubleMLPLIV",
736736
return(res)
737737
},
738738

739-
ml_nuisance_tuning_partialX = function(smpls, param_set,
739+
nuisance_tuning_partialX = function(smpls, param_set,
740740
tune_settings, tune_on_folds, ...) {
741741

742742
if (!tune_on_folds) {
@@ -892,7 +892,7 @@ DoubleMLPLIV = R6Class("DoubleMLPLIV",
892892

893893
},
894894

895-
ml_nuisance_tuning_partialXZ = function(smpls, param_set,
895+
nuisance_tuning_partialXZ = function(smpls, param_set,
896896
tune_settings, tune_on_folds, ...) {
897897

898898
if (!tune_on_folds) {
@@ -968,7 +968,7 @@ DoubleMLPLIV = R6Class("DoubleMLPLIV",
968968
return(tuning_result)
969969
},
970970

971-
ml_nuisance_tuning_partialZ = function(smpls, param_set,
971+
nuisance_tuning_partialZ = function(smpls, param_set,
972972
tune_settings, tune_on_folds, ...) {
973973
if (!tune_on_folds) {
974974
data_tune_list = list(self$data$data_model)

R/double_ml_plr.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ DoubleMLPLR = R6Class("DoubleMLPLR",
379379
invisible(self)
380380
},
381381

382-
ml_nuisance_and_score_elements = function(smpls, ...) {
382+
nuisance_est = function(smpls, ...) {
383383

384384
l_hat = dml_cv_predict(self$learner$ml_l,
385385
c(self$data$x_cols, self$data$other_treat_cols),
@@ -459,7 +459,7 @@ DoubleMLPLR = R6Class("DoubleMLPLR",
459459
}
460460
return(psis)
461461
},
462-
ml_nuisance_tuning = function(smpls, param_set, tune_settings,
462+
nuisance_tuning = function(smpls, param_set, tune_settings,
463463
tune_on_folds, ...) {
464464

465465
if (!tune_on_folds) {

0 commit comments

Comments
 (0)