MyNixOS website logo
Description

A Toolkit for Archetypal Analysis Methods.

Fits archetypal analysis models, including Euclidean, probabilistic, kernel, and directional variants. Methods include classical archetypal analysis from Cutler and Breiman (1994) <doi:10.1080/00401706.1994.10485840>, PCHA and kernel variants from Mørup and Hansen (2012) <doi:10.1016/j.neucom.2011.06.033>, probabilistic archetypal analysis from Seth and Eugster (2016) <doi:10.1007/s10994-015-5498-8>, directional archetypal analysis from Olsen et al. (2022) <doi:10.3389/fnins.2022.911034>, AA++ initialization from Mair and Sjölund (2023) <doi:10.48550/arXiv.2301.13748>, coreset-style initialization from Mair and Brefeld (2019) <https://proceedings.neurips.cc/paper_files/paper/2019/file/7f278ad602c7f47aa76d1bfc90f20263-Paper.pdf>, and adapted AIC from Suleman (2017) <doi:10.1109/FUZZ-IEEE.2017.8015385>. Provides initialization helpers, model selection paths, plotting methods, 'broom' methods, and a 'tidymodels' recipe step.

yaap

yaap is Yet Another Archetypes Package: a practical, matrix-first R toolkit that brings together many variants and flavors of archetypal analysis in one place. Some of these workflows are currently scattered across different packages, while others have had little or no R implementation available.

The package centers on a shared run_aa() interface for fitting, inspecting, comparing, plotting, and reusing archetypal analysis models. It supports multivariate, functional, non-Gaussian, kernel, and directional AA, plus direct solver wrappers when you want more control.

Installation 🛠️

yaap is currently under revision and may not yet be available on CRAN. For now, install the development version from GitHub:

# install.packages("pak")
pak::pak("teosakel/yaap")

Once released on CRAN, installation will be:

install.packages("yaap")

Quick Start 🚀

The core workflow is matrix-based: rows are samples, columns are features, and archetypes are fitted as extreme profiles in the convex hull of the data.

library(yaap)

X <- as.matrix(iris[, 1:4])  # numeric columns

fit <- run_aa(X, K = 3, nrep = 5, scale = TRUE)

coordinates(fit)          # K x features: the archetype profiles
compositions(fit)[1:6, ]  # samples x K: each sample's archetype mixture

plot(fit, what = "profiles")
generics::glance(fit)

You can also fit by formula when that is more convenient:

fit_iris <- run_aa(Species ~ ., data = iris, K = 3, scale = TRUE)

What Can yaap Do? 🧰

  • 📐 Euclidean / Gaussian AA with projected-gradient and NNLS solvers via run_aa(..., method = "pgd"), run_aa(..., method = "nnls"), archetypes_pgd(), and archetypes_nnls().
  • 🧮 Probabilistic AA for Gaussian, binomial, Poisson, and multinomial data via run_aa(..., method = "paa", family = ...).
  • 🌀 Kernel AA for nonlinear geometry via run_aa(..., method = "kernel", kernel = ...), including precomputed kernels.
  • 🧭 Directional AA for unit-vector, angular, or polarity-invariant data via run_aa(..., method = "directional").
  • 📈 Metric and functional AA using feature metrics through scale = G and direct support for fda::fd objects.
  • 🧪 Robust and missing-data workflows for Gaussian AA, including automatic missing-data handling when NA values are present.
  • 🧩 Initialization helpers through aa_init(), including random, Dirichlet, furthest-first, k-means++, FurthestSum, AA++, batched coreset-style initialization, and hull-outmost strategies.
  • 📊 Model comparison and diagnostics with archetypes_path(), screeplot(), AIC(), loss tracking, plotting methods, and standard S3 helpers such as predict(), fitted(), and residuals().
  • 🧹 Workflow integration through generics::tidy(), generics::glance(), generics::augment(), and the recipes step step_archetypes().

Vignette Tour 🗺️

The README is only the map. The vignettes are the snacks.

  • Introduction: the main run_aa() workflow, object structure, plotting, prediction, choosing K, robust fitting, missing data, and PGD vs NNLS.
  • Initialization: how aa_init() works, when initialization matters, and how FurthestSum, AA++, batched, and hull-based methods behave.
  • Non-Gaussian and Alternative Geometries: metric Gaussian AA, functional AA, kernel AA, probabilistic AA, and directional AA.
  • Tidymodels: using step_archetypes() inside recipes workflows and tuning archetype-related parameters.

Methods and References 📚

yaap keeps the references close to the features they support:

Metadata

Version

1.0.0

License

Unknown

Platforms (79)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    wasip1
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasip1
  • wasm64-wasip1
  • x86_64-cygwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows