Maximum entropy (MaxEnt) classifier in Python with CPython extension.
Note:only test in Python 2.7 and on Ubuntu 16.04.
- wikipedia MaxEnt on Wikipedia
for CPython,you must install python-dev on Linux System,such as Ubuntu.
To install entroPy, cd
to the entroPy folder and run the install command:
sudo python setup.py install
from entroPy import MaxEntClassify
me=MaxEntClassify()
me.append(single_data_feats,single_data_label)
ret=me.train(L2=1)
me.saveModel(model_name)
me.loadModel(model_name)
re=me.classify(single_data_feats)
see: example_titanic.py
data: Titanic on Kaggle.
after prepared the data,to run the example:
python example_titanic.py
trained on train.csv,tested on test.csv and gendermodel.csv, the final accuracy was 82.30%(features chosen arbitrarily).