Add create_image.py

This commit is contained in:
Harry Stuart 2024-06-11 21:28:52 +10:00
parent 9f32be3bdf
commit 38ff7c8a74
3 changed files with 16 additions and 3 deletions

View File

@ -35,9 +35,9 @@ def mlflow_context():
@given( @given(
data=st.data(), data=st.data(),
feature_size=st.integers(min_value=1, max_value=10), feature_size=st.integers(min_value=1, max_value=10),
width=st.integers(min_value=MINIMUM_NETWORK_DIMENSION, max_value=20), width=st.integers(min_value=MINIMUM_NETWORK_DIMENSION, max_value=100),
height=st.integers(min_value=MINIMUM_NETWORK_DIMENSION, max_value=20), height=st.integers(min_value=MINIMUM_NETWORK_DIMENSION, max_value=100),
num_iterations=st.integers(min_value=10, max_value=50), num_iterations=st.integers(min_value=10, max_value=100),
initial_learning_rate=st.floats(min_value=1e-3, max_value=1.0, allow_nan=False, allow_infinity=False) initial_learning_rate=st.floats(min_value=1e-3, max_value=1.0, allow_nan=False, allow_infinity=False)
) )
@settings(max_examples=10, deadline=None, suppress_health_check=(HealthCheck.too_slow,)) @settings(max_examples=10, deadline=None, suppress_health_check=(HealthCheck.too_slow,))

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

13
create_image.py Normal file
View File

@ -0,0 +1,13 @@
import numpy as np
import matplotlib.pyplot as plt
from models import train_kohonen_network, create_kohonen_params
X = np.random.random((1000,3))
IMAGE_SIZE = 10
params = create_kohonen_params(X, IMAGE_SIZE, IMAGE_SIZE, 1000).unwrap()
image_data = train_kohonen_network(X, params, use_mlflow=True).unwrap()
plt.imsave(f'{IMAGE_SIZE}.png', image_data)