File size: 33,011 Bytes
3d5ad52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
---
language:
- code
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:3150
- loss:MultipleNegativesRankingLoss
- loss:ContrastiveLoss
widget:
- source_sentence: '{"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/A2Kgip3knb4xmFj/download",
    "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/HHeBR7Q9QnLM85E/download",
    "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/rkHBdRGpy7qAspj/download",
    "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/KXJjqrsrjnPKD3b/download",
    "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/sLBtSQxQ3HxiMyE/download"}},
    "sample_id": "census_acae7679-d077-461c-b857-ee6ccfeb267f_357"}'
  sentences:
  - Memory B cell derived from a 5-year-old human individual, with IGH + IGL, IgA1
    isotype, IGHJ3*01, IGHV3-30*18, IGLC3, IGLV1-44, IGLJ3, obstructive sleep apnea,
    and recurrent tonsillitis.
  - Neuron cell type from the hippocampal formation, specifically from the Head of
    hippocampus (HiH) - Uncal CA1 dissection, in a 50-year-old male individual, with
    a supercluster term of Miscellaneous.
  - Prostate gland microvascular endothelial cell derived from a 74-year-old male
    of European ethnicity, specifically located in the transition zone of the prostate.
- source_sentence: '{"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/A2Kgip3knb4xmFj/download",
    "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/HHeBR7Q9QnLM85E/download",
    "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/rkHBdRGpy7qAspj/download",
    "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/KXJjqrsrjnPKD3b/download",
    "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/sLBtSQxQ3HxiMyE/download"}},
    "sample_id": "census_27d91086-cfe3-4e33-9282-bd1246e5ce8e_128"}'
  sentences:
  - Sample is an oligodendrocyte cell from a 29-year-old male human, with European
    self-reported ethnicity, specifically located in the thalamic complex.
  - Neuron cell type from a 50-year-old male cerebral cortex, specifically from the
    Long insular gyri (LIG) and Dysgranular insular cortex - Idg region, classified
    as Deep-layer corticothalamic and 6b.
  - Fibroblast cells from the thalamic complex, specifically from the medial nuclear
    complex of thalamus (MNC), mediodorsal nucleus of thalamus + reuniens nucleus
    (medioventral nucleus) of thalamus (MD + Re) in a 50-year-old male.
- source_sentence: '{"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/A2Kgip3knb4xmFj/download",
    "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/HHeBR7Q9QnLM85E/download",
    "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/rkHBdRGpy7qAspj/download",
    "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/KXJjqrsrjnPKD3b/download",
    "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/sLBtSQxQ3HxiMyE/download"}},
    "sample_id": "census_5af90777-6760-4003-9dba-8f945fec6fdf_3563"}'
  sentences:
  - Memory B cell from a 3-year-old male human with recurrent tonsillitis, expressing
    IgG3 isotype, IGLC2, and IGLV2-23-IGLJ2 antibody.
  - Macrophage cells from the kidney tissue of a female individual in her sixties,
    specifically SPP1+ tumor-associated macrophages (TAMs), originating from a tumor
    sample.
  - Fibroblast cells from the hypothalamus tissue, specifically from the mammillary
    region of HTH (HTHma) and mammillary nucleus (MN), of a 29-year-old male.
- source_sentence: '{"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/A2Kgip3knb4xmFj/download",
    "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/HHeBR7Q9QnLM85E/download",
    "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/rkHBdRGpy7qAspj/download",
    "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/KXJjqrsrjnPKD3b/download",
    "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/sLBtSQxQ3HxiMyE/download"}},
    "sample_id": "census_218acb0f-9f2f-4f76-b90b-15a4b7c7f629_30680"}'
  sentences:
  - Ependymal cell derived from the spinal cord tissue of a 50-year-old male human
    donor.
  - Progenitor cells derived from blood tissue of a 58-year old female with managed
    systemic lupus erythematosus (SLE). The cells are of European ethnicity and were
    obtained from peripheral blood mononuclear cell suspension.
  - Cell sample from the cortex of kidney, taken from a 46-year-old male with kidney
    cancer, identified as an alternatively activated macrophage.
