jeff1evesque / machine-learning

Web-interface + rest API for classification and regression (https://jeff1evesque.github.io/machine-learning.docs)
Other
257 stars 85 forks source link

Resolve unit test traceback for programmatic interface #2557

Closed jeff1evesque closed 8 years ago

jeff1evesque commented 8 years ago

We need to resolve the following error traceback, generated via our unit tests from pytest_session.py:

vagrant@vagrant-ubuntu-trusty-64:/vagrant/test$ py.test
============================= test session starts ==============================

platform linux2 -- Python 2.7.6, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
rootdir: /vagrant/test, inifile: pytest.ini
collected 4 items

programmatic_interface/pytest_session.py FFFF

=================================== FAILURES ===================================

________________________________ check_data_new ________________________________

    def check_data_new():
        """@check_data_new

        This method tests the 'data_new' session.

        """

>       assert requests.post(
            endpoint_url,
            headers=headers,
            data=get_sample_json('svm-data-new.json')
        )
E       assert <Response [500]>
E        +  where <Response [500]> = <function post at 0x7fcc76988de8>('http://l
ocalhost:5000/load-data/', headers={'Content-Type': 'application/json'}, data='{
"properties": {"session": "data_new", "dataset_type": "json_string", "title": "s
ample_title"}, "dataset": {"dep-vari...": 427, "indep-variable-5": 75.45, "indep
-variable-2": 101.21, "indep-variable-3": 0.832, "indep-variable-1": 22.67}}}')
E        +    where <function post at 0x7fcc76988de8> = requests.post
E        +    and   '{"properties": {"session": "data_new", "dataset_type": "jso
n_string", "title": "sample_title"}, "dataset": {"dep-vari...": 427, "indep-vari
able-5": 75.45, "indep-variable-2": 101.21, "indep-variable-3": 0.832, "indep-va
riable-1": 22.67}}}' = get_sample_json('svm-data-new.json')

programmatic_interface/pytest_session.py:69: AssertionError
______________________________ check_data_append _______________________________

    def check_data_append():
        """@check_data_append

        This method tests the 'data_append' session.

        """

>       assert requests.post(
            endpoint_url,
            headers=headers,
            data=get_sample_json('svm-data-append.json')
        )
E       assert <Response [500]>
E        +  where <Response [500]> = <function post at 0x7fcc76988de8>('http://l
ocalhost:5000/load-data/', headers={'Content-Type': 'application/json'}, data='{
"properties": {"session": "data_append", "dataset_type": "json_string", "session
_id": "1", "title": "sample_title"},...": 235, "indep-variable-5": 64.45, "indep
-variable-2": 92.22, "indep-variable-3": 0.356, "indep-variable-1": 24.32}]}}')
E        +    where <function post at 0x7fcc76988de8> = requests.post
E        +    and   '{"properties": {"session": "data_append", "dataset_type": "
json_string", "session_id": "1", "title": "sample_title"},...": 235, "indep-vari
able-5": 64.45, "indep-variable-2": 92.22, "indep-variable-3": 0.356, "indep-var
iable-1": 24.32}]}}' = get_sample_json('svm-data-append.json')

programmatic_interface/pytest_session.py:83: AssertionError
_____________________________ check_model_generate _____________________________

    def check_model_generate():
        """@check_model_generate

        This method tests the 'model_generate' session.

        """

>       assert requests.post(
            endpoint_url,
            headers=headers,
            data=get_sample_json('svm-model-generate.json')
        )
E       assert <Response [500]>
E        +  where <Response [500]> = <function post at 0x7fcc76988de8>('http://l
ocalhost:5000/load-data/', headers={'Content-Type': 'application/json'}, data='{
"properties": {"model_type": "classification", "session": "model_generate", "sv_
kernel_type": "rbf", "session_id": "1"}}')
E        +    where <function post at 0x7fcc76988de8> = requests.post
E        +    and   '{"properties": {"model_type": "classification", "session":
"model_generate", "sv_kernel_type": "rbf", "session_id": "1"}}' = get_sample_jso
n('svm-model-generate.json')

programmatic_interface/pytest_session.py:97: AssertionError
_____________________________ check_model_predict ______________________________

    def check_model_predict():
        """@check_model_predict

        This method tests the 'model_predict' session.

        """

>       assert requests.post(
            endpoint_url,
            headers=headers,
            data=get_sample_json('svm-model-predict.json')
        )
E       assert <Response [500]>
E        +  where <Response [500]> = <function post at 0x7fcc76988de8>('http://l
ocalhost:5000/load-data/', headers={'Content-Type': 'application/json'}, data='{
"properties": {"model_id": "1", "session": "model_predict", "prediction_input[]"
: ["22.22", "96.24", "338", "72.55", "0.001", "28", "0.678"]}}')
E        +    where <function post at 0x7fcc76988de8> = requests.post
E        +    and   '{"properties": {"model_id": "1", "session": "model_predict"
, "prediction_input[]": ["22.22", "96.24", "338", "72.55", "0.001", "28", "0.678
"]}}' = get_sample_json('svm-model-predict.json')

programmatic_interface/pytest_session.py:111: AssertionError
=========================== 4 failed in 0.44 seconds ===========================
jeff1evesque commented 8 years ago

Our error traceback has been reduced to the following:

vagrant@vagrant-ubuntu-trusty-64:/vagrant/test$ py.test
============================= test session starts ==============================

platform linux2 -- Python 2.7.6, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
rootdir: /vagrant/test, inifile: pytest.ini
collected 4 items

programmatic_interface/pytest_session.py ..FF

=================================== FAILURES ===================================

_____________________________ check_model_generate _____________________________

    def check_model_generate():
        """@check_model_generate

        This method tests the 'model_generate' session.

        """

>       assert requests.post(
            endpoint_url,
            headers=headers,
            data=get_sample_json('svm-model-generate.json')
        )
E       assert <Response [500]>
E        +  where <Response [500]> = <function post at 0x7f3e2b168de8>('http://l
ocalhost:5000/load-data/', headers={'Content-Type': 'application/json'}, data='{
"properties": {"model_type": "classification", "sv_kernel_type": "rbf", "session
_id": "1", "session_type": "model_generate"}}')
E        +    where <function post at 0x7f3e2b168de8> = requests.post
E        +    and   '{"properties": {"model_type": "classification", "sv_kernel_
type": "rbf", "session_id": "1", "session_type": "model_generate"}}' = get_sampl
e_json('svm-model-generate.json')

programmatic_interface/pytest_session.py:97: AssertionError
_____________________________ check_model_predict ______________________________

    def check_model_predict():
        """@check_model_predict

        This method tests the 'model_predict' session.

        """

>       assert requests.post(
            endpoint_url,
            headers=headers,
            data=get_sample_json('svm-model-predict.json')
        )
E       assert <Response [500]>
E        +  where <Response [500]> = <function post at 0x7f3e2b168de8>('http://l
ocalhost:5000/load-data/', headers={'Content-Type': 'application/json'}, data='{
"properties": {"model_id": "1", "prediction_input[]": ["22.22", "96.24", "338",
"72.55", "0.001", "28", "0.678"], "session_type": "model_predict"}}')
E        +    where <function post at 0x7f3e2b168de8> = requests.post
E        +    and   '{"properties": {"model_id": "1", "prediction_input[]": ["22
.22", "96.24", "338", "72.55", "0.001", "28", "0.678"], "session_type": "model_p
redict"}}' = get_sample_json('svm-model-predict.json')

programmatic_interface/pytest_session.py:111: AssertionError
====================== 2 failed, 2 passed in 1.59 seconds ======================
jeff1evesque commented 8 years ago

Currently, no feature_count is being stored into the tbl_feature_count sql table, during a programmatic implementation for the new dataset, or append dataset session. Several possibilities include: