MyNixOS website logo
Description

Model Averaging-Assisted Optimal Transfer Learning.

Transfer learning, as a prevailing technique in computer sciences, aims to improve the performance of a target model by leveraging auxiliary information from heterogeneous source data. We provide novel tools for multi-source transfer learning under statistical models based on model averaging strategies, including linear regression models, partially linear models. Unlike existing transfer learning approaches, this method integrates the auxiliary information through data-driven weight assignments to avoid negative transfer. This is the first package for transfer learning based on the optimal model averaging frameworks, providing efficient implementations for practitioners in multi-source data modeling. The details are described in Hu and Zhang (2023) <https://jmlr.org/papers/v24/23-0030.html>.

matrans

This package provides prediction tools under multi-source transfer learning framework based on frequentist model averaging strategy. It is primarily built on statistical model frameworks, including linear regression models, partially linear models. Unlike existing approaches, the proposed methods can adaptively integrate the auxiliary information from different sources and possess asymptotic optimality for prediction on the target model. It is worth noting that this package is the first open-source software package for transfer learning based on the optimal model averaging methods, providing convenient and efficient computational tools for practitioners in multi-source data modeling. For specific details, please refer to the following literature:

[1] Hu, X., & Zhang, X. (2023). Optimal Parameter-Transfer Learning by Semiparametric Model Averaging. Journal of Machine Learning Research, 24(358), 1-53.

Any questions or comments, please don’t hesitate to contact with me any time.

Installation

You can install the development version of the package like so:

library("devtools")
devtools::install_github("XnhuUcas/matrans")

Maintainer

Xiaonan Hu ([email protected])

Usage

This is a simple example which shows users how to use the provided functions to estimate weights and make predictions.

First, we generate simulation datasets (M=3) under the corrected target model and homogeneous dimension settings.

library(matrans)

## generate simulation datasets (M=3)
size <- c(150, 200, 200, 150)
coeff0 <- cbind(
  as.matrix(c(1.4, -1.2, 1, -0.8, 0.65, 0.3)),
  as.matrix(c(1.4, -1.2, 1, -0.8, 0.65, 0.3) + 0.02),
  as.matrix(c(1.4, -1.2, 1, -0.8, 0.65, 0.3) + 0.3),
  as.matrix(c(1.4, -1.2, 1, -0.8, 0.65, 0.3))
)
px <- 6
err.sigma <- 0.5
rho <- 0.5
size.test <- 500

whole.data <- simdata.gen(
  px = px, num.source = 4, size = size, coeff0 = coeff0, coeff.mis = as.matrix(c(coeff0[, 2], 1.8)),
  err.sigma = err.sigma, rho = rho, size.test = size.test, sim.set = "homo", tar.spec = "cor",
  if.heter = FALSE
)
data.train <- whole.data$data.train
data.test <- whole.data$data.test

Then, we apply the functions to implement weights estimation and out-of-sample predictions.

## optimal weights estimation
bs.para <- list(bs.df = rep(3, 3), bs.degree = rep(3, 3))
data.train$data.x[[2]] <- data.train$data.x[[2]][, -7]
fit.transsmap <- trans.smap(train.data = data.train, nfold = 5, bs.para = bs.para)
ma.weights <- fit.transsmap$weight.est
time.transsmap <- fit.transsmap$time.transsmap

## out-of-sample prediction results
pred.res <- pred.transsmap(object = fit.transsmap, newdata = data.test, bs.para = bs.para)
pred.val <- pred.res$predict.val
Metadata

Version

0.1.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • 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-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
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • 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-windows