functions
openml.runs.functions
#
delete_run
#
Delete run with id run_id from the OpenML server.
You can only delete runs which you uploaded.
| PARAMETER | DESCRIPTION |
|---|---|
run_id
|
OpenML id of the run
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the deletion was successful. False otherwise. |
Source code in openml/runs/functions.py
format_prediction
#
format_prediction(task: OpenMLSupervisedTask, repeat: int, fold: int, index: int, prediction: str | int | float, truth: str | int | float, sample: int | None = None, proba: dict[str, float] | None = None) -> list[str | int | float]
Format the predictions in the specific order as required for the run results.
| PARAMETER | DESCRIPTION |
|---|---|
task
|
Task for which to format the predictions.
TYPE:
|
repeat
|
From which repeat this predictions is made.
TYPE:
|
fold
|
From which fold this prediction is made.
TYPE:
|
index
|
For which index this prediction is made.
TYPE:
|
prediction
|
The predicted class label or value.
TYPE:
|
truth
|
The true class label or value.
TYPE:
|
sample
|
From which sample set this prediction is made. Required only for LearningCurve tasks.
TYPE:
|
proba
|
For classification tasks only.
A mapping from each class label to their predicted probability.
The dictionary should contain an entry for each of the
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
A list with elements for the prediction results of a run.
|
|
The returned order of the elements is (if available):
|
[repeat, fold, sample, index, prediction, truth, *probabilities] |
This order follows the R Client API.
|
|
Source code in openml/runs/functions.py
1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 | |
get_run
#
get_run(run_id: int, ignore_cache: bool = False) -> OpenMLRun
Gets run corresponding to run_id.
| PARAMETER | DESCRIPTION |
|---|---|
run_id
|
TYPE:
|
ignore_cache
|
Whether to ignore the cache. If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
run
|
Run corresponding to ID, fetched from the server.
TYPE:
|
Source code in openml/runs/functions.py
get_run_trace
#
get_run_trace(run_id: int) -> OpenMLRunTrace
Get the optimization trace object for a given run id.
| PARAMETER | DESCRIPTION |
|---|---|
run_id
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
OpenMLTrace
|
|
Source code in openml/runs/functions.py
get_runs
#
get_runs(run_ids: list[int]) -> list[OpenMLRun]
Gets all runs in run_ids list.
| PARAMETER | DESCRIPTION |
|---|---|
run_ids
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
runs
|
List of runs corresponding to IDs, fetched from the server.
TYPE:
|
Source code in openml/runs/functions.py
initialize_model_from_run
#
Initialized a model based on a run_id (i.e., using the exact same parameter settings)
| PARAMETER | DESCRIPTION |
|---|---|
run_id
|
The Openml run_id
TYPE:
|
strict_version
|
See
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
model
|
|
Source code in openml/runs/functions.py
initialize_model_from_trace
#
initialize_model_from_trace(run_id: int, repeat: int, fold: int, iteration: int | None = None) -> Any
Initialize a model based on the parameters that were set by an optimization procedure (i.e., using the exact same parameter settings)
| PARAMETER | DESCRIPTION |
|---|---|
run_id
|
The Openml run_id. Should contain a trace file, otherwise a OpenMLServerException is raised
TYPE:
|
repeat
|
The repeat nr (column in trace file)
TYPE:
|
fold
|
The fold nr (column in trace file)
TYPE:
|
iteration
|
The iteration nr (column in trace file). If None, the best (selected) iteration will be searched (slow), according to the selection criteria implemented in OpenMLRunTrace.get_selected_iteration
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
model
|
|
Source code in openml/runs/functions.py
list_runs
#
list_runs(offset: int | None = None, size: int | None = None, id: list | None = None, task: list[int] | None = None, setup: list | None = None, flow: list | None = None, uploader: list | None = None, tag: str | None = None, study: int | None = None, display_errors: bool = False, task_type: TaskType | int | None = None) -> DataFrame
List all runs matching all of the given filters. (Supports large amount of results)
| PARAMETER | DESCRIPTION |
|---|---|
offset
|
the number of runs to skip, starting from the first
TYPE:
|
size
|
the maximum number of runs to show
TYPE:
|
id
|
TYPE:
|
task
|
TYPE:
|
setup
|
TYPE:
|
flow
|
TYPE:
|
uploader
|
TYPE:
|
tag
|
TYPE:
|
study
|
TYPE:
|
display_errors
|
Whether to list runs which have an error (for example a missing prediction file).
TYPE:
|
task_type
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dataframe
|
|
Source code in openml/runs/functions.py
1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 | |
run_exists
#
Checks whether a task/setup combination is already present on the server.
| PARAMETER | DESCRIPTION |
|---|---|
task_id
|
TYPE:
|
setup_id
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Set run ids for runs where flow setup_id was run on task_id. Empty
|
set if it wasn't run yet. |
Source code in openml/runs/functions.py
run_flow_on_task
#
run_flow_on_task(flow: OpenMLFlow, task: OpenMLTask, avoid_duplicate_runs: bool | None = None, flow_tags: list[str] | None = None, seed: int | None = None, add_local_measures: bool = True, upload_flow: bool = False, n_jobs: int | None = None) -> OpenMLRun
Run the model provided by the flow on the dataset defined by task.
Takes the flow and repeat information into account. The Flow may optionally be published.
| PARAMETER | DESCRIPTION |
|---|---|
flow
|
A flow wraps a machine learning model together with relevant information. The model has a function fit(X,Y) and predict(X), all supervised estimators of scikit learn follow this definition of a model.
TYPE:
|
task
|
Task to perform. This may be an OpenMLFlow instead if the first argument is an OpenMLTask.
TYPE:
|
avoid_duplicate_runs
|
If True, the run will throw an error if the setup/task combination is already present on the server. This feature requires an internet connection. If not set, it will use the default from your openml configuration (False if unset).
TYPE:
|
flow_tags
|
A list of tags that the flow should have at creation.
TYPE:
|
seed
|
Models that are not seeded will get this seed.
TYPE:
|
add_local_measures
|
Determines whether to calculate a set of evaluation measures locally, to later verify server behaviour.
TYPE:
|
upload_flow
|
If True, upload the flow to OpenML if it does not exist yet. If False, do not upload the flow to OpenML.
TYPE:
|
n_jobs
|
The number of processes/threads to distribute the evaluation asynchronously.
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
run
|
Result of the run.
TYPE:
|
Source code in openml/runs/functions.py
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | |
run_model_on_task
#
run_model_on_task(model: Any, task: int | str | OpenMLTask, avoid_duplicate_runs: bool | None = None, flow_tags: list[str] | None = None, seed: int | None = None, add_local_measures: bool = True, upload_flow: bool = False, return_flow: bool = False, n_jobs: int | None = None) -> OpenMLRun | tuple[OpenMLRun, OpenMLFlow]
Run the model on the dataset defined by the task.
| PARAMETER | DESCRIPTION |
|---|---|
model
|
A model which has a function fit(X,Y) and predict(X), all supervised estimators of scikit learn follow this definition of a model.
TYPE:
|
task
|
Task to perform or Task id. This may be a model instead if the first argument is an OpenMLTask.
TYPE:
|
avoid_duplicate_runs
|
If True, the run will throw an error if the setup/task combination is already present on the server. This feature requires an internet connection. If not set, it will use the default from your openml configuration (False if unset).
TYPE:
|
flow_tags
|
A list of tags that the flow should have at creation.
TYPE:
|
seed
|
Models that are not seeded will get this seed.
TYPE:
|
add_local_measures
|
Determines whether to calculate a set of evaluation measures locally, to later verify server behaviour.
TYPE:
|
upload_flow
|
If True, upload the flow to OpenML if it does not exist yet. If False, do not upload the flow to OpenML.
TYPE:
|
return_flow
|
If True, returns the OpenMLFlow generated from the model in addition to the OpenMLRun.
TYPE:
|
n_jobs
|
The number of processes/threads to distribute the evaluation asynchronously.
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
run
|
Result of the run.
TYPE:
|
flow
|
Flow generated from the model.
TYPE:
|
Examples:
>>> import openml
>>> import openml_sklearn
>>> from sklearn.tree import DecisionTreeClassifier
>>> clf = DecisionTreeClassifier()
>>> task = openml.tasks.get_task(6)
>>> run = openml.runs.run_model_on_task(clf, task)
Source code in openml/runs/functions.py
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 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | |