Skip to content

Commit

Permalink
Evaluation and edition of modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Roberto Mercado Diaz committed Apr 2, 2024
1 parent 55d2e27 commit f8fcd3e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
Binary file not shown.
24 changes: 24 additions & 0 deletions BML_project/active_learning/ss_active_learning.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,30 @@ def run_minibatch_kmeans(data_loader, n_clusters, device, batch_size=100):

return minibatch_kmeans

""" from sklearn.cluster import MiniBatchKMeans
import numpy as np
def run_minibatch_kmeans(data_loader, n_clusters, device, batch_size=100, n_init='auto'):
# Initialize MiniBatchKMeans with explicit n_init to suppress the FutureWarning
minibatch_kmeans = MiniBatchKMeans(n_clusters=n_clusters, n_init=n_init, random_state=0, batch_size=batch_size)
# Prepare an empty list to collect all data for fitting
all_data = []
# Iterate through data_loader and collect data
for batch in data_loader:
# Assuming 'data' is a key in your batch dict that contains the features
data = batch['data'].view(batch['data'].size(0), -1).cpu().numpy() # Adjust as necessary
all_data.append(data)
# Concatenate all data collected from the batches
all_data_np = np.concatenate(all_data, axis=0)
# Fit MiniBatchKMeans with all collected data at once
minibatch_kmeans.fit(all_data_np)
return minibatch_kmeans """

# def compare_kmeans_gp_predictions(kmeans_model, gp_model, data_loader, device):
# # Compare K-Means with GP model predictions
# all_data, all_labels = [], []
Expand Down
Binary file modified BML_project/models/__pycache__/ss_gp_model.cpython-311.pyc
Binary file not shown.
Binary file modified BML_project/utils_gp/__pycache__/ss_evaluation.cpython-311.pyc
Binary file not shown.
Binary file modified BML_project/utils_gp/__pycache__/visualization.cpython-311.pyc
Binary file not shown.

0 comments on commit f8fcd3e

Please sign in to comment.