AccernXYME is a library for easily accessing XYME via python.
Project description
accern_xyme is a python library for accessing XYME functionality.
Usage
You can install accern_xyme with pip:
pip install --user accern-xyme
Import it in python via:
from accern_xyme import create_xyme_client
client = accern_xyme.create_xyme_client(
"https://xyme.accern.com/", "<USERNAME>", "<PASSWORD>")
print(client.get_user_info())
<USERNAME>
and <PASSWORD>
are the login credentials for XYME.
The values can also be set to None
in which case the values must
be set in the environment variables ACCERN_USER
and ACCERN_PASSWORD
. A login token can also be provided.
You will need python3.6 or later.
Exploring Workspaces
The workspaces of the user can be retrieved via:
for (workspace, count) in client.get_workspaces().items():
print(f"{workspace} contains {count} jobs"
And jobs in a given workspace can be retrieved via:
for job in client.get_jobs(workspace):
print(f"{job.get_job_id()}: {job.get_name()} - {job.get_status()}"
Or directly by Job ID:
job = client.get_job_id("username_example_com/job_id")
Starting Jobs
A new job can be started via:
# creating the job
job = client.create_job(schema=schema_obj, name="my job")
with job.update_schema() as cur:
# updating the schema
cur["M"]["params"]["hidden_layer_sizes"] = [100, 100, 100]
# starting the job
job.start()
import time
time.sleep(30 * 1000)
# remember to flush caches before checking the status
job.flush_caches()
print(job.get_status())
Computing Predictions
Predictions for a file or plain data can be obtained for a finished or running job:
# predicting for a file
res = job.predict_file(file_name)
# or for a pandas dataframe (predict_proba variants are also available)
res = job.predict(df)
predictions, stdout = res
print(stdout)
print("prediction of first row: ", predictions.iloc[0])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for accern_xyme-0.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01b04a97d3b6c37c848fccffda05f81675c1f65be466a170c017ef157ea0fc79 |
|
MD5 | dd1b5709c8f4eb080b05e9868fa4b709 |
|
BLAKE2b-256 | 2b09b349e3fe51b3d43e58ccdddaa6f8004a5a7b6e0d291f2265f6638926c01b |