Skip to content

Commit 3414449

Browse files
authored
Prepare the 0.6.0 release (#105)
1 parent e9cf9c1 commit 3414449

File tree

8 files changed

+37
-24
lines changed

8 files changed

+37
-24
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to `maq` will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.6.0] - 2025-04-14
8+
9+
## Added
10+
- Add convenience function `scale_maq` for mapping policy values and budgets to a specific application. [#104](https://github.com/grf-labs/maq/pull/104)
11+
712
## [0.5.0] - 2024-11-14
813

914
### Added

RELEASES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ For a big release, can also run `R CMD check --as-cran --run-donttest --use-valg
8787

8888
## Previous performance test results
8989

90+
**0.6.0**
91+
92+
Only a minor release with no perf/C++ touches.
93+
9094
**0.5.0**
9195

9296
Only a minor release with no perf/C++ touches.

r-package/maq/DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: maq
22
Title: Multi-Armed Qini
3-
Version: 0.5.0
3+
Version: 0.6.0
44
Authors@R: c(
55
person("Erik", "Sverdrup", email = "[email protected]", role = c("aut", "cre")),
66
person("Han", "Wu", role = "aut"),

r-package/maq/NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export(get_aipw_scores)
1010
export(get_ipw_scores)
1111
export(integrated_difference)
1212
export(maq)
13-
export(maq_scale)
13+
export(scale_maq)
1414
importFrom(Rcpp,evalCpp)
1515
importFrom(stats,predict)
1616
useDynLib(maq, .registration = TRUE)

r-package/maq/R/maq.R

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -551,13 +551,13 @@ integrated_difference <- function(object.lhs,
551551

552552
#' Scale a Qini curve.
553553
#'
554-
#' Remap the policy value and budget to some problem-specific application.
555-
#' This is a convenience function that is usually useful for plotting.
554+
#' Remaps the policy value and budget to application-specific units.
555+
#' This convenience function is typically useful for plots.
556556
#'
557557
#' @param object A maq object.
558558
#' @param scale A numeric value to scale by.
559559
#'
560-
#' @return A rescaled maq object.
560+
#' @return A maq object with policy values and budget rescaled by the given factor.
561561
#'
562562
#' @examples
563563
#' \donttest{
@@ -572,15 +572,17 @@ integrated_difference <- function(object.lhs,
572572
#' qini <- maq(reward, cost, scores, R = 200)
573573
#'
574574
#' # Plot the policy values as we vary the fraction treated.
575-
#' qini |>
576-
#' plot(xlab = "Treated fraction")
575+
#' plot(qini, xlab = "Fraction treated")
577576
#'
578577
#' # Plot the policy values for a maximum allocation of, for example, 500 units.
579-
#' maq_scale(qini, 500) |>
580-
#' plot(xlab = "Units treated")
578+
#' plot(scale_maq(qini, 500), xlab = "Units treated")
579+
#'
580+
#' # With R 4.1.0 or later, the native pipe can be used to chain scaling and plotting.
581+
#' # scale_maq(qini, 500) |>
582+
#' # plot(xlab = "Units treated")
581583
#'}
582584
#' @export
583-
maq_scale <- function(object,
585+
scale_maq <- function(object,
584586
scale = 1) {
585587
object[["_path"]]$spend <- scale * object[["_path"]]$spend
586588
object[["_path"]]$gain <- scale * object[["_path"]]$gain

r-package/maq/man/maq_scale.Rd renamed to r-package/maq/man/scale_maq.Rd

Lines changed: 12 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

r-package/maq/pkgdown/_pkgdown.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ reference:
1616
- title: Multi-Armed Qini
1717
contents:
1818
- maq
19-
- maq_scale
2019
- predict.maq
2120
- average_gain
2221
- difference_gain
2322
- integrated_difference
23+
- scale_maq
2424
- get_ipw_scores
2525
- get_aipw_scores
2626

r-package/maq/tests/testthat/test_maq.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ test_that("integrated_difference grid lookup numerics works as expected", {
559559
expect_equal(est, estt, tolerance = 1e-10)
560560
})
561561

562-
test_that("maq_scale works as expected", {
562+
test_that("scale_maq works as expected", {
563563
n <- 500
564564
K <- 2
565565
reward <- matrix(1 + rnorm(n * K), n, K)
@@ -570,7 +570,7 @@ test_that("maq_scale works as expected", {
570570
qini <- maq(reward, cost, scores, R = 200)
571571
qini.s <- maq(reward, cost * scale, scores * scale, R = 200)
572572

573-
expect_equal(qini.s, maq_scale(qini, scale))
573+
expect_equal(qini.s, scale_maq(qini, scale))
574574
expect_equal(average_gain(qini.s, 42),
575-
average_gain(maq_scale(qini, scale), 42))
575+
average_gain(scale_maq(qini, scale), 42))
576576
})

0 commit comments

Comments
 (0)