- source_sentence: '{"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/A2Kgip3knb4xmFj/download",
    "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/HHeBR7Q9QnLM85E/download",
    "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/rkHBdRGpy7qAspj/download",
    "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/KXJjqrsrjnPKD3b/download",
    "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/sLBtSQxQ3HxiMyE/download"}},
    "sample_id": "census_e84f2780-51e8-4cfa-8aa0-13bbfef677c7_184"}'
  sentences:
  - A 46-year old female's liver sample, specifically conventional dendritic cell
    type 1 (cDC1s) enriched in CD45+ cell suspension, with no reported liver-related
    diseases.
  - Sample is an ON-bipolar cell derived from the peripheral region of the retina
    of a 60-year-old male with European self-reported ethnicity, mapped to GENCODE
    24 reference annotation.
  - Alpha-beta T cell from the thoracic lymph node of a female individual in her seventies,
    identified as T_CD4/CD8 subtype, with predicted labels as Double-negative thymocytes,
    and majority voting as Regulatory T cells.
datasets:
- jo-mengr/geo_7k_cellxgene_3_5k_multiplets
pipeline_tag: sentence-similarity
library_name: sentence-transformers
metrics:
- cosine_accuracy
- cosine_accuracy_threshold
- cosine_f1
- cosine_f1_threshold
- cosine_precision
- cosine_recall
- cosine_ap
- cosine_mcc
model-index:
- name: SentenceTransformer
  results:
  - task:
      type: triplet
      name: Triplet
    dataset:
      name: Unknown
      type: unknown
    metrics:
    - type: cosine_accuracy
      value: 0.4942857027053833
      name: Cosine Accuracy
  - task:
      type: binary-classification
      name: Binary Classification
    dataset:
      name: Unknown
      type: unknown
    metrics:
    - type: cosine_accuracy
      value: 0.900952380952381
      name: Cosine Accuracy
    - type: cosine_accuracy_threshold
      value: 0.8415515422821045
      name: Cosine Accuracy Threshold
    - type: cosine_f1
      value: 0.8594377510040161
      name: Cosine F1
    - type: cosine_f1_threshold
      value: 0.7717130184173584
      name: Cosine F1 Threshold
    - type: cosine_precision
      value: 0.8085642317380353
      name: Cosine Precision
    - type: cosine_recall
      value: 0.9171428571428571
      name: Cosine Recall
    - type: cosine_ap
      value: 0.8751864028703273
      name: Cosine Ap
    - type: cosine_mcc
      value: 0.7860489453464287
      name: Cosine Mcc
---

# SentenceTransformer

