Statsmodels is a Python module that provides classes and functions for the estimation of many different statistical models, as well as for conducting statistical tests, and statistical data exploration. An extensive list of result statistics are available for each estimator. The results are tested against existing statistical packages to ensure that they are correct. The package is released under the open source Modified BSD (3-clause) license. The online documentation is hosted at statsmodels.org.
For many reasons,my enterprise applications maybe devedeveloped by php, java, etc.,it is not convenient to use statsmodels, so I create a json interface in web json fro statsmodels,which is convenient using in my enterprise applications.
It is only necessary to submit the parameter data according to the interface parameters corresponding to different statistical models, and the various results of the statsmodels model can be returned by json.The statemodels results in json can be obtained by submitting parameters according to the interface parameters of the statesmodels.
Flask 0.12.2
mod-wsgi 4.5.24+ap24vc14
numpy 1.13.1
pandas 0.20.3
scipy 1.1.0
statsmodels 0.8.0
$ virtualenv py36 --python=python3
$ source py36/bin/activate
pip install flask numpy pandas statsmodels scipy uwsgi
uwsgi.ini
[uwsgi]
socket=0.0.0.0:5001
http=0.0.0.0:5000
chdir=/home/lbw/apis
wsgi-file=/home/lbw/apis/wsgi.py
processes=4
threads=2
master=true
buffer-size = 88192
pidfile=uwsgi.pid
daemonzie=uwsgi.log
~
wsgi.py
In you environment(python3.6)
In devedeveloped environment
$ python manage.py
or in product environment
$ uwsgi --ini uwsgi.ini
try to open http://192.168.56.102:5000/apis_test
Return json like
Please visit https://www.statsmodels.org/dev/generated/statsmodels.regression.linear_model.OLS.html#statsmodels.regression.linear_model.OLS for json detail