Edit model card

Model Card for Model ID

Charles Dickens Text Classifier

This model is a text classification model fine-tuned on a dataset designed to distinguish between paragraphs written by Charles Dickens and those that imitate his style. The model uses distilbert-base-uncased as the base model and has been fine-tuned on 1,100 samples with 100 positive and 1,000 negative examples, achieving an accuracy of 99.5%.

Model Details

Model Description

This is a text classification model developed to classify text as either written by Charles Dickens or generated in different styles. It is built using the distilbert-base-uncased model from the Hugging Face Transformers library and fine-tuned on a dataset specifically designed for this task.

  • Developed by: Independent ML Engineer
  • Model type: Text Classification
  • Language(s) (NLP): English (en)
  • License: Apache-2.0
  • Finetuned from model: distilbert/distilbert-base-uncased

Model Sources

Uses

Direct Use

This model can be directly used for distinguishing between authentic Charles Dickens texts and texts generated in various imitative styles. It can be used for literary analysis, text style transfer evaluation, and educational purposes.

Out-of-Scope Use

This model is not suitable for general text classification tasks outside of the scope of identifying Charles Dickens' writing style. Misuse of the model might include applying it to texts outside of the intended use case or in a context where the stylistic nuances of Dickens' writing are not relevant.

Bias, Risks, and Limitations

The model may have biases related to the synthetic nature of the negative examples, which might not fully capture the diversity of non-Dickensian writing styles. The dataset is based only on "Great Expectations" and might not generalize well to other works by Dickens or other authors.

Recommendations

Users should be aware of the synthetic nature of the negative samples, which might limit the model's generalizability. It is recommended to expand the dataset to include more works by Dickens for a more robust classification.

How to Get Started with the Model

To use this model, load it using the Hugging Face Transformers library:

from transformers import pipeline

classifier = pipeline("text-classification", model="GuillermoTBB/charles-dickens-classifier", tokenizer="GuillermoTBB/charles-dickens-classifier")

text = "Your text here..."
result = classifier(text)
print(result)

An example to use this model can be found in this colab used to validate different methods to transfer text style.

Training Details

Training Data

The model was trained on a dataset composed of 1,100 paragraphs, where 100 were original excerpts from "Great Expectations" by Charles Dickens and 1,000 were synthetic examples generated by rewriting the Dickensian paragraphs in 10 distinct styles using GPT-4. Dataset can be found HF GuillermoTBB/charles-dickens-text-classification

Training Procedure

The model was fine-tuned using the following hyperparameters:

  • Training regime: Mixed precision (fp16) on a single T4 GPU
  • Learning rate: 2e-5
  • Batch size: 16
  • Epochs: 2
  • Optimizer: AdamW
  • Weight decay: 0.01

Evaluation

Testing Data, Factors & Metrics

Testing Data

The test set consisted of 220 samples, stratified to maintain a balanced class distribution.

Metrics

The primary evaluation metric was accuracy, which is ideal for binary classification tasks. The model achieved a test accuracy of 99.5%.

Results

The model performed exceptionally well on the test set with an accuracy of 99.5%, demonstrating its effectiveness in distinguishing between Dickensian and non-Dickensian text.

Technical Specifications

Model Architecture and Objective

The model is based on the distilbert-base-uncased architecture, fine-tuned to perform binary text classification.

Compute Infrastructure

  • Hardware: Google Colab with a T4 GPU
  • Software: Python 3.7, PyTorch 1.7, Hugging Face Transformers 4.5

Citation

Please cite the following if you use this model:

BibTeX:

@misc{guillermo2024charlesdickens,
  title={Charles Dickens Text Classifier},
  author={Guillermo Blasco},
  year={2024},
  howpublished={\url{https://huggingface.co/GuillermoTBB/charles-dickens-classifier}},
}

**APA:**

Blasco, G. (2024). Charles Dickens Text Classifier. Retrieved from https://huggingface.co/GuillermoTBB/charles-dickens-classifier.

## Model Card Authors

- Guillermo Blasco, Independent ML Engineer
Downloads last month
5
Safetensors
Model size
67M params
Tensor type
F32
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for GuillermoTBB/charles-dickens-classifier

Finetuned
(6101)
this model

Dataset used to train GuillermoTBB/charles-dickens-classifier