A Machine Learning and Natural Language Processing (NLP) based system that predicts personality traits from textual input using the Big Five Personality Model.
This project analyzes textual data and predicts personality traits automatically using NLP and Machine Learning techniques. The system processes user input text, extracts meaningful linguistic features, and classifies personality traits based on the Big Five Personality Model:
- Openness (OPN)
- Conscientiousness (CON)
- Extraversion (EXT)
- Agreeableness (AGR)
- Neuroticism (NEU)
The project demonstrates the practical application of text preprocessing, feature extraction, supervised learning, and personality analysis using Python.
-
Text preprocessing using NLP techniques
-
TF-IDF feature extraction
-
Personality prediction using Machine Learning
-
Multiple classification models:
- Logistic Regression
- Random Forest
- XGBoost
-
Separate prediction models for each personality trait
-
Model training and evaluation pipeline
-
Prediction on unseen user text input
- Python
- Pandas
- NumPy
- Scikit-learn
- NLTK
- spaCy
- Joblib
- XGBoost
- Tokenization
- Stopword Removal
- Lemmatization
- TF-IDF Vectorization
TextPersonalityPrediction/
│
├── data/
│ ├── data-final.csv
│ └── mypersonality_sample.csv
│
├── src/
│ ├── preprocess.py
│ ├── feature_engineering.py
│ ├── train_models.py
│ └── predict.py
│
├── models/
│
├── results/
│
├── convert_dataset.py
├── main.py
└── README.md
git clone https://github.com/your-username/TextPersonalityPrediction.git
cd TextPersonalityPredictionpip install pandas numpy scikit-learn nltk spacy xgboost joblibpython -m spacy download en_core_web_smimport nltk
nltk.download('punkt')
nltk.download('punkt_tab')
nltk.download('stopwords')The project uses the Big Five Personality Dataset (data-final.csv).
The dataset contains personality-related responses which are converted into text-based representations for NLP processing.
For faster training and testing, a subset of the dataset can be sampled during preprocessing.
- Dataset preprocessing
- Text cleaning and normalization
- TF-IDF feature extraction
- Train-test split
- Model training
- Model evaluation
- Personality prediction
The following algorithms were used:
- Logistic Regression
- Random Forest Classifier
- XGBoost Classifier
Each personality trait is treated as a separate binary classification problem.
python convert_dataset.pypython main.pyChoose:
1. Train Models
Run again:
python main.pyChoose:
2. Predict Personality
Enter custom text input for prediction.
The system uses:
- Accuracy Score
- Precision
- Recall
- F1-Score
- Confusion Matrix
for evaluating model performance.
I enjoy meeting new people and exploring new ideas.
OPN: High
CON: Medium
EXT: High
AGR: High
NEU: Low
- Transformer-based personality prediction using BERT
- Deep learning implementation (LSTM)
- Real-time GUI/Desktop application
- Social media integration
- Multilingual personality prediction
This project helped in understanding:
- Natural Language Processing
- Text Vectorization
- Machine Learning Pipelines
- Personality Prediction Systems
- Model Evaluation Techniques
- Real-world NLP workflows
Kailash NP
Project: Text-Based Personality Prediction using NLP and Machine Learning.