ace_nn
Introduction
This repo contains experimental implementation of ace algorithm via neural network. It is shown by xiangxiang-xu that calculating optimal features by Alternating Conditional Expectation is equivalent to maximize H-score.
How to run
Three examples are provided ( one for continuous variable and the other twos are for discrete variable) and their results are the same as ace. The main function is ace_nn and its parameters are very similar to ace_cream.
import numpy as np
from ace_nn import ace_nn
# discrete case, binary symmetric channel with crossover probability 0.1
N_SIZE = 1000
x = np.random.choice([0,1], size=N_SIZE)
n = np.random.choice([0,1], size=N_SIZE, p=[0.9, 0.1])
y = np.mod(x + n, 2)
# set both x(cat=0) and y(cat=-1) as categorical type
tx, ty = ace_nn(x, y, cat=[-1,0], epochs=100)
# continuous case
x = np.random.uniform(0, np.pi, 200)
y = np.exp(np.sin(x)+np.random.normal(size=200)/2)
tx, ty = ace_nn(x, y)
For more detail, run help(ace_nn) to see the parameters and returns of this function.
Further discussion
Currently, the neural networks used to approximate optimal $f(x)$ and $g(y)$ are two-layer MLP with tanh as activation function. More turns of epochs are needed for large alphabet $|\mathcal{X}|$ and $|\mathcal{Y}|$ and the running time is not short.
Also, batch_size and hidden_units_num can be hypertuned, and there is no guarantee that current configuration of neural network is optimal for solving ace.
Application
we can use ace_nn(x, y, return_hscore = True) to calculate a lower bound of $\frac{\norm{B}_F^2}{2}$
Metadata
Release files for ace-nn 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ace_nn-0.2.tar.gz | 3.8 kB | Without provenance | Details for ace_nn-0.2.tar.gz |
Release files / ace_nn-0.2.tar.gz
| Download URL | ace_nn-0.2.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c51c7c2b0853c6945173def0170eb93b28275ffee8de81ee66ef6c7ea338f519
|
|
BLAKE2b-256 checksum How to use checksums |
b1cc69418eba970547c4fed55a8e7bfdd0ec83dd5646a3a59db8e1cf35c172f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
|
Security for ace-nn 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.