This is a [sentence-transformers](https://www.SBERT.net) model trained on the [geo_7k_cellxgene_3_5k_multiplets](https://huggingface.co/datasets/jo-mengr/geo_7k_cellxgene_3_5k_multiplets) dataset. It maps sentences & paragraphs to a None-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.

## Model Details

### Model Description
- **Model Type:** Sentence Transformer
<!-- - **Base model:** [Unknown](https://huggingface.co/unknown) -->
- **Maximum Sequence Length:** None tokens
- **Output Dimensionality:** None dimensions
- **Similarity Function:** Cosine Similarity
- **Training Dataset:**
    - [geo_7k_cellxgene_3_5k_multiplets](https://huggingface.co/datasets/jo-mengr/geo_7k_cellxgene_3_5k_multiplets)
- **Language:** code
<!-- - **License:** Unknown -->

### Model Sources

- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)

### Full Model Architecture

```
SentenceTransformer(
  (0): MMContextEncoder(
    (text_encoder): BertModel(
      (embeddings): BertEmbeddings(
        (word_embeddings): Embedding(28996, 768, padding_idx=0)
        (position_embeddings): Embedding(512, 768)
        (token_type_embeddings): Embedding(2, 768)
        (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)
        (dropout): Dropout(p=0.1, inplace=False)
      )
      (encoder): BertEncoder(
        (layer): ModuleList(
          (0-11): 12 x BertLayer(
            (attention): BertAttention(
              (self): BertSdpaSelfAttention(
                (query): Linear(in_features=768, out_features=768, bias=True)
                (key): Linear(in_features=768, out_features=768, bias=True)
                (value): Linear(in_features=768, out_features=768, bias=True)
                (dropout): Dropout(p=0.1, inplace=False)
              )
              (output): BertSelfOutput(
                (dense): Linear(in_features=768, out_features=768, bias=True)
                (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)
                (dropout): Dropout(p=0.1, inplace=False)
              )
            )
            (intermediate): BertIntermediate(
              (dense): Linear(in_features=768, out_features=3072, bias=True)
              (intermediate_act_fn): GELUActivation()
            )
            (output): BertOutput(
              (dense): Linear(in_features=3072, out_features=768, bias=True)
              (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)
              (dropout): Dropout(p=0.1, inplace=False)
            )
          )
        )
      )
      (pooler): BertPooler(
        (dense): Linear(in_features=768, out_features=768, bias=True)
        (activation): Tanh()
      )
    )
    (text_adapter): AdapterModule(
      (net): Sequential(
        (0): Linear(in_features=768, out_features=512, bias=True)
        (1): ReLU(inplace=True)
        (2): Linear(in_features=512, out_features=2048, bias=True)
        (3): BatchNorm1d(2048, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      )
    )
    (omics_adapter): AdapterModule(
      (net): Sequential(
        (0): Linear(in_features=64, out_features=512, bias=True)
        (1): ReLU(inplace=True)
        (2): Linear(in_features=512, out_features=2048, bias=True)
        (3): BatchNorm1d(2048, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      )
    )
  )
)
```

## Usage

### Direct Usage (Sentence Transformers)

First install the Sentence Transformers library:

```bash
pip install -U sentence-transformers
```

Then you can load this model and run inference.
```python
from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("jo-mengr/mmcontext-geo7k-cellxgene3.5k-pairs-cell_type")
# Run inference
sentences = [
    '{"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/A2Kgip3knb4xmFj/download", "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/HHeBR7Q9QnLM85E/download", "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/rkHBdRGpy7qAspj/download", "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/KXJjqrsrjnPKD3b/download", "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/sLBtSQxQ3HxiMyE/download"}}, "sample_id": "census_e84f2780-51e8-4cfa-8aa0-13bbfef677c7_184"}',
    "A 46-year old female's liver sample, specifically conventional dendritic cell type 1 (cDC1s) enriched in CD45+ cell suspension, with no reported liver-related diseases.",
    'Sample is an ON-bipolar cell derived from the peripheral region of the retina of a 60-year-old male with European self-reported ethnicity, mapped to GENCODE 24 reference annotation.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
```

<!--
### Direct Usage (Transformers)

<details><summary>Click to see the direct usage in Transformers</summary>

</details>
-->

<!--
### Downstream Usage (Sentence Transformers)

You can finetune this model on your own dataset.

<details><summary>Click to expand</summary>

</details>
-->

<!--
### Out-of-Scope Use

*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->

## Evaluation

### Metrics

#### Triplet

* Evaluated with [<code>TripletEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.TripletEvaluator)

| Metric              | Value      |
|:--------------------|:-----------|
| **cosine_accuracy** | **0.4943** |

#### Binary Classification

* Evaluated with [<code>BinaryClassificationEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.BinaryClassificationEvaluator)

| Metric                    | Value      |
|:--------------------------|:-----------|
| cosine_accuracy           | 0.901      |
| cosine_accuracy_threshold | 0.8416     |
| cosine_f1                 | 0.8594     |
| cosine_f1_threshold       | 0.7717     |
| cosine_precision          | 0.8086     |
| cosine_recall             | 0.9171     |
| **cosine_ap**             | **0.8752** |
| cosine_mcc                | 0.786      |

<!--
## Bias, Risks and Limitations

*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
-->

<!--
### Recommendations

*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
-->

## Training Details

### Training Dataset

#### geo_7k_cellxgene_3_5k_multiplets

* Dataset: [geo_7k_cellxgene_3_5k_multiplets](https://huggingface.co/datasets/jo-mengr/geo_7k_cellxgene_3_5k_multiplets) at [d5af8a2](https://huggingface.co/datasets/jo-mengr/geo_7k_cellxgene_3_5k_multiplets/tree/d5af8a2ef144a95afa06f7294be2686f7a610e50)
* Size: 3,150 training samples
* Columns: <code>anndata_ref</code>, <code>caption</code>, and <code>label</code>
* Approximate statistics based on the first 1000 samples:
  |         | anndata_ref                                                                                       | caption                                                                                           | label                                                          |
  |:--------|:--------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------|:---------------------------------------------------------------|
  | type    | string                                                                                            | string                                                                                            | float                                                          |
  | details | <ul><li>min: 510 characters</li><li>mean: 512.71 characters</li><li>max: 514 characters</li></ul> | <ul><li>min: 43 characters</li><li>mean: 162.51 characters</li><li>max: 1070 characters</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.33</li><li>max: 1.0</li></ul> |
* Samples:
  | anndata_ref                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | caption                                                                                                                                   | label            |
  |:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------|:-----------------|
  | <code>{"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/DCW3zXGDx6DWY7i/download", "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/EbjeimYBdjefbpg/download", "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/mggGyqZE6892DWz/download", "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/Rt4wXwEPifBT2nX/download", "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/dmkHbFpkJLLqHPx/download"}}, "sample_id": "census_a37f857c-779f-464e-9310-3db43a1811e7_2741"}</code> | <code>Sample is a macrophage cell type derived from the ileal epithelium tissue of a female human in her fourth decade.</code>            | <code>1.0</code> |
  | <code>{"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/DCW3zXGDx6DWY7i/download", "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/EbjeimYBdjefbpg/download", "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/mggGyqZE6892DWz/download", "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/Rt4wXwEPifBT2nX/download", "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/dmkHbFpkJLLqHPx/download"}}, "sample_id": "census_a37f857c-779f-464e-9310-3db43a1811e7_2741"}</code> | <code>Erythrocyte cells at the mid erythroid stage, derived from bone marrow of a male human fetus at 15 weeks post-fertilization.</code> | <code>0.0</code> |
  | <code>{"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/DCW3zXGDx6DWY7i/download", "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/EbjeimYBdjefbpg/download", "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/mggGyqZE6892DWz/download", "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/Rt4wXwEPifBT2nX/download", "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/dmkHbFpkJLLqHPx/download"}}, "sample_id": "census_a37f857c-779f-464e-9310-3db43a1811e7_2741"}</code> | <code>Native cell from the spleen of a 15th week post-fertilization human female, identified as DOUBLET_IMMUNE_FIBROBLAST.</code>         | <code>0.0</code> |
