Coder Social home page Coder Social logo

theknight909 / emotional-analysis Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 24.61 MB

Emotion Prediction in Arabic Text

Home Page: https://fine-tuned-fjzhglbv2a-uc.a.run.app/

Jupyter Notebook 97.55% Dockerfile 0.09% Python 2.36%
arabert arabic arabic-language arabic-nlp bert-fine-tuning chatgpt-api gemini-api machine-learning nlp

emotional-analysis's Introduction

Emotion Prediction in Arabic Text

This repository contains the implementation of an emotion analysis model that predicts emotions from Arabic text. It leverages advanced machine learning techniques and NLP models like Arabert, Marabert, Gemini, and ChatGPT.

Features

  • Preprocessing of Arabic text data.
  • Use of TF-IDF, BM-25, and Word2Vec for text vectorization.
  • Integration of transfer learning models Arabert and Marabert.
  • Emotion prediction using machine learning algorithms including KNN, SVM, and Random Forest.
  • Utilization of generative AI models, such as Gemini and ChatGPT, to enhance emotion prediction capabilities.

Getting Started

Prerequisites

  • Python 3.x
  • pandas
  • numpy
  • scikit-learn
  • matplotlib
  • seaborn
  • nltk
  • regex
  • pyarabic
  • emoji
  • arabicstopwords

Installation

Clone the repository to your local machine:

git clone https://github.com/your-repo/emotion-prediction.git cd emotion-prediction

Install the required packages:

pip install -r requirements.txt

Usage

Load the data and run the main script:

import pandas as pd

Load your data

df = pd.read_csv('your-data.csv')

Assuming you have a function setup to preprocess and predict

from your_module import preprocess_data, predict_emotions

Preprocess data

preprocessed_data = preprocess_data(df)

Predict emotions

predicted_emotions = predict_emotions(preprocessed_data)

Models and Performance

Word Representation and Algorithms Performance

Word Representation Algorithm Accuracy Precision (weighted avg) Recall (weighted avg) f1-score (weighted avg)
TF-IDF KNN 0.88 0.89 0.88 0.88
Random Forest 0.88 0.89 0.88 0.88
SVM 0.89 0.90 0.89 0.89
BM-25 KNN 0.81 0.84 0.81 0.82
Random Forest 0.82 0.83 0.82 0.82
SVM 0.70 0.77 0.70 0.70
Word2Vec KNN 0.69 0.73 0.69 0.71
Random Forest 0.77 0.79 0.77 0.78
SVM 0.50 0.57 0.50 0.49

Transfer Learning Model Performance

Model Training Loss Validation Loss Accuracy Roc Auc f1-score (weighted avg)
UBC-NLP/MARBERTv2 0.08 0.25 0.66 0.90 0.83
CAMeL-Lab/bert-base-arabic-camelbert-mix 0.09 0.24 0.64 0.89 0.82
aubmindlab/bert-base-arabertv2 0.14 0.25 0.61 0.87 0.80
Bert After Translation 0.09 0.23 0.59 0.87 0.79

Generative AI Performance

Model Accuracy ROC AUC Precision Recall f1-score (weighted avg)
ChatGPT 3.5-turbo 0.66 0.79 0.76 0.66 0.68
Gemini 1.5 Pro 0.67 0.79 0.73 0.67 0.69

Contributing

Contributions to this project are welcome! Please fork the repository and submit pull requests with your proposed changes.

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgments

  • Arabert and Marabert teams for providing pre-trained models.
  • OpenAI for the ChatGPT model.
  • Google for the Gemini model.

emotional-analysis's People

Contributors

faris35 avatar theknight909 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.