---
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:10000
- loss:ContrastiveLoss
base_model: DeepChem/ChemBERTa-77M-MLM
widget:
- source_sentence: CC(C)N=c1cc2n(-c3ccc(Cl)cc3)c3ccccc3nc-2cc1Nc1ccc(Cl)cc1
sentences:
- C[NH+]1CCC(=C2c3ccccc3CCn3c(C=O)c[nH+]c32)CC1
- COc1ccc(C(=O)CC(=O)c2ccc(C(C)(C)C)cc2)cc1
- CC1CNc2c(cccc2S(=O)(=O)NC(CCC[NH+]=C(N)N)C(=O)N2CCC(C)CC2C(=O)[O-])C1
- source_sentence: CC(C)c1ccc2oc3nc(N)c(C(=O)[O-])cc3c(=O)c2c1
sentences:
- COC1=CC(=O)CC(C)C12Oc1c(Cl)c(OC)cc(OC)c1C2=O
- CON=C(C(=O)NC1C(=O)N2C(C(=O)[O-])=C(C[N+]3(C)CCCC3)CSC12)c1csc(N)n1
- CC1C=CC=CC=CC=CC=CC=CC=CC(OC2OC(C)C(O)C([NH3+])C2O)CC2OC(O)(CC(O)CC(O)C(O)CCC(O)CC(O)CC(=O)OC(C)C(C)C1O)CC(O)C2C(=O)[O-]
- source_sentence: C[NH2+]C1CCc2[nH]c3ccc(C(N)=O)cc3c2C1
sentences:
- CC(OC(=O)c1ccccc1)C1=CCC23OCC[NH+](C)CC12CC(O)C12OC4(O)CCC1(C)C(CC=C32)C4
- CC(=O)NC(Cc1ccc2ccccc2c1)C(=O)NC(Cc1ccc(Cl)cc1)C(=O)NC(Cc1cccnc1)C(=O)NC(CO)C(=O)NC(Cc1ccc(NC(=O)C2CC(=O)NC(=O)N2)cc1)C(=O)NC(Cc1ccc(NC(N)=O)cc1)C(=O)NC(CC(C)C)C(=O)NC(CCCC[NH2+]C(C)C)C(=O)N1CCCC1C(=O)NC(C)C(N)=O
- C[NH+](C)CCOC(=O)C(c1ccccc1)C1(O)CCCC1
- source_sentence: CC(C)n1c(C=CC(O)CC(O)CC(=O)[O-])c(-c2ccc(F)cc2)c2ccccc21
sentences:
- C#CC1(O)CCC2C3CCC4=C(CCC(=O)C4)C3CCC21C
- CC(C=CC(C)C(C)(C)O)C1CCC2C(=CC=C3CC(O)CC(O)C3)CCCC21C
- CC(C)CNCc1ccc(-c2ccccc2S(=O)(=O)N2CCCC2)cc1
- source_sentence: CC#CCn1c(N2CCCC([NH3+])C2)nc2c1c(=O)n(Cc1nc(C)c3ccccc3n1)c(=O)n2C
sentences:
- C[N+]1(C)CCCC(OC(=O)C(O)(c2ccccc2)c2ccccc2)C1
- CC(Cc1ccc(O)c(O)c1)C(C)Cc1ccc(O)c(O)c1
- CC12CCC(=O)C=C1CCC1C2C(O)CC2(C)C1CCC2(O)C(=O)COC(=O)CCC1CCCC1
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
model-index:
- name: SentenceTransformer based on DeepChem/ChemBERTa-77M-MLM
results:
- task:
type: binary-classification
name: Binary Classification
dataset:
name: all dev
type: all-dev
metrics:
- type: cosine_accuracy
value: 0.9066
name: Cosine Accuracy
- type: cosine_accuracy_threshold
value: 0.5664876699447632
name: Cosine Accuracy Threshold
- type: cosine_f1
value: 0.9510122731564041
name: Cosine F1
- type: cosine_f1_threshold
value: 0.5664876699447632
name: Cosine F1 Threshold
- type: cosine_precision
value: 0.9067813562712542
name: Cosine Precision
- type: cosine_recall
value: 0.9997794441993825
name: Cosine Recall
- type: cosine_ap
value: 0.9523113003188102
name: Cosine Ap
---
# SentenceTransformer based on DeepChem/ChemBERTa-77M-MLM
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [DeepChem/ChemBERTa-77M-MLM](https://huggingface.co/DeepChem/ChemBERTa-77M-MLM). It maps sentences & paragraphs to a 384-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:** [DeepChem/ChemBERTa-77M-MLM](https://huggingface.co/DeepChem/ChemBERTa-77M-MLM)
- **Maximum Sequence Length:** 512 tokens
- **Output Dimensionality:** 384 dimensions
- **Similarity Function:** Cosine Similarity
### 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): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: RobertaModel
(1): Pooling({'word_embedding_dimension': 384, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': 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("HassanCS/chemBERTa-tuned-on-ClinTox-3")
# Run inference
sentences = [
'CC#CCn1c(N2CCCC([NH3+])C2)nc2c1c(=O)n(Cc1nc(C)c3ccccc3n1)c(=O)n2C',
'CC12CCC(=O)C=C1CCC1C2C(O)CC2(C)C1CCC2(O)C(=O)COC(=O)CCC1CCCC1',
'CC(Cc1ccc(O)c(O)c1)C(C)Cc1ccc(O)c(O)c1',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
```
## Evaluation
### Metrics
#### Binary Classification
* Dataset: `all-dev`
* Evaluated with [BinaryClassificationEvaluator
](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.BinaryClassificationEvaluator)
| Metric | Value |
|:--------------------------|:-----------|
| cosine_accuracy | 0.9066 |
| cosine_accuracy_threshold | 0.5665 |
| cosine_f1 | 0.951 |
| cosine_f1_threshold | 0.5665 |
| cosine_precision | 0.9068 |
| cosine_recall | 0.9998 |
| **cosine_ap** | **0.9523** |
## Training Details
### Training Dataset
#### Unnamed Dataset
* Size: 10,000 training samples
* Columns: smiles1
, smiles2
, and label
* Approximate statistics based on the first 1000 samples:
| | smiles1 | smiles2 | label |
|:--------|:-----------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|:------------------------------------------------|
| type | string | string | int |
| details |
Cn1c(=O)c2c(ncn2C)n(C)c1=O
| Cc1cc2c(s1)=Nc1ccccc1NC=2N1CC[NH+](C)CC1
| 1
|
| Oc1ccc(OCc2ccccc2)cc1
| Oc1ccc(CCCC[NH2+]CC(O)c2ccc(O)c(O)c2)cc1
| 1
|
| OCC(S)CS
| CC12CCC(=O)C=C1CCC1C2C(O)CC2(C)C1CCC2(O)C(=O)CO
| 0
|
* Loss: [ContrastiveLoss
](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
#### Unnamed Dataset
* Size: 5,000 evaluation samples
* Columns: smiles1
, smiles2
, and label
* Approximate statistics based on the first 1000 samples:
| | smiles1 | smiles2 | label |
|:--------|:------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:------------------------------------------------|
| type | string | string | int |
| details | CC(=CC(=O)OCCCCCCCCC(=O)[O-])CC1OCC(CC2OC2C(C)C(C)O)C(O)C1O
| CC(C=CC(C)C(C)(C)O)C1CCC2C(=CC=C3CC(O)CC(O)C3)CCCC21C
| 1
|
| C=C1c2cccc([O-])c2C(=O)C2=C([O-])C3(O)C(=O)C(C(N)=O)=C([O-])C([NH+](C)C)C3C(O)C12
| CC(c1ncncc1F)C(O)(Cn1cncn1)c1ccc(F)cc1F
| 1
|
| CC(C)CC1C(=O)N2CCCC2C2(O)OC(NC(=O)C3C=C4c5cccc6[nH]c(Br)c(c56)CC4[NH+](C)C3)(C(C)C)C(=O)N12
| C[NH+](C)CCC=C1c2ccccc2Sc2ccc(Cl)cc21
| 1
|
* Loss: [ContrastiveLoss
](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`: 5
- `warmup_ratio`: 0.1
- `fp16`: True
- `batch_sampler`: no_duplicates
#### All Hyperparameters