* Loss: [<code>ContrastiveLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#contrastiveloss) with these parameters:
  ```json
  {
      "distance_metric": "SiameseDistanceMetric.COSINE_DISTANCE",
      "margin": 0.5,
      "size_average": true
  }
  ```

### Evaluation Dataset

#### geo_7k_cellxgene_3_5k_multiplets

* Dataset: [geo_7k_cellxgene_3_5k_multiplets](https://huggingface.co/datasets/jo-mengr/geo_7k_cellxgene_3_5k_multiplets) at [d5af8a2](https://huggingface.co/datasets/jo-mengr/geo_7k_cellxgene_3_5k_multiplets/tree/d5af8a2ef144a95afa06f7294be2686f7a610e50)
* Size: 350 evaluation samples
* Columns: <code>anndata_ref</code>, <code>caption</code>, and <code>label</code>
* Approximate statistics based on the first 350 samples:
  |         | anndata_ref                                                                                       | caption                                                                                          | label                                                          |
  |:--------|:--------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------|:---------------------------------------------------------------|
  | type    | string                                                                                            | string                                                                                           | float                                                          |
  | details | <ul><li>min: 510 characters</li><li>mean: 512.77 characters</li><li>max: 514 characters</li></ul> | <ul><li>min: 50 characters</li><li>mean: 159.74 characters</li><li>max: 924 characters</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.33</li><li>max: 1.0</li></ul> |
* Samples:
  | anndata_ref                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | caption                                                                                                                                                                               | label            |
  |:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------|
  | <code>{"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/EbaoL4ydTqmYwP9/download", "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/X8EFSis4S5ecdse/download", "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/DGxs2PkPeDF2RGm/download", "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/bm3N8RCWePiyJKz/download", "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/8FGZG6EzMeBYxjX/download"}}, "sample_id": "census_b46237d1-19c6-4af2-9335-9854634bad16_7973"}</code> | <code>Sample contains stem cells (LGR5 stem) derived from the duodeno-jejunal junction of a human fetus at Carnegie stage 23.</code>                                                  | <code>1.0</code> |
  | <code>{"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/EbaoL4ydTqmYwP9/download", "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/X8EFSis4S5ecdse/download", "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/DGxs2PkPeDF2RGm/download", "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/bm3N8RCWePiyJKz/download", "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/8FGZG6EzMeBYxjX/download"}}, "sample_id": "census_b46237d1-19c6-4af2-9335-9854634bad16_7973"}</code> | <code>A 46-year old female's liver sample, specifically conventional dendritic cell type 1 (cDC1s) enriched in CD45+ cell suspension, with no reported liver-related diseases.</code> | <code>0.0</code> |
  | <code>{"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/EbaoL4ydTqmYwP9/download", "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/X8EFSis4S5ecdse/download", "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/DGxs2PkPeDF2RGm/download", "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/bm3N8RCWePiyJKz/download", "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/8FGZG6EzMeBYxjX/download"}}, "sample_id": "census_b46237d1-19c6-4af2-9335-9854634bad16_7973"}</code> | <code>A CD16-negative, CD56-bright natural killer cell sample taken from the spleen of a male in his sixth decade.</code>                                                             | <code>0.0</code> |
* Loss: [<code>ContrastiveLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#contrastiveloss) with these parameters:
  ```json
  {
      "distance_metric": "SiameseDistanceMetric.COSINE_DISTANCE",
      "margin": 0.5,
      "size_average": true
  }
  ```

### Training Hyperparameters
#### Non-Default Hyperparameters

- `eval_strategy`: steps
- `per_device_train_batch_size`: 16
- `per_device_eval_batch_size`: 16
- `learning_rate`: 2e-05
- `num_train_epochs`: 4
- `warmup_ratio`: 0.1

#### All Hyperparameters
<details><summary>Click to expand</summary>

- `overwrite_output_dir`: False
- `do_predict`: False
- `eval_strategy`: steps
- `prediction_loss_only`: True
- `per_device_train_batch_size`: 16
- `per_device_eval_batch_size`: 16
- `per_gpu_train_batch_size`: None
- `per_gpu_eval_batch_size`: None
- `gradient_accumulation_steps`: 1
- `eval_accumulation_steps`: None
- `torch_empty_cache_steps`: None
- `learning_rate`: 2e-05
- `weight_decay`: 0.0
- `adam_beta1`: 0.9
- `adam_beta2`: 0.999
- `adam_epsilon`: 1e-08
- `max_grad_norm`: 1.0
- `num_train_epochs`: 4
- `max_steps`: -1
- `lr_scheduler_type`: linear
- `lr_scheduler_kwargs`: {}
- `warmup_ratio`: 0.1
- `warmup_steps`: 0
- `log_level`: passive
- `log_level_replica`: warning
- `log_on_each_node`: True
- `logging_nan_inf_filter`: True
- `save_safetensors`: True
- `save_on_each_node`: False
- `save_only_model`: False
- `restore_callback_states_from_checkpoint`: False
- `no_cuda`: False
- `use_cpu`: False
- `use_mps_device`: False
- `seed`: 42
- `data_seed`: None
- `jit_mode_eval`: False
- `use_ipex`: False
- `bf16`: False
- `fp16`: False
- `fp16_opt_level`: O1
- `half_precision_backend`: auto
- `bf16_full_eval`: False
- `fp16_full_eval`: False
- `tf32`: None
- `local_rank`: 0
- `ddp_backend`: None
- `tpu_num_cores`: None
- `tpu_metrics_debug`: False
- `debug`: []
- `dataloader_drop_last`: False
- `dataloader_num_workers`: 0
- `dataloader_prefetch_factor`: None
- `past_index`: -1
- `disable_tqdm`: False
- `remove_unused_columns`: True
- `label_names`: None
- `load_best_model_at_end`: False
- `ignore_data_skip`: False
- `fsdp`: []
- `fsdp_min_num_params`: 0
- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
- `fsdp_transformer_layer_cls_to_wrap`: None
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
- `deepspeed`: None
- `label_smoothing_factor`: 0.0
- `optim`: adamw_torch
- `optim_args`: None
- `adafactor`: False
- `group_by_length`: False
- `length_column_name`: length
- `ddp_find_unused_parameters`: None
- `ddp_bucket_cap_mb`: None
- `ddp_broadcast_buffers`: False
- `dataloader_pin_memory`: True
- `dataloader_persistent_workers`: False
- `skip_memory_metrics`: True
- `use_legacy_prediction_loop`: False
- `push_to_hub`: False
- `resume_from_checkpoint`: None
- `hub_model_id`: None
- `hub_strategy`: every_save
- `hub_private_repo`: False
- `hub_always_push`: False
- `gradient_checkpointing`: False
- `gradient_checkpointing_kwargs`: None
- `include_inputs_for_metrics`: False
- `eval_do_concat_batches`: True
- `fp16_backend`: auto
- `push_to_hub_model_id`: None
- `push_to_hub_organization`: None
- `mp_parameters`: 
- `auto_find_batch_size`: False
- `full_determinism`: False
- `torchdynamo`: None
- `ray_scope`: last
- `ddp_timeout`: 1800
- `torch_compile`: False
- `torch_compile_backend`: None
- `torch_compile_mode`: None
- `dispatch_batches`: None
- `split_batches`: None
- `include_tokens_per_second`: False
- `include_num_input_tokens_seen`: False
- `neftune_noise_alpha`: None
- `optim_target_modules`: None
- `batch_eval_metrics`: False
- `eval_on_start`: False
- `eval_use_gather_object`: False
- `prompts`: None
- `batch_sampler`: batch_sampler
- `multi_dataset_batch_sampler`: proportional

</details>

### Training Logs
| Epoch  | Step | Training Loss | Validation Loss | cosine_accuracy | cosine_ap |
|:------:|:----:|:-------------:|:---------------:|:---------------:|:---------:|
| -1     | -1   | -             | -               | 0.5029          | -         |
| 0.5076 | 100  | 6.008         | 9.9084          | 0.5057          | -         |
| 1.0152 | 200  | 4.7386        | 10.5698         | 0.4943          | -         |
| 0.5076 | 100  | 4.3879        | 11.5229         | 0.4943          | -         |
| 1.0152 | 200  | 4.1962        | 11.7110         | 0.5             | -         |
| 1.5228 | 300  | 4.2736        | 12.5341         | 0.4971          | -         |
| 2.0305 | 400  | 4.1793        | 13.1011         | 0.4943          | -         |
| -1     | -1   | -             | -               | -               | 0.3408    |
| 0.1692 | 100  | 0.1614        | 0.3496          | -               | 0.3389    |
| 0.3384 | 200  | 0.1641        | 0.3579          | -               | 0.3390    |
| 0.5076 | 300  | 0.1652        | 0.3592          | -               | 0.3396    |
| 0.6768 | 400  | 0.1672        | 0.3696          | -               | 0.3413    |
| 0.8460 | 500  | 0.1579        | 0.3591          | -               | 0.3417    |
| 1.0152 | 600  | 0.1722        | 0.2388          | -               | 0.3457    |
| 1.1844 | 700  | 0.1553        | 0.3597          | -               | 0.3866    |
| 1.3536 | 800  | 0.1029        | 0.0675          | -               | 0.6485    |
| 1.5228 | 900  | 0.059         | 0.0464          | -               | 0.7094    |
| 1.6920 | 1000 | 0.0446        | 0.0357          | -               | 0.7133    |
| 1.8613 | 1100 | 0.035         | 0.0286          | -               | 0.7571    |
| 2.0305 | 1200 | 0.0304        | 0.0226          | -               | 0.8048    |
| 2.1997 | 1300 | 0.0258        | 0.0293          | -               | 0.7571    |
| 2.3689 | 1400 | 0.0226        | 0.0179          | -               | 0.8204    |
| 2.5381 | 1500 | 0.0207        | 0.0160          | -               | 0.8292    |
| 2.7073 | 1600 | 0.0198        | 0.0166          | -               | 0.8152    |
| 2.8765 | 1700 | 0.0215        | 0.0157          | -               | 0.8430    |
| 3.0457 | 1800 | 0.0183        | 0.0161          | -               | 0.8544    |
| 3.2149 | 1900 | 0.0163        | 0.0138          | -               | 0.8651    |
| 3.3841 | 2000 | 0.0163        | 0.0142          | -               | 0.8696    |
| 3.5533 | 2100 | 0.0159        | 0.0129          | -               | 0.8719    |
| 3.7225 | 2200 | 0.015         | 0.0129          | -               | 0.8773    |
| 3.8917 | 2300 | 0.0157        | 0.0127          | -               | 0.8752    |


### Framework Versions
- Python: 3.11.6
- Sentence Transformers: 3.5.0.dev0
- Transformers: 4.43.4
- PyTorch: 2.6.0
- Accelerate: 0.33.0
- Datasets: 2.14.4
- Tokenizers: 0.19.1

## Citation

### BibTeX

#### Sentence Transformers
```bibtex
@inproceedings{reimers-2019-sentence-bert,
    title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
    author = "Reimers, Nils and Gurevych, Iryna",
    booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
    month = "11",
    year = "2019",
    publisher = "Association for Computational Linguistics",
    url = "https://arxiv.org/abs/1908.10084",
}
```

#### ContrastiveLoss
```bibtex
@inproceedings{hadsell2006dimensionality,
    author={Hadsell, R. and Chopra, S. and LeCun, Y.},
    booktitle={2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR'06)},
    title={Dimensionality Reduction by Learning an Invariant Mapping},
    year={2006},
    volume={2},
    number={},
    pages={1735-1742},
    doi={10.1109/CVPR.2006.100}
}
```

<!--
## Glossary

*Clearly define terms in order to be accessible across audiences.*
-->

<!--
## Model Card Authors

*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->

<!--
## Model Card Contact

*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->