This program checks if an investment scheme looks like a Ponzi. It uses NLP to pull features out of the text, scores the risk using a small neural network, and classifies the result using a random forest. Output is one of: Ponzi, Likely Ponzi, or Not Ponzi.
| File/Folder | Description |
|---|---|
train.py | Main script for training or running inference on one scheme. |
models/ | Contains the Keras return risk model and scaler. |
data/ | Text samples labeled as Ponzi, Likely, or Not Ponzi. |
ponzi_scheme_classifier.pkl | Trained random forest saved after training. |
git clone https://github.com/Vijay-31-08-2005/ponzi-scheme-detection.git
cd ponzi-scheme-detection
pip install -r requirements.txt
python -m spacy download en_core_web_sm
import nltk
nltk.download('vader_lexicon')
[.txt scheme file or form input]
↓
parse_scheme_text()
- Named Entity Recognition (spaCy)
- Question Answering (HuggingFace)
- Heuristics + Regex
- Sentiment Analysis (VADER)
- Semantic Scam Score (Sentence-BERT)
↓
Extracted Features:
- company_name
- promised_return_percent
- return_frequency_days
- time_to_roi_days
- minimum_deposit_usd
- referral_pressure
- whitepaper_available
- team_members
- sentiment_score
- scam_keyword_density
- crypto_only
↓
calculate_return_risk()
- Uses 4 ROI stats
- Keras model outputs risk_score ∈ [0, 1]
↓
Random Forest Classifier
- Input: all features + risk_score
- Output:
- classification (Ponzi / Likely / Not)
- class probabilities
python models/return_risk.py
This trains on return_risk_training_data.csv and saves:
tf_return_risk_model.kerastf_return_risk_scaler.pklpython train.py
Loads all .txt files from data/, extracts features, scores them, and fits the Random Forest classifier.
python run.py
Then go to http://127.0.0.1:5000
python train.py path/to/scheme.txt
Skyline Development Fund pays a stable 4.5% monthly return, with capital doubled in just under 500 days. Minimum investment: $10,000. Our whitepaper outlines our urban development strategy, with detailed insights into our projects. Founders: Olivia Greene (Real Estate Director), Samuel Adams (Finance Manager). Investments are backed by prime real estate developments in growing metropolitan areas. Fully compliant with local regulations. No referral programs. Fiat and stablecoin payments accepted. Track your investment growth through our investor portal.
Parameters:
company_name: Skyline Development Fund
promised_return_percent: 4.0
return_frequency_days: 30
time_to_roi_days: 500
minimum_deposit_usd: 10000
referral_pressure: 1
whitepaper_available: 1
team_members: 1
sentiment_score: 0.6705
scam_keyword_density: 0.0
crypto_only: 0
Risk Score: 0.027123991
Classification: Not Ponzi
Probabilities:
Not Ponzi: 0.0472
Likely Ponzi: 0.9459
Ponzi: 0.0068
Comments