domid.utils package

Submodules

domid.utils.mean_std module

domid.utils.mean_std.run(path)[source]
domid.utils.mean_std.run2(path)[source]

domid.utils.perf_cluster module

class domid.utils.perf_cluster.PerfCluster(num_classes)[source]

Bases: PerfClassif

Clustering Performance

__init__(num_classes)[source]
classmethod hungarian_algorithm(cluster_pred_scalar, cluster_true_scalar, cost)[source]

This function takes two arrays as input, encodes any string elements to integers, and applies the Hungarian Algorithm to find the optimal assignment between the two arrays.

classmethod cal_acc(model, loader_te, device, max_batches=None)[source]

Compare the cluster assignment against the domain labels (d) as well as against the class labels (y). Compute the two respective confusion matrices and overall accuracy measurements (after finding the optimal matching with the cluster labels).

Parameters:
  • model

  • loader_te

  • device – for final test, GPU can be used

  • max_batches – maximum number of iterations for data loader, used to probe performance with less computational burden. default None, which means to traverse the whole dataset

Returns:

  • accuracy - clusters vs. y

  • confusion matrix - clusters vs. y

  • accuracy - clusters vs. d

  • confusion matrix - clusters vs. d

domid.utils.perf_similarity module

class domid.utils.perf_similarity.PerfCorrelationHER2[source]

Bases: PerfClassif

Clustering Performance

__init__()[source]
classmethod cal_acc(model, loader_tr, device, max_batches=None)[source]
Parameters:
  • model

  • loader_te

  • device – for final test, GPU can be used

domid.utils.storing module

class domid.utils.storing.Storing(args)[source]

Bases: object

__init__(args)[source]
storing(epoch, acc_tr_y, acc_tr_d, loss_tr, acc_val_y, acc_val_d, loss_val, r_score_tr, r_score_te)[source]
saving_model(model)[source]
storing_z_space(Z, predictions, vec_y_labels, vec_d_labels, image_id_labels)[source]
csv_dump(epoch)[source]

Module contents