ao

Alternating optimization in R

https://github.com/loelschlaeger/ao

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 4 committers (25.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.1%) to scientific vocabulary

Keywords

optimization rstats

Keywords from Contributors

transformation
Last synced: 11 months ago · JSON representation

Repository

Alternating optimization in R

Basic Info
  • Host: GitHub
  • Owner: loelschlaeger
  • License: gpl-3.0
  • Language: R
  • Default Branch: main
  • Homepage: http://loelschlaeger.de/ao/
  • Size: 8.48 MB
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 2
  • Open Issues: 0
  • Releases: 1
Topics
optimization rstats
Created about 5 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License

README.Rmd

---
output: github_document
---



```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-"
)
library("ao")
```

# Alternating optimization 


[![CRAN status](https://www.r-pkg.org/badges/version/ao)](https://CRAN.R-project.org/package=ao)
[![CRAN downloads](https://cranlogs.r-pkg.org/badges/grand-total/ao)](https://CRAN.R-project.org/package=ao)
[![R-CMD-check](https://github.com/loelschlaeger/ao/workflows/R-CMD-check/badge.svg)](https://github.com/loelschlaeger/ao/actions)
[![future-tests](https://github.com/loelschlaeger/ao/workflows/future_tests/badge.svg)](https://github.com/loelschlaeger/ao/actions)
[![Codecov test coverage](https://codecov.io/gh/loelschlaeger/ao/branch/main/graph/badge.svg)](https://app.codecov.io/gh/loelschlaeger/ao?branch=main)


The `{ao}` package implements alternating optimization (AO) in [R](https://cran.r-project.org/).

## Why?

AO is an iterative process that optimizes a function by alternately performing restricted optimization over parameter subsets. Instead of joint optimization, it breaks the optimization problem down into simpler sub-problems. This approach can make optimization feasible when joint optimization is too difficult. 

The AO process implemented in `{ao}` can be

- viewed as a generalization of joint optimization, 

- used for minimization and maximization problems and with custom partitions of the parameters,

- randomized by changing the parameter partition randomly after each iteration, 

- run in multiple parallel processes for different initial values, parameter partitions, and/or base optimizers.

See the [package vignette](https://loelschlaeger.de/ao/articles/ao.html) for more details.

## How?

You can install the released package version from [CRAN](https://CRAN.R-project.org) with:

``` r
install.packages("ao")
```

Then load the package via `library("ao")` and you should be ready to go. Here is a simple example of alternating minimization of the [Rosenbrock function](https://en.wikipedia.org/wiki/Rosenbrock_function):

```{r, rosenbrock}
rosenbrock <- function(x) (1 - x[1])^2 + (x[2] - x[1]^2)^2
```

The resulting optimization path ...

```{r, rosenbrock_ao_path, echo = FALSE, warning = FALSE}
out <- ao(f = rosenbrock, initial = c(2, 2))
library("ggplot2")
x <- y <- seq(0.9, 2.1, 0.05)
grid <- expand.grid(x, y)
grid$z <- apply(grid, 1, rosenbrock)
ggplot(grid) +
  geom_raster(aes(x = Var1, y = Var2, fill = z)) +
  geom_contour(aes(x = Var1, y = Var2, z = z), colour = "white", bins = 40) +
  scale_fill_gradient(low = "blue", high = "red") +
  theme_minimal() +
  theme(
    axis.text.y = element_text(angle = 90)
  ) +
  labs(
    x = "x",
    y = "y",
    fill = "value",
    title = "Rosenbrock function with AO path"
  ) +
  coord_fixed() +
  scale_x_continuous(breaks = c(1, 2)) +
  scale_y_continuous(breaks = c(1, 2)) +
  geom_path(
    data = out$details, aes(x = p1, y = p2), linewidth = 1
  )
```

... is obtained as follows:

```{r, ao rosenbrock}
ao(f = rosenbrock, initial = c(2, 2))
```

## Contact?

If you have any questions, found a bug, need a feature, [just file an issue on GitHub](https://github.com/loelschlaeger/ao/issues/new/choose). 

Owner

  • Name: Lennart Oelschläger
  • Login: loelschlaeger
  • Kind: user
  • Location: Bielefeld, Germany
  • Company: Bielefeld University

Research Associate and PhD Student in Econometrics

GitHub Events

Total
  • Issues event: 6
  • Push event: 15
  • Pull request event: 1
Last Year
  • Issues event: 6
  • Push event: 15
  • Pull request event: 1

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 161
  • Total Committers: 4
  • Avg Commits per committer: 40.25
  • Development Distribution Score (DDS): 0.472
Past Year
  • Commits: 68
  • Committers: 3
  • Avg Commits per committer: 22.667
  • Development Distribution Score (DDS): 0.044
Top Committers
Name Email Commits
Lennart l****r@u****e 85
lennart.oelschlaeger o****t@g****m 73
unknown 2
loelschlaeger l****r 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 12 months ago

All Time
  • Total issues: 7
  • Total pull requests: 5
  • Average time to close issues: 3 months
  • Average time to close pull requests: about 2 months
  • Total issue authors: 2
  • Total pull request authors: 1
  • Average comments per issue: 0.86
  • Average comments per pull request: 0.2
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 4
  • Pull requests: 3
  • Average time to close issues: 5 months
  • Average time to close pull requests: 2 months
  • Issue authors: 2
  • Pull request authors: 1
  • Average comments per issue: 1.5
  • Average comments per pull request: 0.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • loelschlaeger (7)
  • sepi1881 (1)
Pull Request Authors
  • loelschlaeger (7)
Top Labels
Issue Labels
enhancement (2) bug (2)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 589 last-month
  • Total docker downloads: 21,613
  • Total dependent packages: 1
  • Total dependent repositories: 1
  • Total versions: 20
  • Total maintainers: 1
cran.r-project.org: ao

Alternating Optimization

  • Versions: 20
  • Dependent Packages: 1
  • Dependent Repositories: 1
  • Downloads: 589 Last month
  • Docker Downloads: 21,613
Rankings
Forks count: 17.2%
Dependent repos count: 24.4%
Average: 25.6%
Dependent packages count: 28.0%
Stargazers count: 28.0%
Downloads: 30.2%
Last synced: 12 months ago

Dependencies

DESCRIPTION cran
  • R >= 4.0.0 depends
  • optimizeR * depends
  • ggplot2 * imports
  • lifecycle * imports
  • rlang * imports
  • covr * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • testthat >= 3.0.0 suggests
.github/workflows/checks.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/coverage.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/styler.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite