This video shows you how to create a very simple Python Flask web application front end to call a deployed Logistic Regression model in real time.

14 comments on"Build a Logistic Regression Model With Watson Machine Learning"

  1. Viral Ruparel May 31, 2018

    not getting api results in notes after giving the credentials.

  2. VidhyaSivakumar December 31, 2018

    # Call scoring endpoint with data payload

    scoring_header = {‘Content-Type’: ‘application/json’, ‘Authorization’: mltoken}

    payload = {“fields”: [“GENDER”,”AGE”,”MARITAL_STATUS”,”PROFESSION”],”values”: [[“M”, 20, “Single”, “Student”]]}

    scoring =, json=payload, headers=scoring_header)


    {“trace”:”5e943881d813208ed0d2251a31c73644″,”errors”:[{“code”:”token_format_is_unsupported”,”message”:”Provided token should be in bearer token format”,”target”:{“type”:”header”,”name”:”Authorization”}}]}

    • Brian Murphy March 04, 2019

      Did this ever get resolved ? Getting same issue

      • Change the scoring_header to
        scoring_header = {‘Content-Type’: ‘application/json’, ‘Authorization’: ‘Bearer’ + mltoken}

        • I was getting the same issue, and when I changed it I got the following error:

          File “”, line 2
          scoring_header = {‘Content-Type’: ‘application/json’, ‘Authorization’: ‘Bearer ‘+mltoken}
          SyntaxError: invalid syntax

    • Yury Jefse March 28, 2019

      You should input the word “Bearer” before the token

      scoring_header = {‘Content-Type’: ‘application/json’, ‘Authorization’: ‘Bearer ‘+mltoken}

  3. Hi,

    I am working on Watson Machine Learning models and when I am trying to add data sets to my project, I am not able to add. Can you please help on this?

  4. luca marzotti April 19, 2019

    I cannot find the notebook anymore

  5. Kostyantyn Kravchenko May 14, 2019

    Hello, thank you for the tutorial.
    Are you planning to update the Python-Flask part?
    It becomes totally irrelevant with the new interface and new app deployment process. Thank you!

    • It’s in plan to update this video, but there’s no definitive timeline yet

  6. Is Python Flask is depreciated.
    In IBM cloud -> Catalog has 1. Python Microservice with Flask and 2. Python Web App with Flask which one need to be used to launch the app.

    • This notebook/tutorial/video hasn’t been updated yet, but I suspect the Python Web App with Flask would be the one to use

Join The Discussion

Your email address will not be published. Required fields are marked *