ContrastiveFinetuner¶
embetter.finetune.ContrastiveFinetuner
¶
Run a contrastive network to finetune the embeddings towards a class.
Parameters
Name | Type | Description | Default |
---|---|---|---|
n_neg |
number of negative example pairs to sample per positive item | 3 |
|
n_epochs |
number of epochs to use for training | 20 |
|
learning_rate |
learning rate of the contrastive network | 0.001 |
fit(self, X, y)
¶
Show source code in finetune/_contrastive.py
106 107 108 |
|
Fits the finetuner.
generate_batch(self, X_torch, y)
¶
Show source code in finetune/_contrastive.py
110 111 112 113 114 115 116 117 118 119 |
|
Generate a batch of pytorch pairs used for finetuning
partial_fit(self, X, y, classes=None)
¶
Show source code in finetune/_contrastive.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
|
Fits the finetuner using the partial_fit API.
transform(self, X, y=None)
¶
Show source code in finetune/_contrastive.py
151 152 153 154 |
|
Transforms the data according to the sklearn api by using the hidden layer.