--- {} --- # BERT Text Classification This is a BERT-based text classification model trained on the "socialmedia-disaster-tweets" dataset. It performs sentiment analysis to classify tweets as "Relevant" or "Not Relevant" to a disaster event. ## Model Description The model uses the BERT (Bidirectional Encoder Representations from Transformers) architecture to generate embeddings for the input text. These embeddings are then fed into a sequential Keras model with a dense hidden layer and a sigmoid output layer for binary classification. ## Intended Use This model is intended to be used for text classification on short text snippets, specifically tweets related to disaster events. It can help in identifying relevant tweets for further analysis and response. ## Limitations and Ethical Considerations - The model's performance heavily relies on the quality and representativeness of the training data. If the training data is biased or limited, the model's predictions may be biased or inaccurate. - The model may not generalize well to tweets from domains or topics that significantly differ from the training data. - Text classification models may not capture the full complexity of human sentiment and can be sensitive to variations in language use. - It's important to use the model as a tool to aid human decision-making rather than relying solely on its predictions. Human review and context awareness are essential in interpreting and acting upon the model's output. ## Usage Here's an example of how to use the model for inference: ```python from transformers import TFAutoModel, AutoTokenizer import tensorflow as tf import numpy as np # Load the pre-trained model and tokenizer model = TFAutoModel.from_pretrained("dnzblgn/BERT_Text_Classification") tokenizer = AutoTokenizer.from_pretrained("dnzblgn/BERT_Text_Classification") # Preprocess the input sentence input_sentence = " Horrible Accident | Man Died In Wings of AirplaneåÊ(29-07-2015)" input_sentence = tokenizer.encode_plus( input_sentence, add_special_tokens=True, max_length=768, padding="longest", truncation=True, return_attention_mask=True, return_tensors="tf", ) # Make the prediction prediction = model.predict(input_sentence)[0][0] label = "Relevant" if prediction == 0 else "Not Relevant" print("Input Sentence:", input_sentence) print("Prediction:", label)