Skip to content

Commit

Permalink
change mgc to hyppo (#56)
Browse files Browse the repository at this point in the history
* fix black formatting

* upgrade to joblib and add default permutation test (#52) (#54)

* upgrade to joblib and add default permutation test

* fix assertion errors

* fix block_size error

* fix black formatting

* remove random state and local dcorr tests

* Update independence.ipynb

* reformat to black code

* match notebooks to figures in paper

* updated algorith speed code

* just run HHG on this test

* Update indep_alg_speed.ipynb

* updated benchmark code

* remove random forest module

* update figure 1 of paper

* update mgc references to hyppo

* Fix bold letters in index.rst

* correct code coverage calculation

* make header longer in contributing

* change references from mgc to hyppo
  • Loading branch information
sampan501 authored Feb 17, 2020
1 parent 9f425c5 commit 5b9cbf4
Show file tree
Hide file tree
Showing 96 changed files with 284 additions and 455 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ show_missing = True
omit =
*tests*
*__init__.py
*mgc/_utils.py
*hyppo/_utils.py
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Bug Report
about: Create a report to help us improve mgc
about: Create a report to help us improve hyppo
label: bug

---
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/documentation_fix.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Documentation Fix
about: Create a report to help us improve the documentation of mgc
about: Create a report to help us improve the documentation of hyppo
label: documentation

---
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Feature Request
about: Suggest an idea for mgc
about: Suggest an idea for hyppo
label: enhancement

---
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ install:
- if [[ $TRAVIS_PYTHON_VERSION != '3.5' ]]; then travis_retry pip install black; fi

script:
- pytest mgc/
- if [[ $TRAVIS_PYTHON_VERSION != '3.5' ]]; then black --check --diff ./mgc; fi
- pytest hyppo/
- if [[ $TRAVIS_PYTHON_VERSION != '3.5' ]]; then black --check --diff ./hyppo; fi

after_success:
- codecov
Expand Down
18 changes: 9 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
Contributing to mgc
===================
Contributing to hyppo
=====================

(adopted from scikit-learn)

The latest contributing guide is available in the repository at
`docs/contributing.rst`, or online at:

[https://mgc.neurodata.io/contributing.html](https://mgc.neurodata.io/contributing.html)
[https://hyppo.neurodata.io/contributing.html](https://hyppo.neurodata.io/contributing.html)

There are many ways to contribute to mgc, with the most common ones
There are many ways to contribute to `hyppo`, with the most common ones
being contribution of code or documentation to the project. Improving the
documentation is no less important than improving the library itself. If you
find a typo in the documentation, or have made improvements,do not hesitate to
submit a GitHub pull request. Documentation can be found under the
[docs/](https://github.com/neurodata/mgc/tree/master/docs) directory.
[docs/](https://github.com/neurodata/hyppo/tree/master/docs) directory.

But there are many other ways to help. In particular answering queries on the
[issue tracker](https://github.com/neurodata/mgc/issues), and
[issue tracker](https://github.com/neurodata/hyppo/issues), and
investigating bugs are very valuable contributions that decrease the burden on
the project maintainers.

Expand All @@ -28,9 +28,9 @@ link to it from your website, or simply star it in GitHub to say "I use it".
Quick links
-----------

* [Submitting a bug report or feature request](http://mgc.neurodata.io/contributing.html#submitting-a-bug-report-or-a-feature-request)
* [Contributing code](http://mgc.neurodata.io/contributing.html#contributing-code)
* [Coding guidelines](http://mgc.neurodata.io/contributing.html#coding-guidelines)
* [Submitting a bug report or feature request](http://hyppo.neurodata.io/contributing.html#submitting-a-bug-report-or-a-feature-request)
* [Contributing code](http://hyppo.neurodata.io/contributing.html#contributing-code)
* [Coding guidelines](http://hyppo.neurodata.io/contributing.html#coding-guidelines)

Code of Conduct
---------------
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Sambit Panda
Copyright (c) 2019 Neurodata

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# mgc
# hyppo

[![Build Status](https://travis-ci.org/neurodata/mgc.svg?branch=master)](https://travis-ci.org/neurodata/mgc)
[![codecov](https://codecov.io/gh/neurodata/mgc/branch/master/graph/badge.svg)](https://codecov.io/gh/neurodata/mgc)
[![PyPI version](https://img.shields.io/pypi/v/mgc.svg)](https://pypi.org/project/mgc/)
[![License](https://img.shields.io/github/license/neurodata/mgc)](https://mgc.neurodata.io/license.html)
[![arXiv shield](https://img.shields.io/badge/arXiv-1907.02088-red.svg?style=flat)](https://arxiv.org/abs/1907.02088)

`mgc` (pronounced "Magic") is an open-source software package for independence and k-sample testing.
`hyppo` (**HYP**othesis Testing in **P**yth**O**n, pronounced "Hippo") is an open-source software package for independence and k-sample testing.

- **Installation Guide:** [https://mgc.neurodata.io/install.html](https://mgc.neurodata.io/install.html)
- **Documentation:** [https://mgc.neurodata.io/](https://mgc.neurodata.io/)
Expand All @@ -15,4 +15,4 @@
- **Issues:** [https://github.com/neurodata/mgc/issues](https://github.com/neurodata/mgc/issues)
- **Contribution Guide:** [https://mgc.neurodata.io/contributing.html](https://mgc.neurodata.io/contributing.html)

`mgc` intends to be a comprehensive independence and k-sample testing package and runs on all major versions of operating systems. It also includes novel tests not found in other packages that operate on multivariate data. It is quick to install and free of charge. If you need to use high dimensional independence or k-sample testing, be sure to give `mgc` a try!
`hyppo` intends to be a comprehensive independence and k-sample testing package and runs on all major versions of operating systems. It also includes novel tests not found in other packages that operate on multivariate data. It is quick to install and free of charge. If you need to use multivariate hypothesis testing, be sure to give `hyppo` a try!
8 changes: 4 additions & 4 deletions benchmarks/2samp_alg_speed.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
"import sys, os\n",
"sys.path.append(os.path.realpath('..'))\n",
"\n",
"from mgc.ksample import KSample\n",
"from mgc.independence import *\n",
"from mgc.sims import linear"
"from hyppo.ksample import KSample\n",
"from hyppo.independence import *\n",
"from hyppo.sims import linear"
]
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/2samp_power_angle.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"import matplotlib.pyplot as plt\n",
"\n",
"from benchmarks import power_2samp_angle\n",
"from mgc.independence import CCA, Dcorr, HHG, Hsic, RV, MGC\n",
"from mgc.sims import *\n",
"from hyppo.independence import CCA, Dcorr, HHG, Hsic, RV, MGC\n",
"from hyppo.sims import *\n",
"\n",
"sys.path.append(os.path.realpath('..'))"
]
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/2samp_power_dimension.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"import matplotlib.pyplot as plt\n",
"\n",
"from benchmarks import power_2samp_dimension\n",
"from mgc.independence import CCA, Dcorr, HHG, Hsic, RV, MGC\n",
"from mgc.sims import *\n",
"from hyppo.independence import CCA, Dcorr, HHG, Hsic, RV, MGC\n",
"from hyppo.sims import *\n",
"\n",
"sys.path.append(os.path.realpath('..'))"
]
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/2samp_power_sampsize.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"import matplotlib.pyplot as plt\n",
"\n",
"from benchmarks import power_2samp_sample\n",
"from mgc.independence import CCA, Dcorr, HHG, Hsic, RV, MGC\n",
"from mgc.sims import *\n",
"from hyppo.independence import CCA, Dcorr, HHG, Hsic, RV, MGC\n",
"from hyppo.sims import *\n",
"\n",
"sys.path.append(os.path.realpath('..'))"
]
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/2samp_simulations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"import matplotlib.pyplot as plt\n",
"from tqdm.notebook import tqdm\n",
"\n",
"from mgc.sims import *"
"from hyppo.sims import *"
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/3samp_power_epsilon.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -28,8 +28,8 @@
"from matplotlib.legend import Legend\n",
"\n",
"from benchmarks import power_3samp_epsweight\n",
"from mgc.independence import Dcorr, Hsic, MGC\n",
"from mgc.sims import gaussian_3samp\n",
"from hyppo.independence import Dcorr, Hsic, MGC\n",
"from hyppo.sims import gaussian_3samp\n",
"\n",
"sys.path.append(os.path.realpath('..'))"
]
Expand Down
Binary file modified benchmarks/figs/indep_wall_times.pdf
Binary file not shown.
Binary file modified benchmarks/figs/same_stat.pdf
Binary file not shown.
20 changes: 14 additions & 6 deletions benchmarks/indep_alg_speed.R
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
require("energy")
require("kernlab")
require("mgc")
require("HHG")
require("microbenchmark")

num_samples_range = c(20, 50, 100, 200, 500, 1000, 2000, 5000, 10000)
num_samples_range = c(50, 100, 200, 500, 1000, 2000, 5000, 10000)
linear_data <- list()
i <- 1
for (num_samples in num_samples_range){
data <- mgc.sims.linear(num_samples, 1, eps=0.1)
data <- mgc.sims.linear(num_samples, 1)
x <- data$X
y <- data$Y
times = seq(1, 3, by=1)
executions <- list()
for (t in times){
func <- kmmd
#func <- dcov.test
time_taken <- microbenchmark(func(data$X, data$Y), times=1, unit="secs") # best of 5 executions
#x <- as.matrix(dist((x), diag = TRUE, upper = TRUE))
#y <- as.matrix(dist((y), diag = TRUE, upper = TRUE))
#time_taken <- microbenchmark(kmmd(x, y, ntimes=1000), times=1, unit="secs") # best of 5 executions
#time_taken <- microbenchmark(dcor.test(x, y, R=1000), times=1, unit="secs") # best of 5 executions
#time_taken <- microbenchmark(dcor.test(x, y, R=1000), times=1, unit="secs") # best of 5 executions
time_taken <- microbenchmark(dcor2d(x, y), times=1, unit="secs") # best of 5 executions
#time_taken <- microbenchmark(hhg.test(x, y, nr.perm = 1000), times=1, unit="secs") # best of 5 executions
executions <- c(executions, list(time_taken[1, 2]/(10^9)))
}
linear_data <- c(linear_data, list(sapply(executions, mean)))
Expand All @@ -22,4 +29,5 @@ for (num_samples in num_samples_range){
i <- i + 1
}

print(linear_data)
df <- data.frame(matrix(unlist(linear_data), nrow=length(linear_data), byrow=T), stringsAsFactors=FALSE)
write.csv(df, row.names=FALSE)
Loading

0 comments on commit 5b9cbf4

Please sign in to comment.