functions
openml.flows.functions
#
__list_flows
#
Retrieve information about flows from OpenML API and parse it to a dictionary or a Pandas DataFrame.
| PARAMETER | DESCRIPTION |
|---|---|
api_call
|
Retrieves the information about flows.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
The flows information in the specified output format.
|
|
Source code in openml/flows/functions.py
assert_flows_equal
#
assert_flows_equal(flow1: OpenMLFlow, flow2: OpenMLFlow, ignore_parameter_values_on_older_children: str | None = None, ignore_parameter_values: bool = False, ignore_custom_name_if_none: bool = False, check_description: bool = True) -> None
Check equality of two flows.
Two flows are equal if their all keys which are not set by the server are equal, as well as all their parameters and components.
| PARAMETER | DESCRIPTION |
|---|---|
flow1
|
TYPE:
|
flow2
|
TYPE:
|
ignore_parameter_values_on_older_children
|
If set to
TYPE:
|
ignore_parameter_values
|
Whether to ignore parameter values when comparing flows.
TYPE:
|
ignore_custom_name_if_none
|
Whether to ignore the custom name field if either flow has
TYPE:
|
check_description
|
Whether to ignore matching of flow descriptions.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
When either argument is not an :class: |
ValueError
|
When a relevant mismatch is found between the two flows. |
Examples:
>>> import openml
>>> f1 = openml.flows.get_flow(5)
>>> f2 = openml.flows.get_flow(5)
>>> openml.flows.assert_flows_equal(f1, f2)
>>> # If flows differ, a ValueError is raised
Source code in openml/flows/functions.py
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 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 | |
delete_flow
#
Delete flow with id flow_id from the OpenML server.
You can only delete flows which you uploaded and which which are not linked to runs.
| PARAMETER | DESCRIPTION |
|---|---|
flow_id
|
OpenML id of the flow
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the deletion was successful. False otherwise. |
| RAISES | DESCRIPTION |
|---|---|
OpenMLServerException
|
If the server-side deletion fails due to permissions or other errors. |
Side Effects
- Removes the flow from the OpenML server (if permitted).
Examples:
>>> import openml
>>> # Deletes flow 23 if you are the uploader and it's not linked to runs
>>> openml.flows.delete_flow(23)
Source code in openml/flows/functions.py
flow_exists
#
Check whether a flow (name + external_version) exists on the server.
The OpenML server defines uniqueness of flows by the pair
(name, external_version). This helper queries the server and
returns the corresponding flow id when present.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Flow name (e.g.,
TYPE:
|
external_version
|
Version information associated with flow.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int or bool
|
The flow id if the flow exists on the server, otherwise |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
OpenMLServerException
|
When the API request fails. |
Examples:
Source code in openml/flows/functions.py
get_flow
#
get_flow(flow_id: int, reinstantiate: bool = False, strict_version: bool = True) -> OpenMLFlow
Fetch an OpenMLFlow by its server-assigned ID.
Queries the OpenML REST API for the flow metadata and returns an
:class:OpenMLFlow instance. If the flow is already cached locally,
the cached copy is returned. Optionally the flow can be re-instantiated
into a concrete model instance using the registered extension.
| PARAMETER | DESCRIPTION |
|---|---|
flow_id
|
The OpenML flow id.
TYPE:
|
reinstantiate
|
If True, convert the flow description into a concrete model instance
using the flow's extension (e.g., sklearn). If conversion fails and
TYPE:
|
strict_version
|
When
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
OpenMLFlow
|
The flow object with metadata; |
| RAISES | DESCRIPTION |
|---|---|
OpenMLCacheException
|
When cached flow files are corrupted or cannot be read. |
OpenMLServerException
|
When the REST API call fails. |
Side Effects
- Writes to
openml.config.cache_directory/flows/{flow_id}/flow.xmlwhen the flow is downloaded from the server.
Preconditions
- Network access to the OpenML server is required unless the flow is cached.
- For private flows,
openml.config.apikeymust be set.
Notes
Results are cached to speed up subsequent calls. When reinstantiate is
True and version mismatches occur, a new flow may be returned to reflect
the converted model (only when strict_version is False).
Examples:
Source code in openml/flows/functions.py
get_flow_id
#
get_flow_id(model: Any | None = None, name: str | None = None, exact_version: bool = True) -> int | bool | list[int]
Retrieve flow id(s) for a model instance or a flow name.
Provide either a concrete model (which will be converted to a flow by
the appropriate extension) or a flow name. Behavior depends on
exact_version:
model+exact_version=True: convertmodelto a flow and call :func:flow_existsto get a single flow id (or False).model+exact_version=False: convertmodelto a flow and return all server flow ids with the same flow name.name: ignoreexact_versionand return all server flow ids that matchname.
| PARAMETER | DESCRIPTION |
|---|---|
model
|
TYPE:
|
name
|
TYPE:
|
exact_version
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int or bool or list[int]
|
If |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If neither |
OpenMLServerException
|
If underlying API calls fail. |
Side Effects
- May call server APIs (
flow/exists,flow/list) and therefore depends on network access and API keys for private flows.
Examples:
>>> import openml
>>> # Lookup by flow name
>>> openml.flows.get_flow_id(name="weka.JRip")
>>> # Lookup by model instance (requires a registered extension)
>>> import sklearn
>>> import openml_sklearn
>>> clf = sklearn.tree.DecisionTreeClassifier()
>>> openml.flows.get_flow_id(model=clf)
Source code in openml/flows/functions.py
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 | |
list_flows
#
list_flows(offset: int | None = None, size: int | None = None, tag: str | None = None, uploader: str | None = None) -> DataFrame
List flows available on the OpenML server.
This function supports paging and filtering and returns a pandas DataFrame with one row per flow and columns for id, name, version, external_version, full_name and uploader.
| PARAMETER | DESCRIPTION |
|---|---|
offset
|
Number of flows to skip, starting from the first (for paging).
TYPE:
|
size
|
Maximum number of flows to return.
TYPE:
|
tag
|
Only return flows having this tag.
TYPE:
|
uploader
|
Only return flows uploaded by this user.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
Rows correspond to flows. Columns include |
| RAISES | DESCRIPTION |
|---|---|
OpenMLServerException
|
When the API call fails. |
Side Effects
- None: results are fetched and returned; Read-only operation.
Preconditions
- Network access is required to list flows unless cached mechanisms are used by the underlying API helper.
Examples: