MyNixOS website logo
Description

Causal Discovery from Discrete Data using Hidden Compact Representation.

This code provides a method to fit the hidden compact representation model as well as to identify the causal direction on discrete data. We implement an effective solution to recover the above hidden compact representation under the likelihood framework. Please see the Causal Discovery from Discrete Data using Hidden Compact Representation from NIPS 2018 by Ruichu Cai, Jie Qiao, Kun Zhang, Zhenjie Zhang and Zhifeng Hao (2018) <https://nips.cc/Conferences/2018/Schedule?showEvent=11274> for a description of some of our methods.

HCR

Overview

This code provides a method to fit the hidden compact representation model as well as to discover the causal direction on discrete data.

Please cite "Ruichu Cai, Jie Qiao, Kun Zhang, Zhenjie Zhang, Zhifeng Hao. Causal Discovery from Discrete Data using Hidden Compact Representation. NIPS 2018."

Installation

install.packages("HCR")

Quick Start

This package contains the data synthetic process for HCR model. Here are some examples to make a quick start:

# HCR data
library(data.table)
set.seed(1)
data=simuXY(sample_size=2000)
r1<-HCR(data$X,data$Y,score_type = "aic")
r2<-HCR(data$Y,data$X,score_type = "aic")
if(r1$score>r2$score){
  print("X cause Y.")
}else{
  print("Y cause X.")
}
unique(r1$data[,c("X","Yp")]) # The fitted hidden representation
unique(data.frame(data$X,data$Yp)) # The true hidden representation

# A fast implementation of HCR
r1<-HCR.fast(data$X,data$Y)
r2<-HCR.fast(data$Y,data$X)
if(r1$score>r2$score){
  print("X cause Y.")
}else{
  print("Y cause X.")
}
unique(r1$data[,c("X","Yp")]) # The fitted hidden representation
unique(data.frame(data$X,data$Yp)) # The true hidden representation

# ANM data
# Note that the complete generate of the ANM data can be found in http://webdav.tuebingen.mpg.de/causality/
set.seed(0)
X=sample(1:5,2000,replace = T)
N=sample(-1:1,2000,replace = T)
Y=X+N
r1=HCR(X,Y,score_type = "bic",is_anm = T)
r2=HCR(Y,X,score_type = "bic",is_anm = T)
if(r1$score>r2$score){
  print("X cause Y.")
}else{
  print("Y cause X.")
}


Metadata

Version

0.1.1

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