Evaluation
synapseclient.evaluation
¶
Evaluations¶
An Evaluation object represents a collection of Synapse Entities that will be processed in a particular way. This could mean scoring Entries in a challenge or executing a processing pipeline.
Imports and authentication:
from synapseclient import Evaluation, Submission, SubmissionStatus, Synapse
syn = Synapse()
syn.login()
Evaluations can be retrieved by ID:
evaluation = syn.getEvaluation(1901877)
Like entities, evaluations are access controlled via ACLs. The synapseclient.Synapse.getPermissions and synapseclient.Synapse.setPermissions methods work for evaluations:
access = syn.getPermissions(evaluation, user_id)
The synapseclient.Synapse.submit method returns a Submission object:
entity = syn.get(synapse_id)
submission = syn.submit(evaluation, entity, name='My Data', team='My Team')
The getSubmissionStatus function can then be used to check the SubmissionStatus of the submission:
status = syn.getSubmissionStatus(submission)
The status of a submission may be
- INVALID the submitted entity is in the wrong format
- SCORED in the context of a challenge or competition
- OPEN indicating processing has not completed
- CLOSED indicating processing has completed
SubmissionStatus objects can be updated, usually by changing the status and score fields, and stored back to Synapse using synapseclient.Synapse.store:
status.score = 0.99
status.status = 'SCORED'
status = syn.store(status)
See:
- synapseclient.Synapse.getEvaluation
- synapseclient.Synapse.getEvaluationByContentSource
- synapseclient.Synapse.getEvaluationByName
- synapseclient.Synapse.submit
- synapseclient.Synapse.getSubmissions
- synapseclient.Synapse.getSubmission
- synapseclient.Synapse.getSubmissionStatus
- synapseclient.Synapse.getPermissions
- synapseclient.Synapse.setPermissions
Classes¶
Evaluation
¶
Bases: DictObject
An Evaluation Submission queue, allowing submissions, retrieval and scoring.
WARNING - This class is deprecated and will no longer be maintained. Please use the Evaluation model from synapseclient.models.evaluation instead.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Name of the evaluation
|
description
|
A short description of the evaluation
|
contentSource
|
Synapse Project associated with the evaluation
|
submissionReceiptMessage
|
Message to display to users upon submission
|
submissionInstructionsMessage
|
Message to display to users detailing acceptable formatting for submissions.
|
Create and store an Evaluation (DEPRECATED)
To create an Evaluation and store it in Synapse:
import synapseclient
from synapseclient import Evaluation
## Initialize a Synapse object & authenticate
syn = synapseclient.Synapse()
syn.login()
evaluation = syn.store(Evaluation(
name="Q1 Final",
description="Predict progression of MMSE scores for final scoring",
contentSource="syn12345"))
The contentSource field links the evaluation to its Project (or, really, any synapse ID, but sticking to projects is a good idea).
Create and store an Evaluation (NEW METHOD)
from synapseclient import Synapse
from synapseclient.models import Evaluation
# Create client and login
syn = Synapse()
syn.login()
evaluation = Evaluation(name="My Challenge Evaluation",
description="Description of my challenge evaluation",
content_source="syn12345",
submission_instructions_message="Please submit your entries in the format described here: ...",
submission_receipt_message="Thank you for your submission! Your entry has been received.")
evaluation.store()
Retrieve an Evaluation multiple ways (DEPRECATED)
Evaluations can be retrieved from Synapse by ID, content source (associated entity), or name:
# Retrieve evaluation by ID
evaluation = syn.getEvaluation(9999999)
# Retrieve evaluation by name
evaluation = syn.getEvaluationByName('Foo Challenge Question 1')
# Retrieve evaluation by content source (associated entity)
evaluation = syn.getEvaluationByContentSource('syn12345')
Retrieve an Evaluation multiple ways (NEW METHOD)
from synapseclient import Synapse
from synapseclient.models import Evaluation
# Create client and login
syn = Synapse()
syn.login()
# Retrieve evaluation by ID
evaluation = Evaluation(id=9999999).get()
# Retrieve evaluation by name
evaluation = Evaluation(name='Foo Challenge Question 1').get()
# Retrieve all evaluations by content source (associated entity)
evaluation = Evaluation.get_evaluations_by_project(id='syn12345')
# Retrieve all evaluations the active user can submit to
evaluations_generator = Evaluation.get_available_evaluations()
# Retrieve all evaluations the active user has READ/VIEW access to
evaluations_generator = Evaluation.get_all_evaluations()
# Retrieve all evaluations the active user has UPDATE/EDIT access to
evaluations_generator = Evaluation.get_all_evaluations(access_type=['UPDATE'])
Source code in synapseclient/evaluation.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
Submission
¶
Bases: DictObject
Builds a Synapse submission object.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Name of submission
|
entityId
|
Synapse ID of the Entity to submit
|
evaluationId
|
ID of the Evaluation to which the Entity is to be submitted
|
versionNumber
|
Version number of the submitted Entity
|
submitterAlias
|
A pseudonym or team name for a challenge entry
|
Source code in synapseclient/evaluation.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
SubmissionStatus
¶
Bases: DictObject
Builds an Synapse submission status object. https://rest-docs.synapse.org/rest/org/sagebionetworks/evaluation/model/SubmissionStatus.html
| PARAMETER | DESCRIPTION |
|---|---|
id
|
Unique immutable Synapse Id of the Submission |
status
|
Status can be one of https://rest-docs.synapse.org/rest/org/sagebionetworks/evaluation/model/SubmissionStatusEnum.html.
|
submissionAnnotations
|
synapseclient.Annotations to store annotations of submission
|
canCancel
|
Can this submission be cancelled?
|
cancelRequested
|
Has user requested to cancel this submission?
|
Source code in synapseclient/evaluation.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | |
Functions¶
json
¶
json(ensure_ascii: bool = True)
Overloaded json function, turning submissionAnnotations into synapse style annotations.
| PARAMETER | DESCRIPTION |
|---|---|
ensure_ascii
|
(default = True) If false, then the return value can contain non-ASCII
TYPE:
|
Returns: A Synapse-style JSON dictionary of annotations.
Source code in synapseclient/evaluation.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | |