declearn.data_info.DataInfoField
Abstract base class to implement 'data_info' fields specifications.
This class defines a small API to write specifications for expected metadata fields shared by clients in a federated learning process.
Subclasses are not meant to be instantiated, but act as a namespace, and must implement the following class attributes and class methods:
Attributes:
Name | Type | Description |
---|---|---|
field |
str
|
Name of the field that is being specified. |
types |
tuple of types
|
Supported types for individual field values. |
doc |
str
|
Short summary of the field's specification (accessible by
using the |
Methods
is_valid: any -> bool
Check that a given value is valid for this field.
If not overridden, run isinstance(value, cls.types
).
combine: *any -> any
Combine multiple field values into a single one.
This method needs extension or overridding. If super
is called, run is_valid
on each and every input.
Source code in declearn/data_info/_base.py
63 64 65 66 67 68 69 70 71 72 73 74 75 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 |
|
combine(*values)
abstractmethod
classmethod
Combine multiple field values into a single one.
Raise a ValueError if input values are invalid or incompatible.
Source code in declearn/data_info/_base.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
is_valid(value)
classmethod
Check that a given value may belong to this field.
Source code in declearn/data_info/_base.py
97 98 99 100 101 102 103 104 |
|