F-transform approximation over residuated lattices
Project description
Fuzzaprox
A Python package for Fuzzy approximation using F-transforms over residuated lattices.
Installation
pip install fuzzaprox
Usage
import numpy as np
from fuzzaprox import Fuzzaprox
# 0) Instantiate fuzzaprox
fa = Fuzzaprox()
# 1) Set input data to approximate
y = np.sin(np.linspace(0, 4*np.pi, 100)) + 0.4*np.random.default_rng(42).normal(size=100)
fa.set_input_data(y) # Sets Input data
# 2) Define and set FUZZY SETs shape
fa.define_fuzzy_set(base_start=0, kernel_start=12, kernel_end=14, base_end=26)
# 3) Run the approximation calculation
res = fa.run()
# Output
inp = res.input_data # res.input_data: normalized input x/y
fw = res.forward # res.forward: forward approximation (x, upper_y, bottom_y)
inv = res.inverse # res.inverse: inverse approximation (x, upper_y, bottom_y)
Plot Results
import matplotlib.pyplot as plt
# Plot results
fig, axs = plt.subplots(2, figsize=(10, 7))
# Forward points
axs[0].plot(inp.x, inp.normalized_y)
axs[0].plot(fw.x, fw.upper_y, marker='s', linestyle='None')
axs[0].plot(fw.x, fw.bottom_y, marker='s', linestyle='None')
axs[0].set_title("Forward Approximations")
# Inverse approximations
axs[1].plot(inp.x, inp.normalized_y)
axs[1].plot(inv.x, inv.upper_y)
axs[1].plot(inv.x, inv.bottom_y)
axs[1].set_title("Inverse Approximations")
# Add spacing between subplots to prevent title overlap
plt.tight_layout(rect=[0, 0, 1, 0.98]) # Leave space for suptitle
plt.show()
License
See LICENSE file for license information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fuzzaprox-0.0.2.tar.gz
(11.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
fuzzaprox-0.0.2-py3-none-any.whl
(13.4 kB
view details)
File details
Details for the file fuzzaprox-0.0.2.tar.gz.
File metadata
- Download URL: fuzzaprox-0.0.2.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5740e200e61671f4960d715121b1580e1c705d686a040cfcd82a5d54fdea55af
|
|
| MD5 |
3b26f4882ed19b566fe3a1d4dcdcf20d
|
|
| BLAKE2b-256 |
2d5d676025ca132ad5878cdcfaa3e026a3fbb19c343ddb0fc2087944a45bb290
|
File details
Details for the file fuzzaprox-0.0.2-py3-none-any.whl.
File metadata
- Download URL: fuzzaprox-0.0.2-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbc5507555b0224d27cb4e60ced0fdd644c8495e2d2ba47b5737feacd67ddbc6
|
|
| MD5 |
b48de988774b4264aaf531f25f4a034d
|
|
| BLAKE2b-256 |
654577fc875299cefe45cc6294fa896dbc441c255adeeccd8888e9b0101ae4b5
|