ino

Initialization of numerical optimization

https://github.com/loelschlaeger/ino

Science Score: 26.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
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.3%) to scientific vocabulary

Keywords

optimization rstats
Last synced: 10 months ago · JSON representation

Repository

Initialization of numerical optimization

Basic Info
  • Host: GitHub
  • Owner: loelschlaeger
  • License: gpl-3.0
  • Language: R
  • Default Branch: master
  • Homepage: http://loelschlaeger.de/ino/
  • Size: 26.6 MB
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 2
  • Open Issues: 0
  • Releases: 0
Topics
optimization rstats
Created over 4 years ago · Last pushed 12 months 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-",
  out.width = "70%",
  message = FALSE,
  warning = FALSE
)
```

# Initialization of numerical optimization 


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


The `{ino}` R package provides a framework for analyzing the role of initialization in numerical optimization. It allows for systematic comparisons of different initialization strategies and optimization algorithms using a unified `R6` object called [`Nop`](https://loelschlaeger.de/ino/reference/Nop.html). For detailed examples and usage guidance, please have a look at the [package vignettes](https://loelschlaeger.de/ino/articles/).

## Installation

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

```{r install_released}
install.packages("ino")
```

## Example

The [Ackley function](https://en.wikipedia.org/wiki/Ackley_function) has multiple local minima and one global minimum at the origin. We define 

1. the numerical optimization problem as a `Nop` object, 
2. two optimization algorithms `stats::nlm()` and `stats::optim()`, and 
3. 40 randomly drawn initial values:

```{r ackley_definition}
library("ino")
set.seed(1)
Nop_ackley <- Nop$new(f = TestFunctions::TF_ackley, npar = 2)$
  set_optimizer(optimizeR::Optimizer$new("stats::nlm"))$
  set_optimizer(optimizeR::Optimizer$new("stats::optim"))$
  initialize_random(runs = 40)
```

We can visualize the function surface along with the initial values:

```{r ackley_plot}
library("ggplot2")
Nop_ackley |> autoplot()
```

Next, we optimize the function via the previously defined initial values and optimizers:

```{r ackley_optimize}
Nop_ackley$optimize()
```

In this example, `stats::nlm()` appears to be both faster...

```{r ackley_time}
Nop_ackley$results |> 
  ggplot2::autoplot("seconds", group_by = "optimizer", relative = TRUE) +
  ggplot2::scale_x_continuous(labels = scales::percent_format()) +
  ggplot2::labs(
    "x" = "optimization time relative to overall median",
    "y" = "optimizer"
  )
```

... and more effective at locating the global minimum:

```{r ackley_optima}
Nop_ackley$optima(digits = 2, group_by = "optimizer")
```

Overall, (only) `r Nop_ackley$optima(digits = 2) |> dplyr::filter(value == 0) |> dplyr::select(n) |> dplyr::slice(1) |> as.numeric()`% of of the initializations successfully converged to the global minimum.

## Contact

Have a question, found a bug, request a feature, want to contribute? [Please file an issue](https://github.com/loelschlaeger/ino/issues/new/choose).

## Related R packages

- The [{trackopt} package](https://CRAN.R-project.org/package=trackopt) tracks parameter value, gradient, and Hessian at each iteration of numerical optimizers in R. This can be useful for analyzing optimization progress, diagnosing issues, and studying convergence behavior.

- The [{optimizeR} package](https://CRAN.R-project.org/package=optimizeR) provides a unified object-oriented framework for numerical optimizers in R. Allows for both minimization and maximization with any optimizer, optimization over more than one function argument, measuring of computation time, setting a time limit for long optimization tasks.

- The [{ao} package](https://CRAN.R-project.org/package=ao) implements 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.

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: 1
  • Watch event: 1
  • Issue comment event: 3
  • Push event: 17
  • Pull request event: 1
Last Year
  • Issues event: 1
  • Watch event: 1
  • Issue comment event: 3
  • Push event: 17
  • Pull request event: 1

Packages

  • Total packages: 1
  • Total downloads:
    • cran 289 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 6
  • Total maintainers: 1
cran.r-project.org: ino

Initialization of Numerical Optimization

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 289 Last month
Rankings
Forks count: 21.9%
Dependent packages count: 29.8%
Average: 30.6%
Stargazers count: 35.2%
Dependent repos count: 35.5%
Last synced: 11 months ago

Dependencies

DESCRIPTION cran
  • R >= 4.0.0 depends
  • optimizeR * depends
  • ao >= 0.2.3 imports
  • cli * imports
  • crayon * imports
  • doSNOW * imports
  • dplyr * imports
  • foreach * imports
  • ggplot2 * imports
  • mvtnorm * imports
  • progress * imports
  • rlang * imports
  • knitr * suggests
  • pracma * suggests
  • purrr * 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/styler.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.4.1 composite
  • actions/checkout v3 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/render-readme.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-renv v2 composite