This manual mode where you can test this predicition model with runtime names.
def model_evaluation(classifier):
print('<<< Testing Module >>> ')
print('Enter "q" or "quit" to end testing module')
while 1:
test_name = input('\n Enter name to classify: ')
if test_name.lower() == 'q' or test_name.lower() == 'quit':
print('End')
exit(1)
if not test_name:
continue
result = classifier.classify(extract_feature(test_name))
if gender_map[result.upper()]:
result = 'Female'
else:
result = 'Male'
print('{} is classified as {}'.format(test_name, result))
The final output window - We able to acheive accuracy around 97% (close). By choosing more efficient features we can improve the accuracy level further.
Dataset Overview.
Total names - 96223
Total males names - 35323
Total female names - 60900
Feature matrix shape - (96223, 7)
Naive Bayes Accuracy- 0.9688230709275136
Most informative features
last_3 = LIA
last_3 = INA
last_3 = RAH
last_3 = SHA
last_3 = SIA
<<< Testing Module >>>
Enter "q" or "quit" to end testing module
Enter name to classify: Vijay
Vijay is classified as Male
Enter name to classify: Umaa
Umaa is classified as Female
Enter name to classify: Kala
Kala is classified as Female
Enter name to classify: Ashok
Ashok is classified as Male
Enter name to classify: John
John is classified as Male
Enter name to classify: Vimlesh
Vimlesh is classified as Male