FastQuantileLayer
FastQuantileLayer is a Layer for Keras implementing the QuantileTransform similarly to scikit-learn QuantileTransformer. A similar implementation, more precise but not bound to Keras, can be found here: https://github.com/yandexdataschool/QuantileTransformerTF/blob/master/README.md
The purpose of this package is:
- remove all dependencies on scikit-learn
- obtain an evaluation of the direct and inverse transform as fast as possible (trading some precision for performance)
- obtain a TensorFlow graph runnable in a Sequential model in Keras
The package is composed of two classes:
- FixedBinInterpolator: intended to interpolate a point-defined function y = f(x) with equidistant x samples (x-grid)
- FastQuantileLayer: intended to compute the transform to preprocess the input data into a uniform- or normal-distributed variable.
Example outside Keras
## Creates the training dataset
dataset = np.random.uniform ( 0., 1., 1000 )
## Train the QuantileTransformer
transformer = FastQuantileLayer (output_distribution='normal')
transformer . fit ( dataset )
## Gets a new dataset with the same distribution as the training dataset
test_dataset = tf.constant(np.random.uniform ( 0., 1., 100000 ))
## Transform the variable into a Gaussian-distributed variable t
t = transformer . transform ( test_dataset )
[...]
## Appiles the inverted transform to the Gaussian distributed variable t
bkwd = transformer . transform ( t, inverse=True )
## bkwd differs from test_dataset only for computational errors
## (order 1e-5) that can be reduced tuning the arguments of QuantileTransformer
Example within Keras
## Creates the training dataset
dataset = np.random.uniform ( 0., 1., 1000 )
model = tf.keras.models.Sequential()
model.add ( FastQuantileLayer ( output_distribution = 'normal' ).fit ( dataset ) )
model.add ( Dense ( 10, activation = 'tanh' ) )
model.add ( Dense ( 1, activation = 'sigmoid' ) )
Metadata
Release files for FastQuantileLayer 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| FastQuantileLayer-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Release files / FastQuantileLayer-0.2.1-py3-none-any.whl
| Download URL | FastQuantileLayer-0.2.1-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
51278f9f4b6f15ef4a87649a45437a4e7533c36b83f7d98d0516868b4719e333
|
|
BLAKE2b-256 checksum How to use checksums |
0f0ee4030e40c4571d68f85bef054d379911f2a8e6491325be1a02a2ec0964c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.4.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6
|
Security for FastQuantileLayer 0.2.1
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.