fishy.experiments.contrastiveΒΆ

Contrastive learning experiments with comprehensive pair-wise similarity metrics.

Classes

class fishy.experiments.contrastive.ContrastiveConfig(contrastive_method: str = 'simclr', dataset: str = 'species', num_epochs: int = 100, batch_size: int = 64, learning_rate: float = 0.0003, weight_decay: float = 0.0001, file_path: str | None = None, encoder_type: str = 'dense', embedding_dim: int = 128, projection_dim: int = 128, temperature: float = 0.55, moco_k: int = 4096, moco_m: float = 0.999, moco_t: float = 0.07, byol_m: float = 0.996, barlow_lambda: float = 0.005, wandb_project: str | None = 'fishy-business', wandb_entity: str | None = 'victoria-university-of-wellington', wandb_log: bool = False, run: int = 0, random_projection: bool = (False,), quantize: bool = (False,), turbo_quant: bool = (False,), polar: bool = (False,), normalize: bool = (False,), snv: bool = (False,), minmax: bool = (False,), log_transform: bool = (False,), savgol: bool = (False,))[source]ΒΆ

Bases: object

Configuration for contrastive learning.

__init__(contrastive_method: str = 'simclr', dataset: str = 'species', num_epochs: int = 100, batch_size: int = 64, learning_rate: float = 0.0003, weight_decay: float = 0.0001, file_path: str | None = None, encoder_type: str = 'dense', embedding_dim: int = 128, projection_dim: int = 128, temperature: float = 0.55, moco_k: int = 4096, moco_m: float = 0.999, moco_t: float = 0.07, byol_m: float = 0.996, barlow_lambda: float = 0.005, wandb_project: str | None = 'fishy-business', wandb_entity: str | None = 'victoria-university-of-wellington', wandb_log: bool = False, run: int = 0, random_projection: bool = (False,), quantize: bool = (False,), turbo_quant: bool = (False,), polar: bool = (False,), normalize: bool = (False,), snv: bool = (False,), minmax: bool = (False,), log_transform: bool = (False,), savgol: bool = (False,)) None[source]ΒΆ
barlow_lambda: float = 0.005ΒΆ
batch_size: int = 64ΒΆ
byol_m: float = 0.996ΒΆ
contrastive_method: str = 'simclr'ΒΆ
dataset: str = 'species'ΒΆ
embedding_dim: int = 128ΒΆ
encoder_type: str = 'dense'ΒΆ
file_path: str | None = NoneΒΆ
learning_rate: float = 0.0003ΒΆ
log_transform: bool = (False,)ΒΆ
minmax: bool = (False,)ΒΆ
moco_k: int = 4096ΒΆ
moco_m: float = 0.999ΒΆ
moco_t: float = 0.07ΒΆ
normalize: bool = (False,)ΒΆ
num_epochs: int = 100ΒΆ
polar: bool = (False,)ΒΆ
projection_dim: int = 128ΒΆ
quantize: bool = (False,)ΒΆ
random_projection: bool = (False,)ΒΆ
run: int = 0ΒΆ
savgol: bool = (False,)ΒΆ
snv: bool = (False,)ΒΆ
temperature: float = 0.55ΒΆ
turbo_quant: bool = (False,)ΒΆ
wandb_entity: str | None = 'victoria-university-of-wellington'ΒΆ
wandb_log: bool = FalseΒΆ
wandb_project: str | None = 'fishy-business'ΒΆ
weight_decay: float = 0.0001ΒΆ
class fishy.experiments.contrastive.ContrastiveTrainer(config: ContrastiveConfig, wandb_run: Any | None = None, ctx: RunContext | None = None)[source]ΒΆ

Bases: object

Trainer focused on Pair-wise Similarity Metrics for self-supervised learning.

__init__(config: ContrastiveConfig, wandb_run: Any | None = None, ctx: RunContext | None = None) None[source]ΒΆ
evaluate_pairwise_performance() None[source]ΒΆ

Evaluates pair-wise similarity on the held-out test set.

log_contrastive_visualizations() None[source]ΒΆ
setup() None[source]ΒΆ
train() None[source]ΒΆ

Functions

fishy.experiments.contrastive.run_contrastive_experiment(config, wandb_run=None, ctx=None)[source]ΒΆ

s