This repository contains helper scripts and examples that demonstrate
- how to use the
Retrieve And Rank
andDiscovery
watson services - how to evaluate the quality of retrieval performance with your own data
This is meant for users who might want to use the APIs to manage their services (rather than the GUI tools) for more control or debugging. All interaction between my python code and the services take place using the python client libraries provided by IBM.
For more information about Retrieve And Rank
, see the detailed documentation.
For more information about Discovery
, see the detailed documentation.
git clone [email protected]:rchaks/retrieve-and-rank-tuning.git
-
Ensure installation of Python3.5 (presumably any Python 3.x version should work, but has only been tested with 3.5)
-
Install pip
- If you already have it installed, you might still
want to check if you've updated to the latest installation
pip install --upgrade pip
- If you already have it installed, you might still
want to check if you've updated to the latest installation
-
(Optional) Install virtualenv and initialize a clean virtualenv:
virtualenv {location of virtualenv}
source {location of virtualenv}/bin/activate
-
Ensure that you have a Bluemix account: You will use Bluemix to provision Watson services (even the free-tier user account priviledges should be enough for to try out these scripts)
-
Depending on which service(s) you wish to try out, provision a Retrieve And Rank and/or Discovery service from bluemix. Alternatively, you can use the cloud foundary tools to provision services using command line utilities.
-
Edit the
config/config.ini
file with your credentials for one or more services. Should look something like this:
[RetrieveAndRank]
# Credentials from Bluemix
user=7eeeee-30000-4eee-beee-92313faea
password=QQQQQQQQQy
[Discovery]
user=7eeeee-3012310-4eee-beee-92313faea
password=QQQQQQQ123
-
Install the helper scripts as a python library (along necessary dependencies):
pip install -e .
from inside the main directory. -
If you want to test that the scripts are working as expected, you can also kick off the unit tests by running:
py.test tests
.
Warning: These unit tests will use your credentials to actually call bluemix. If unit tests are interrupted before completion, they may leave data on 'UnitTest' clusters/collections/rankers around. And the tests take a loooong time to execute on account of having to reach out to the watson services.
Sample usage of the scripts to do a number of tasks are available in the examples directory as Jupyter notebooks.
You can just view these in github (it has
sample output), but if you wish to run them locally, you will need
to install additional dependencies: pip install -r requirements-examples.txt
Though the Jupyter notebooks show usage from inside Python, the scripts
inside rnr_debug_helpers are also command line
friendly. For usage info run:
python rnr_debug_helpers/<script_name.py> --help
This sample code is licensed under Apache 2.0. Full license text is available in LICENSE.