Skip to main content
# Alternating Conditional Expectation Algorithm
[![Build Status](https://travis-ci.org/zhaofeng-shu33/ace_cream.svg?branch=master)](https://travis-ci.org/zhaofeng-shu33/ace_cream)
[![PyPI](https://img.shields.io/pypi/v/ace_cream.svg)](https://pypi.org/project/ace_cream)
[![Windows](https://ci.appveyor.com/api/projects/status/github/zhaofeng-shu33/ace_cream?branch=master&svg=true)](https://ci.appveyor.com/project/zhaofeng-shu33/ace_cream)

This project provides a wrapper program of Python for ACE algorithm implementation of Fortran.

## Install Binary Distribution
Currently, only 64-bit binary distribution is provided.
Run `pip install ace_cream` to install the binary distribution.

| Platform | py3.6 | py3.7 | py2.7 |
| -------- | :---: | :---: | :---: |
| Windows | T | T | T |
| MacOS | | T | T |
| Linux | T | T | T |

## How to build
You need `numpy` and fortran compiler to build from source.

### Windows

* Install [Visual C++](https://blogs.msdn.microsoft.com/vcblog/2017/03/07/msvc-the-best-choice-for-windows/) toolchain.

* Download MinGW-w64 from [sourceforge](https://sourceforge.net/projects/mingw-w64/files/latest/download?source=typ_redirect), which provides the necessary fortran compiler

* Install MinGW-w64 and add `{install_dir}\mingw64\bin` path to environment variable (make `gfortran` accessible from command line).

* (for conda environment) Add `{install_dir}\Anaconda3\Scripts` to environment variable (make `f2py` accessible from command line).



### Mac

You can use package manager to install `gfortran` (included within gnu compiler collection). For example, with `Homebrew` you can use

```shell
brew install gcc
```

### Ubuntu

To install `gfortran`, use the default package manager:

```shell
sudo apt-get install gfortran
```

Run `python setup.py install` from command line at the project root directory.

## How to use

```Python
import numpy as np
from ace_cream import ace_cream
# discrete case, binary symmetric channel with crossover probability 0.1
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_cream(x, y, cat=[-1,0])

# 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_cream(x, y)
```
## Result
![image](./example/continuous.svg)

## change log
1. v0.1 initial commit
1. v0.2 modify to relative import in `__init__.py`
1. v0.3 add support for multiple columns of x and other directions of transformation
1. v0.4 add `f_mapping` function and unittests for this function

## License
Apache License Version 2.0

## Reference
1. [https://en.wikipedia.org/wiki/Alternating_conditional_expectations](https://en.wikipedia.org/wiki/Alternating_conditional_expectations)

Metadata

Release files for ace-cream 0.4.post10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ace-cream 0.4.post10
File Size Uploaded Provenance Actions
ace_cream-0.4.post10.tar.gz 35.1 kB Without provenance Details for ace_cream-0.4.post10.tar.gz

Release files / ace_cream-0.4.post10.tar.gz

Download URL ace_cream-0.4.post10.tar.gz
Size 35.1 kB
Tags Source
SHA-256 checksum
How to use checksums
09595f2f6477fc7437a09f924ef11cf4cd65c2d7172f04ed6d343b6795262398
BLAKE2b-256 checksum
How to use checksums
618dd099528e57f80871bfa157e6cf70e788077188facfb888f87b982dc83eac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/2.7.15

Security for ace-cream 0.4.post10

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page