Quick Start¶
This guide will get you up and running with pranaam in just a few minutes.
Basic Usage¶
The main function in pranaam is pred_rel, which predicts religion based on names.
Single Name Prediction¶
import pranaam
# Predict for a single name
result = pranaam.pred_rel("Shah Rukh Khan")
print(result)
Output:
name pred_label pred_prob_muslim
0 Shah Rukh Khan muslim 73.0
Multiple Names (English)¶
import pranaam
# List of English names
names = ["Shah Rukh Khan", "Amitabh Bachchan", "Abdul Kalam"]
result = pranaam.pred_rel(names, lang="eng")
print(result)
Output:
name pred_label pred_prob_muslim
0 Shah Rukh Khan muslim 73.0
1 Amitabh Bachchan not-muslim 27.0
2 Abdul Kalam muslim 85.5
Hindi Names¶
import pranaam
# Hindi names
hindi_names = ["शाहरुख खान", "अमिताभ बच्चन"]
result = pranaam.pred_rel(hindi_names, lang="hin")
print(result)
Output:
name pred_label pred_prob_muslim
0 शाहरुख खान muslim 73.0
1 अमिताभ बच्चन not-muslim 27.0
Working with Pandas¶
import pandas as pd
import pranaam
# Create a DataFrame with names
df = pd.DataFrame({
'names': ['Shah Rukh Khan', 'Amitabh Bachchan', 'A.P.J. Abdul Kalam'],
'profession': ['Actor', 'Actor', 'Scientist']
})
# Predict religion for the names column
predictions = pranaam.pred_rel(df['names'], lang="eng")
# Merge with original data
result = pd.concat([df, predictions[['pred_label', 'pred_prob_muslim']]], axis=1)
print(result)
Command Line Interface¶
You can also use pranaam from the command line:
# Single name prediction
predict_religion --input "Shah Rukh Khan" --lang eng
# Hindi name prediction
predict_religion --input "शाहरुख खान" --lang hin
Understanding the Output¶
The function returns a pandas DataFrame with these columns:
name: The input name
pred_label: Predicted religion (‘muslim’ or ‘not-muslim’)
pred_prob_muslim: Probability score (0-100) that the person is Muslim
Accuracy and Limitations¶
High Accuracy: 98% accuracy on unseen names for both Hindi and English models
Binary Classification: Currently predicts Muslim vs. not-Muslim only
Training Data: Based on Bihar Land Records (4M+ unique records)
Context: Nearly 95% of India’s population are Hindu or Muslim
Next Steps¶
Check out the API Reference for detailed function documentation
See Examples for more advanced usage patterns
Learn about the training data in our notebooks