Python - API¶
#TODO: add content descriptions
- api.normalize_url(host, path)[source]¶
Adds the path to the url, to get an full uri. Multiple “/” between host and path will be normalized to host/path
Parameters: host : string
Hostname, maybe with port extension and protocoll
path : string
Path of the uri
- class api.API(username=u'backend', password=u'foobar', host=u'http://localhost:8000/')[source]¶
- add_group(name, public=True)[source]¶
Creates a new group
Parameters: name : string
Name of the new group
public : boolean
Is the group joinable? Default: True
Notes
Requires admin rights.
- add_job_picture(job_id, filename)[source]¶
Adds a picture to the job.
Parameters: job_id : int
The ID of the job.
filename : string
Path to picture
- get_dataset_points(dataset_id)[source]¶
Retrieves all points from a given dataset.
Parameters: dataset_id : int
The ID of the dataset
Returns: List of point dicts.
- get_job_params(job_id)[source]¶
Load the job parameters. This is only used for workers and need admin rights.
Parameters: job_id : int
The ID of the selected job.
Returns: Dictionary:
- algorithm
- dataset
- params
- join_group(group_name)[source]¶
Current user will be added the the selected group.
Parameters: group_name : string
Name of the selected group
- list_groups()[source]¶
List all accessible groups
Returns: Dictionary with key is the name and value are group parameters.
- load(path, raw=False, **kwargs)[source]¶
Load the required resource from the host.
If a login was successful, cookie session information are attached to the request. Also the CRFS-Token is added, if data is set. All values from data are transmitted via POST command.
Parameters: path : string
path to the resource
raw : boolean
if True no JSON decoding is done
**kwargs : dict
Additional parameters which will be send as POST request.
- login(username, password)[source]¶
Send login request. This is normally done by constructor.
Parameters: username : string
The username of the user
password : string
The password of the user
Returns: True, if login was successful
HTML response otherwise
- ping()[source]¶
Ping the server and try to retrieve a new job to be processed.
Returns: Job ID if a new job is available or None if not.
- update_job_details(job_id, score_test, score_validation, labels_training, labels_test, labels_validation, extra_scores_test=None, extra_scores_validation=None, message=None, success=True)[source]¶
Posts the job results to the server.
Parameters: job_id : integer
The ID of the job
score_test : float
The score of the test set. Should be in the interval [0,1]
score_validation : float
The score of the validation set. Should be in the interval [0,1]
labels_training : list
A list of lables for the training set
labels_test : list
A list of lables for the test set
labels_validation : list
A list of labels for the validation set
extra_scores_test : dict (optional)
A dictionary with further scores (just for information) from the test set.
extra_scores_validation : dict (optional)
A dictionary with further scores (just for information) from the validation set.
message : string (optional)
A message from the training set. It could contain more information about the training/test.
pictures : list of filenames (optional)
A list of filenames with additional visualizations of the test set.
success : boolean (default: True)
True if the learning process was successful