FRsūtil̲s
A fuzzy-rough reasoning utilities library
 
Loading...
Searching...
No Matches
plot_tnorms.py
Go to the documentation of this file.
1import numpy as np
2import matplotlib.pyplot as plt
3from mpl_toolkits.mplot3d import Axes3D
4
5import sys
6import os
7
8sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../core')))
9
10import tnorms as tn
11
12# Create a grid of values
13n = 200 # Replace with your desired length (must be even)
14arr = np.concatenate([np.zeros(n // 2), np.ones(n // 2)])
15
16similarity_vals = np.linspace(0, 1, n)
17b_vals = arr
18AVals, simVals = np.meshgrid(similarity_vals, b_vals)
19
20# Vectorized computation of the implicator
21# TNVals = np.minimum(AVals, simVals)
22TNVals = np.multiply(AVals, simVals)
23
24
25# Plotting
26fig = plt.figure(figsize=(10, 7))
27ax = fig.add_subplot(111, projection='3d')
28
29# Plot surface with colormap
30# surf = ax.plot_surface(A, B, Z, cmap='hot', edgecolor='none')
31# Plot the points
32ax.scatter(AVals, simVals, TNVals, c='blue', marker='.')
33
34# Add color bar
35# fig.colorbar(surf, ax=ax, shrink=0.5, aspect=5)
36
37# Labels and title
38ax.set_title("product t-norm")
39ax.set_ylabel("A(y)")
40ax.set_xlabel("similarity (x,y)")
41ax.set_zlabel("T(similarity (x,y), A(y))")
42
43plt.tight_layout()
44plt.show()