automl package
-
main
()
-
class
Context
(parent=None) Bases:
object
Context enables cross-component data sharing and communication. Any AutoML component can set and get properties into the context.
If you specify a parent context, the new context will inherit all properties from the parent.
- Parameters
parent – the parent context.
- Returns
A Context object
-
add_command_module
(module: dlmed.hci.reg.CommandModule)
-
close_trace
()
-
exception_occurred
(issuer, msg=None) Call this method to report that an exception has occurred.
- Parameters
issuer – the issuer of this request
msg – the description of the exception
Returns:
-
get_prop
(key: str, default=None) Get a property from the context. If the specified property does not exist, returns the specified default.
- Parameters
key – key of the property
default – default value of the property
Returns: property value
-
get_stop_message
() Return the reason of ‘stop work’.
Returns: reason of ‘stop work’
-
set_prop
(key: str, value) Set a property into the context
- Parameters
key – key of the property
value – value of the property
Returns:
-
set_trace
(dest, file_name)
-
stop_work
(issuer, msg: str) Call this method to ask to stop work. Note: it is up to the workflow engine whether this ask is honored.
- Parameters
issuer – the issuer of this request
msg – the reason of the request
Returns:
-
stop_work_asked
() → bool Whether ‘stop work’ has been asked.
Returns: whether ‘stop work’ has been asked
-
trace
(issuer: object, msg: str, print_to_console=False)
-
class
ContextKey
Bases:
object
Defines a set of standard property keys.
-
CONCRETE_SEARCH_VALUE
= '_concreteSearchValue'
-
GPUS
= '_gpus'
-
JOB_NAME
= '_jobName'
-
JOB_STATUS
= '_jobStatus'
-
NUM_WORKERS
= '_numWorkers'
-
PROCESS_EXIT_STATUS
= '_processExitStatus'
-
RECOMMENDATION
= '_recommendation'
-
RECOMMENDATIONS
= '_recommendations'
-
SCORE
= '_score'
-
SEARCH_SPACE
= '_searchSpace'
-
TRACE_DEST_FILE
= '_traceDestFile'
-
TRACE_DEST_TYPE
= '_traceDestType'
-
WORKER_NAME
= '_workerName'
-
-
class
EventType
Bases:
object
Defines AutoML workflow events.
-
END_AUTOML
= '_endAutoml'
-
END_JOB
= '_endJob'
-
RECOMMENDATIONS_AVAILABLE
= '_recommendationsAvailable'
-
SEARCH_SPACE_AVAILABLE
= '_searchSpaceAvailable'
-
START_AUTOML
= '_startAutoml'
-
START_JOB
= '_startJob'
-
-
class
Outcome
(rec_id, status: automl.defs.Status, score, job_ctx: automl.defs.Context = None) Bases:
object
Outcome represents the execution result of a recommendation
- Parameters
rec_id – the ID of the recommendation executed
status – job completion state
score – the score produced by the recommendation execution
job_ctx – the context used for the job execution
Note: score is conceptual. It could be a simple number or an object of any type.
-
class
ProcessStatus
Bases:
object
-
ABNORMAL_FINISH
= 2
-
EXIT_WITH_EXCEPTION
= 5
-
FAILURE_TO_START
= 3
-
NORMAL_FINISH
= 1
-
RUNNING
= 0
-
TERMINATION_BY_SIGNAL
= 4
-
static
status_text
(status)
-
-
class
Recommendation
(rec_id, result: automl.defs.SearchResult) Bases:
object
Recommendation is a recommendation for AutoML execution.
- Parameters
rec_id – the unique ID of the recommendation.
result – the search result
-
class
SearchRange
(minv, maxv=None) Bases:
object
A SearchRange is the basic building block of search space.
- Parameters
minv – min value of the range.
maxv – max value of the range. If not specified, it is set to the same value as minv
- Returns
A SearchRange object
-
class
SearchResult
(space: automl.defs.SearchSpace, values: dict) Bases:
object
SearchResult is a set of values from the search space.
- Parameters
space – the SearchSpace that the values are from.
values – the dict of PRL => value
- Returns
A SearchResult object
-
dump
(prefix='\t') Prints the content of the search result.
- Parameters
prefix (str) – prefix string for each line of output
-
class
SearchSpace
(name: str, targets: dict) Bases:
object
SearchSpace defines the space of candidates for searchable parameters. It is a dictionary of PRL (Parameter Range Locator) to a list of SearchRanges. Each PRL represents a unique search parameter.
- Parameters
name – name of the search space.
targets – the dict of PRL => [SearchRange]
- Returns
A SearchSpace object
-
dump
(prefix='\t') Prints the content of the search space.
- Parameters
prefix (str) – prefix string for each line of output
-
class
Status
Bases:
dlmed.scheduler.scheduler.JobStatus
Defines the format and convenience functions of PRL.
PRL (Parameter Range Locator - modeled after URL) Format: domain.type[.extra]
-
class
Domain
Bases:
object
Defines support domains.
-
LEARNING_RATE
= 'lr'
-
NET
= 'net'
-
TRANSFORM
= 'transform'
-
-
class
PType
Bases:
object
Defines supported parameter data types
-
ENUM
= 'enum'
-
FLOAT
= 'float'
-
-
make_prl
(domain: str, ptype: str, rest: str = '') → str Make a PRL from specified PRL elements
- Parameters
domain – domain of the PRL
ptype – parameter data type
rest – extra items
Returns: a PRL
-
split_prl
(prl: str) → [<class ‘str’>] Split the PRL into list of elements
- Parameters
prl – the PRL to be split
Returns: list of elements
-
validate_domain
(domain)
-
validate_prl
(prl: str) Validate a specified prl.
- Parameters
prl – the PRL to be validated
Returns: error message if not valid; None if valid.
-
validate_ptype
(ptype)