{"id":19839823,"url":"https://github.com/qdata/kdiffnet","last_synced_at":"2025-08-30T17:12:22.670Z","repository":{"id":83652163,"uuid":"483766549","full_name":"QData/KDiffNet","owner":"QData","description":null,"archived":false,"fork":false,"pushed_at":"2022-04-21T00:39:39.000Z","size":247,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-28T22:21:29.446Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QData.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-20T18:18:42.000Z","updated_at":"2022-04-24T14:15:38.000Z","dependencies_parsed_at":"2023-02-27T12:00:34.608Z","dependency_job_id":null,"html_url":"https://github.com/QData/KDiffNet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/QData/KDiffNet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QData%2FKDiffNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QData%2FKDiffNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QData%2FKDiffNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QData%2FKDiffNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QData","download_url":"https://codeload.github.com/QData/KDiffNet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QData%2FKDiffNet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272878320,"owners_count":25008336,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T12:24:30.392Z","updated_at":"2025-08-30T17:12:22.651Z","avatar_url":"https://github.com/QData.png","language":"R","readme":"# KDiffNet\n\nThis repository contains code for estimating Differential Networks using extra evidence as described in the following paper:  \n\u003e[Beyond Data Samples: Aligning Differential Networks Estimation with Scientific Knowledge](https://arxiv.org/abs/2004.11494)  \n\u003e Arshdeep Sekhon, Zhe Wang, Yanjun Qi\n\u003e International Conference on Artificial Intelligence and Statistics (AISTATS), 2022\n\n\n\n## Estimating Differential Matrix using KDiffNet \n\nTo estimate the differential matrix `estimated_delta` given two sets of samples, `X_c` and `X_d` and edge level known knowledge `W_E` and node group knowledge `G_V`:\n```{r}\nsourceDirectory(\"kdiffnet/\")\nestimated_delta = kdiffnet(X_c, X_d, W_E, G_V, epsilon, lambda)\n```\nHere, `lambda` and `epsilon` are hyperparameters. \n\n## Generating Simulated Data \n\nTo generate a ground truth differential matrix `truth_delta`, we first need to specify its generating parameters. To generate `truth_delta` from the edge level matrix `W_E` and known groups `G_V`, with a sparsity level of `delta_sparsity` and `individual_sparsity`. \n```{r}\ngraphs = simulate_w_group(W, g, delta_sparsity, individual_sparsity)\nOmega_d = graphs[[2]]\nOmega_c = graphs[[1]]\ntruth_delta=(Omega_d - Omega_c)\n```\n\nWe can then generate two sets of samples, `X_c` and `X_d`, each following a Gaussian Distribution with inverse covariance matrix as Omega_c` and `Omega_d ` respectively:\n\n```{r}\nf \u003c- function(m) class(try(solve(m),silent=T))==\"matrix\"\nlibrary(Hmisc)\nlibrary(R.utils)\nlibrary(boot)\nlibrary(MASS)\ncovcTrue =  solve(Omega_c)\ncovdTrue =  solve(Omega_d)\nX_c = mvrnorm(nc, mu = rep(0,nrow(W_E)), covcTrue)\nX_d = mvrnorm(nd, mu = rep(0,nrow(W_E)), covdTrue)\n```\nHere, `nc` and `nd` are the number of samples we wish to generate. \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqdata%2Fkdiffnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqdata%2Fkdiffnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqdata%2Fkdiffnet/lists"}