Giter Club home page Giter Club logo

diffnet's Introduction

Introduction for R package Diffnet

Differential network is an important tool to capture the changes of conditional correlations under two sample cases. We develop an efficient fista algorithm via the symmetric quadratic loss for differential matrix estimation. The computation complexity of our algorithm is linear in the sample size and the number of parameters, which is optimal in the sense that it is of the same order as computing two sample covariance matrices.

Getting Started

These instructions will give you a toy example for implementing the package.

Prerequisites

What things you need to install the software and how to install them. The key functions of the package is writing in C++. So, make sure your OS can complies C++ code. For example, you should install Rtools under Windows and Xcode under MacOS. After that, the following R packages are also necessary.

install.packages("devtools")
install.packages("MASS")
install.packages("Matrix")

Install Diffnet

Install from Github

devtools::install_github("zhoutang776/Diffnet")

Toy example

library(diffnet)
rm(list = ls())
set.seed(123)
library('MASS')
library('Matrix')
library('diffnet')
## ---------------------------- preprocess -----------------------------------------
n_X = 100; n_Y = n_X;
p_X = 100; p_Y = p_X;
nlambda = 50
tuning = "none"
case = "case1"
stop.tol = 1e-5
perturb = FALSE
correlation = FALSE
max.iter = 800
lambda.min.ratio = 0.5

# ------------ data generating -----------------
data = diffnet.case(n=n_X, p=p_X, method = case)
X = data$X
Y = data$Y
diff.Omega = data$diff.Omega
print(sum(diff.Omega!=0))

start = proc.time()[3]
result = diffnet(X, Y, verbose = FALSE, nlambda = nlambda, max.iter = max.iter, lambda.min.ratio = lambda.min.ratio, stop.tol=stop.tol, method = "lasso", perturb =perturb, correlation = correlation)
elapse = proc.time()[3] - start

print(result$path[[50]][1:5,1:5])

diffnet's People

Contributors

zhoutang776 avatar

Stargazers

 avatar Ricardo Daniel Marques Salgado avatar

Watchers

James Cloos avatar Ricardo Daniel Marques Salgado avatar Mohammad Arashi avatar paper2code - bot avatar

Forkers

cescwang85

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.