weka.flow package¶
Submodules¶
weka.flow.base module¶
-
class
weka.flow.base.
Actor
(name=None, config=None)¶ Bases:
weka.core.classes.Configurable
,weka.core.classes.Stoppable
The ancestor for all actors.
-
cleanup
()¶ Destructive finishing up after execution stopped.
-
depth
¶ Returns the depth of this actor inside the overall flow.
Returns: the depth Return type: int
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
execute
()¶ Executes the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
classmethod
from_dict
(d)¶ Restores an object state from a dictionary, used in de-JSONification.
Parameters: d (dict) – the object dictionary Returns: the object Return type: object
-
full_name
¶ Obtains the full name of the actor.
Returns: the full name Return type: str
-
index
¶ Returns the index of this actor in its parent’s list of actors.
Returns: the index, -1 if not available Return type: int
-
is_stopped
()¶ Returns whether the object has been stopped.
Returns: whether stopped Return type: bool
-
name
¶ Obtains the currently set name of the actor.
Returns: the name Return type: str
-
parent
¶ Obtains the currently set parent of the actor.
Returns: the name Return type: str
-
post_execute
()¶ Gets executed after the actual execution.
Returns: None if successful, otherwise error message Return type: str
-
pre_execute
()¶ Gets executed before the actual execution.
Returns: None if successful, otherwise error message Return type: str
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
resolve_option
(name, default=None)¶ Resolves the option, i.e., interprets “@{…}” values and retrievs them instead from internal storage.
Parameters: - name (str) – the name of the option
- default (object) – the optional default value
Returns: the resolved value
Return type: object
-
setup
()¶ Configures the actor before execution.
Returns: None if successful, otherwise error message Return type: str
-
skip
¶ Obtains whether the actor is disabled (skipped).
Returns: True if skipped Return type: bool
-
stop_execution
()¶ Triggers the stopping of the actor.
-
storagehandler
¶ Returns the storage handler available to thise actor.
Returns: the storage handler, None if not available
-
to_dict
()¶ Returns a dictionary that represents this object, to be used for JSONification.
Returns: the object dictionary Return type: dict
-
unique_name
(name)¶ Generates a unique name.
Parameters: name (str) – the name to check Returns: the unique name Return type: str
-
wrapup
()¶ Finishes up after execution finishes, does not remove any graphical output.
-
-
class
weka.flow.base.
InputConsumer
(name=None, config=None)¶ Bases:
weka.flow.base.Actor
Actors that consume tokens inherit this class.
-
class
weka.flow.base.
OutputProducer
(name=None, config=None)¶ Bases:
weka.flow.base.Actor
Actors that generate output tokens inherit this class.
-
has_output
()¶ Checks whether any output tokens are present.
Returns: true if at least one output token present Return type: bool
-
output
()¶ Returns the next available output token.
Returns: the next token, None if none available Return type: Token
-
pre_execute
()¶ Gets executed before the actual execution.
Returns: None if successful, otherwise error message Return type: str
-
-
class
weka.flow.base.
StorageHandler
¶ Bases:
object
For classes that support internal storage (= dictionary).
-
expand
(s)¶ Expands all occurrences of “@{…}” within the string with the actual values currently stored in internal storage.
Parameters: s (str) – the string to expand Returns: the expanded string Return type: str
-
classmethod
extract
(padded)¶ Removes the surrounding “@{…}” from the name.
Parameters: padded (str) – the padded string Returns: the extracted name Return type: str
-
classmethod
pad
(name)¶ Pads the name with “@{…}”.
Parameters: name (str) – the name to pad Returns: the padded name Return type: str
-
storage
¶ Returns the internal storage.
Returns: the internal storage Return type: dict
-
-
class
weka.flow.base.
Token
(payload)¶ Bases:
object
Container for transporting data through the flow.
-
id
¶ Obtains the ID of the token.
Returns: the ID Return type: str
-
payload
¶ Obtains the currently set payload.
Returns: the payload Return type: object
-
-
weka.flow.base.
is_sink
(actor)¶ Checks whether the actor is a sink.
Parameters: actor (Actor) – the actor to check Returns: True if the actor is a sink Return type: bool
-
weka.flow.base.
is_source
(actor)¶ Checks whether the actor is a source.
Parameters: actor (Actor) – the actor to check Returns: True if the actor is a source Return type: bool
-
weka.flow.base.
is_transformer
(actor)¶ Checks whether the actor is a transformer.
Parameters: actor (Actor) – the actor to check Returns: True if the actor is a transformer Return type: bool
-
weka.flow.base.
to_commandline
(o)¶ Turns the object into a commandline string. However, first checks whether a string represents a internal value placeholder (@{…}).
Parameters: o (object) – the object to turn into commandline Returns: the commandline Return type: str
weka.flow.container module¶
-
class
weka.flow.container.
AttributeSelectionContainer
(original=None, reduced=None, num_atts=None, selected=None, results=None)¶ Bases:
weka.flow.container.Container
Container for models.
-
is_valid
()¶ Checks whether the container is valid.
Returns: True if the container is valid Return type: bool
-
-
class
weka.flow.container.
ClassificationContainer
(inst=None, classification=None, label=None, distribution=None)¶ Bases:
weka.flow.container.Container
Container for predictions (classifiers).
-
is_valid
()¶ Checks whether the container is valid.
Returns: True if the container is valid Return type: bool
-
-
class
weka.flow.container.
ClusteringContainer
(inst=None, cluster=None, distribution=None)¶ Bases:
weka.flow.container.Container
Container for predictions (clusterers).
-
is_valid
()¶ Checks whether the container is valid.
Returns: True if the container is valid Return type: bool
-
-
class
weka.flow.container.
Container
¶ Bases:
object
Container for storing multiple objects and passing them around together in the flow.
-
allowed
¶ Returns the all the allowed keys.
Returns: the list of allowed keys. Return type: list
-
generate_help
()¶ Generates a help string for this container.
Returns: the help string Return type: str
-
get
(name)¶ Returns the stored data.
Parameters: name (str) – the name of the item to return Returns: the data Return type: object
-
is_valid
()¶ Checks whether the container is valid.
Returns: True if the container is valid Return type: bool
-
print_help
()¶ Prints a help string for this actor to stdout.
-
set
(name, value)¶ Stores the given data (if not None).
Parameters: - name (str) – the name of the item to store
- value (object) – the value to store
-
-
class
weka.flow.container.
ModelContainer
(model=None, header=None)¶ Bases:
weka.flow.container.Container
Container for models.
-
is_valid
()¶ Checks whether the container is valid.
Returns: True if the container is valid Return type: bool
-
weka.flow.control module¶
-
class
weka.flow.control.
ActorHandler
(name=None, config=None)¶ Bases:
weka.flow.base.Actor
The ancestor for all actors that handle other actors.
-
active
¶ Returns the count of non-skipped actors.
Returns: the count Return type: int
-
actors
¶ Obtains the currently set sub-actors.
Returns: the sub-actors Return type: list
-
check_actors
(actors)¶ Performs checks on the actors that are to be used. Raises an exception if invalid setup.
Parameters: actors (list) – the actors to check
-
cleanup
()¶ Destructive finishing up after execution stopped.
-
default_actors
()¶ Returns the default actors to use.
Returns: the default actors, if any Return type: list
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
first_active
¶ Returns the first non-skipped actor.
Returns: the first active actor, None if not available Return type: Actor
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
classmethod
from_dict
(d)¶ Restores an object state from a dictionary, used in de-JSONification.
Parameters: d (dict) – the object dictionary Returns: the object Return type: object
-
index_of
(name)¶ Returns the index of the actor with the given name.
Parameters: name (str) – the name of the Actor to find Returns: the index, -1 if not found Return type: int
-
last_active
¶ Returns the last non-skipped actor.
Returns: the last active actor, None if not available Return type: Actor
-
new_director
()¶ Creates the director to use for handling the sub-actors.
Returns: the director instance Return type: Director
-
setup
()¶ Configures the actor before execution.
Returns: None if successful, otherwise error message Return type: str
-
stop_execution
()¶ Triggers the stopping of the actor.
-
to_dict
()¶ Returns a dictionary that represents this object, to be used for JSONification.
Returns: the object dictionary Return type: dict
-
tree
¶ Returns a tree representation of this sub-flow.
Returns: the tree Return type: str
-
update_parent
()¶ Updates the parent in its sub-actors.
-
wrapup
()¶ Finishes up after execution finishes, does not remove any graphical output.
-
-
class
weka.flow.control.
Branch
(name=None, config=None)¶ Bases:
weka.flow.control.ActorHandler
,weka.flow.base.InputConsumer
Passes on the input token to all of its sub-actors, one after the other.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
-
class
weka.flow.control.
BranchDirector
(owner)¶ Bases:
weka.flow.control.Director
,weka.core.classes.Stoppable
Director for the Branch actor.
-
check_actors
()¶ Checks the actors of the owner. Raises an exception if invalid.
-
check_owner
(owner)¶ Checks the owner. Raises an exception if invalid.
Parameters: owner (Actor) – the owner to check
-
do_execute
()¶ Actual execution of the director.
Returns: None if successful, otherwise error message Return type: str
-
is_stopped
()¶ Returns whether the object has been stopped.
Returns: whether stopped Return type: bool
-
is_stopping
()¶ Returns whether the director is in the process of stopping.
Returns:
-
setup
()¶ Performs some checks.
Returns: None if successful, otherwise error message. Return type: str
-
stop_execution
()¶ Triggers the stopping of the object.
-
-
class
weka.flow.control.
ContainerValuePicker
(name=None, config=None)¶ Bases:
weka.flow.control.Tee
Picks the specified value from the container and ‘tees’ it off.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.control.
Director
(owner)¶ Bases:
object
Ancestor for classes that “direct” the flow of tokens.
-
check_owner
(owner)¶ Checks the owner. Raises an exception if invalid.
Parameters: owner (Actor) – the owner to check
-
do_execute
()¶ Actual execution of the director.
Returns: None if successful, otherwise error message Return type: str
-
execute
()¶ Executes the director.
Returns: None if successful, otherwise error message Return type: str
-
setup
()¶ Performs some checks.
Returns: None if successful, otherwise error message. Return type: str
-
-
class
weka.flow.control.
Flow
(name=None, config=None)¶ Bases:
weka.flow.control.ActorHandler
,weka.flow.base.StorageHandler
Root actor for defining and executing flows.
-
check_actors
(actors)¶ Performs checks on the actors that are to be used. Raises an exception if invalid setup.
Parameters: actors (list) – the actors to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
classmethod
load
(fname)¶ Loads the flow from a JSON file.
Parameters: fname (str) – the file to load Returns: the flow Return type: Flow
-
new_director
()¶ Creates the director to use for handling the sub-actors.
Returns: the director instance Return type: Director
-
classmethod
save
(flow, fname)¶ Saves the flow to a JSON file.
Parameters: - flow (Flow) – the flow to save
- fname (str) – the file to load
Returns: None if successful, otherwise error message
Return type: str
-
storage
¶ Returns the internal storage.
Returns: the internal storage Return type: dict
-
-
class
weka.flow.control.
Sequence
(name=None, config=None)¶ Bases:
weka.flow.control.ActorHandler
,weka.flow.base.InputConsumer
Simple sequence of actors that get executed one after the other. Accepts input.
-
check_actors
(actors)¶ Performs checks on the actors that are to be used. Raises an exception if invalid setup.
Parameters: actors (list) – the actors to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
-
class
weka.flow.control.
SequentialDirector
(owner)¶ Bases:
weka.flow.control.Director
,weka.core.classes.Stoppable
Director for sequential execution of actors.
-
allow_source
¶ Obtains whether to allow a source actor.
Returns: true if to allow Return type: bool
-
check_actors
()¶ Checks the actors of the owner. Raises an exception if invalid.
-
check_owner
(owner)¶ Checks the owner. Raises an exception if invalid.
Parameters: owner (Actor) – the owner to check
-
do_execute
()¶ Actual execution of the director.
Returns: None if successful, otherwise error message Return type: str
-
is_stopped
()¶ Returns whether the object has been stopped.
Returns: whether stopped Return type: bool
-
is_stopping
()¶ Returns whether the director is in the process of stopping.
Returns:
-
record_output
¶ Obtains whether to record the output of the last actor.
Returns: true if to record Return type: bool
-
recorded_output
¶ Obtains the recorded output.
Returns: the output Return type: list
-
setup
()¶ Performs some checks.
Returns: None if successful, otherwise error message. Return type: str
-
stop_execution
()¶ Triggers the stopping of the object.
-
-
class
weka.flow.control.
Stop
(name=None, config=None)¶ Bases:
weka.flow.base.InputConsumer
Stops the execution of the flow.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
-
class
weka.flow.control.
Tee
(name=None, config=None)¶ Bases:
weka.flow.control.ActorHandler
,weka.flow.transformer.Transformer
‘Tees off’ the current token to be processed in the sub-tree before passing it on.
-
check_actors
(actors)¶ Performs checks on the actors that are to be used. Raises an exception if invalid setup.
Parameters: actors (list) – the actors to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
new_director
()¶ Creates the director to use for handling the sub-actors.
Returns: the director instance Return type: Director
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.control.
Trigger
(name=None, config=None)¶ Bases:
weka.flow.control.ActorHandler
,weka.flow.transformer.Transformer
‘Triggers’ the sub-tree with each token passing through and then passes the token on.
-
check_actors
(actors)¶ Performs checks on the actors that are to be used. Raises an exception if invalid setup.
Parameters: actors (list) – the actors to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
new_director
()¶ Creates the director to use for handling the sub-actors.
Returns: the director instance Return type: Director
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
weka.flow.conversion module¶
-
class
weka.flow.conversion.
AnyToCommandline
(config=None)¶ Bases:
weka.flow.conversion.Conversion
Generates a commandline string, e.g., from a classifier.
-
convert
()¶ Performs the actual conversion.
Returns: None if successful, otherwise errors message Return type: str
-
description
()¶ Returns the description for the conversion.
Returns: the description Return type: str
-
-
class
weka.flow.conversion.
CommandlineToAny
(config=None)¶ Bases:
weka.flow.conversion.Conversion
Generates an object from a commandline string, e.g., from a classifier setup.
-
check_input
(obj)¶ Performs checks on the input object. Raises an exception if unsupported.
Parameters: obj (object) – the object to check
-
convert
()¶ Performs the actual conversion.
Returns: None if successful, otherwise errors message Return type: str
-
description
()¶ Returns the description for the conversion.
Returns: the description Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
-
class
weka.flow.conversion.
Conversion
(config=None)¶ Bases:
weka.core.classes.Configurable
Ancestor for conversions used by the ‘Convert’ transformer.
-
check_input
(obj)¶ Performs checks on the input object. Raises an exception if unsupported.
Parameters: obj (object) – the object to check
-
convert
()¶ Performs the actual conversion.
Returns: None if successful, otherwise errors message Return type: str
-
input
¶ Returns the current input object, None if not available.
Returns: the input object Return type: object
-
output
¶ Returns the generated output object, None if not available.
Returns: the output object Return type: object
-
-
class
weka.flow.conversion.
PassThrough
(config=None)¶ Bases:
weka.flow.conversion.Conversion
Dummy conversion, just passes through the data.
-
convert
()¶ Performs the actual conversion.
Returns: None if successful, otherwise errors message Return type: str
-
description
()¶ Returns the description for the conversion.
Returns: the description Return type: str
-
weka.flow.sink module¶
-
class
weka.flow.sink.
ClassifierErrors
(name=None, config=None)¶ Bases:
weka.flow.sink.Sink
Displays the errors obtained through a classifier evaluation.
-
check_input
(token)¶ Performs checks on the input token. Raises an exception if unsupported.
Parameters: token (Token) – the token to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.sink.
Console
(name=None, config=None)¶ Bases:
weka.flow.sink.Sink
Sink that outputs the payloads of the data on stdout.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.sink.
DumpFile
(name=None, config=None)¶ Bases:
weka.flow.sink.FileOutputSink
Sink that outputs the payloads of the data to a file.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.sink.
FileOutputSink
(name=None, config=None)¶ Bases:
weka.flow.sink.Sink
Ancestor for sinks that output data to a file.
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.sink.
InstanceDumper
(name=None, config=None)¶ Bases:
weka.flow.sink.FileOutputSink
Sink that dumps the incoming Instance/Instances into a file.
-
check_input
(token)¶ Performs checks on the input token. Raises an exception if unsupported.
Parameters: token (Token) – the token to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
-
class
weka.flow.sink.
LinePlot
(name=None, config=None)¶ Bases:
weka.flow.sink.Sink
Displays the Instances object as line plot using the internal format, one line per Instance.
-
check_input
(token)¶ Performs checks on the input token. Raises an exception if unsupported.
Parameters: token (Token) – the token to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.sink.
MatrixPlot
(name=None, config=None)¶ Bases:
weka.flow.sink.Sink
Displays the Instances object as matrix plot.
-
check_input
(token)¶ Performs checks on the input token. Raises an exception if unsupported.
Parameters: token (Token) – the token to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.sink.
ModelWriter
(name=None, config=None)¶ Bases:
weka.flow.sink.FileOutputSink
Writes a model to disk.
-
check_input
(token)¶ Performs checks on the input token. Raises an exception if unsupported.
Parameters: token (Token) – the token to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
-
class
weka.flow.sink.
Null
(name=None, config=None)¶ Bases:
weka.flow.sink.Sink
Sink that just gobbles up all the data.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
-
class
weka.flow.sink.
PRC
(name=None, config=None)¶ Bases:
weka.flow.sink.Sink
Displays the PRC curve obtained from a classifier evaluation.
-
check_input
(token)¶ Performs checks on the input token. Raises an exception if unsupported.
Parameters: token (Token) – the token to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.sink.
ROC
(name=None, config=None)¶ Bases:
weka.flow.sink.Sink
Displays the ROC curve obtained from a classifier evaluation.
-
check_input
(token)¶ Performs checks on the input token. Raises an exception if unsupported.
Parameters: token (Token) – the token to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.sink.
Sink
(name=None, config=None)¶ Bases:
weka.flow.base.InputConsumer
The ancestor for all sinks.
-
post_execute
()¶ Gets executed after the actual execution.
Returns: None if successful, otherwise error message Return type: str
-
weka.flow.source module¶
-
class
weka.flow.source.
CombineStorage
(name=None, config=None)¶ Bases:
weka.flow.source.Source
Expands the storage items specified in format string and forwards the generated string.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.source.
DataGenerator
(name=None, config=None)¶ Bases:
weka.flow.source.Source
Generates artificial data using the specified data generator.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
from_config
(k, v)¶ Hook method that allows converting values from the dictionary.
Parameters: - k (str) – the key in the dictionary
- v (object) – the value
Returns: the potentially parsed value
Return type: object
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
to_config
(k, v)¶ Hook method that allows conversion of individual options.
Parameters: - k (str) – the key of the option
- v (object) – the value
Returns: the potentially processed value
Return type: object
-
-
class
weka.flow.source.
FileSupplier
(name=None, config=None)¶ Bases:
weka.flow.source.Source
Outputs a fixed list of files.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.source.
ForLoop
(name=None, config=None)¶ Bases:
weka.flow.source.Source
Outputs integers using the specified min, max and step.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.source.
GetStorageValue
(name=None, config=None)¶ Bases:
weka.flow.source.Source
Outputs the specified value from storage.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.source.
ListFiles
(name=None, config=None)¶ Bases:
weka.flow.source.Source
Source that list files in a directory.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.source.
LoadDatabase
(name=None, config=None)¶ Bases:
weka.flow.source.Source
Loads a dataset from the database.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.source.
Source
(name=None, config=None)¶ Bases:
weka.flow.base.OutputProducer
,weka.flow.base.Actor
The ancestor for all sources.
-
class
weka.flow.source.
Start
(name=None, config=None)¶ Bases:
weka.flow.source.Source
Outputs a None token for triggering other actors.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
-
class
weka.flow.source.
StringConstants
(name=None, config=None)¶ Bases:
weka.flow.source.Source
Outputs a fixed list of strings.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
weka.flow.transformer module¶
-
class
weka.flow.transformer.
AttributeSelection
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Performs attribute selection on the incoming dataset using the specified search and evaluation scheme. Outputs a AttributeSelectionContainer with the results string, reduced dataset and seleted attributes.
-
check_input
(token)¶ Performs checks on the input token. Raises an exception if unsupported.
Parameters: token (Token) – the token to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.transformer.
ClassSelector
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Sets/unsets the class index of a dataset.
-
check_input
(token)¶ Performs checks on the input token. Raises an exception if unsupported.
Parameters: token (Token) – the token to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.transformer.
Convert
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Converts the input data with the given conversion setup.
-
check_input
(token)¶ Performs checks on the input token. Raises an exception if unsupported.
Parameters: token (Token) – the token to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.transformer.
Copy
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Creates a deep copy of the token passing through (must be a serializable JavaObject), other objects just get passed on.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
-
class
weka.flow.transformer.
CrossValidate
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Cross-validates the classifier/clusterer on the incoming dataset. In case of a classifier, the Evaluation object is forwarded. For clusterers the loglikelihood.
-
check_input
(token)¶ Performs checks on the input token. Raises an exception if unsupported.
Parameters: token (Token) – the token to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.transformer.
DeleteFile
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Deletes the incoming files that match the regular expression.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.transformer.
DeleteStorageValue
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Deletes the specified value from internal storage.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.transformer.
Evaluate
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Evaluates a trained classifier obtained from internal storage on the dataset passing through.
-
check_input
(token)¶ Performs checks on the input token. Raises an exception if unsupported.
Parameters: token (Token) – the token to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.transformer.
EvaluationSummary
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Generates a summary string from an Evaluation/ClusterEvaluation object.
-
check_input
(token)¶ Performs checks on the input token. Raises an exception if unsupported.
Parameters: token (Token) – the token to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.transformer.
Filter
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Filters a dataset with the specified filter setup. Automatically resets the filter if the dataset differs.
-
check_input
(token)¶ Performs checks on the input token. Raises an exception if unsupported.
Parameters: token (Token) – the token to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.transformer.
InitStorageValue
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Initializes the storage value with the provided value (interpreted by ‘eval’ method).
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.transformer.
LoadDataset
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Loads a dataset from a file.
-
check_input
(token)¶ Performs checks on the input token. Raises an exception if unsupported.
Parameters: token (Token) – the token to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
has_output
()¶ Checks whether any output tokens are present.
Returns: true if at least one output token present Return type: bool
-
output
()¶ Returns the next available output token.
Returns: the next token, None if none available Return type: Token
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
stop_execution
()¶ Triggers the stopping of the object.
-
wrapup
()¶ Finishes up after execution finishes, does not remove any graphical output.
-
-
class
weka.flow.transformer.
MathExpression
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Calculates a mathematical expression. The placeholder {X} in the expression gets replaced by the value of the current token passing through. Uses the ‘eval(str)’ method for the calculation, therefore mathematical functions can be accessed using the ‘math’ library, e.g., ‘1 + math.sin({X})’.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.transformer.
ModelReader
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Reads the serialized model (Classifier/Clusterer) from disk and forwards a ModelContainer.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
-
class
weka.flow.transformer.
PassThrough
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Dummy actor that just passes through the data.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
-
class
weka.flow.transformer.
Predict
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Uses the serialized model or, if pointing to a directory, the specified model from storage for making a prediction on the incoming Instance object. The model can be either a Classifier or Clusterer. Outputs either a ClassificationContainer or ClusteringContainer.
-
check_input
(token)¶ Performs checks on the input token. Raises an exception if unsupported.
Parameters: token (Token) – the token to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.transformer.
RenameRelation
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Updates the relation name of Instance/Instances objects passing through.
-
check_input
(token)¶ Performs checks on the input token. Raises an exception if unsupported.
Parameters: token (Token) – the token to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.transformer.
SetStorageValue
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Store the payload of the current token in internal storage using the specified name.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.transformer.
Train
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Trains the classifier/clusterer/associator on the incoming dataset and forwards a ModelContainer with the trained model and the dataset header.
-
check_input
(token)¶ Performs checks on the input token. Raises an exception if unsupported.
Parameters: token (Token) – the token to check
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-
-
class
weka.flow.transformer.
Transformer
(name=None, config=None)¶ Bases:
weka.flow.base.InputConsumer
,weka.flow.base.OutputProducer
The ancestor for all sources.
-
post_execute
()¶ Gets executed after the actual execution.
Returns: None if successful, otherwise error message Return type: str
-
-
class
weka.flow.transformer.
UpdateStorageValue
(name=None, config=None)¶ Bases:
weka.flow.transformer.Transformer
Updates the specified storage value using the epxression interpreted by ‘eval’ method. The current value is available through the variable {X} in the expression.
-
description
()¶ Returns a description of the actor.
Returns: the description Return type: str
-
do_execute
()¶ The actual execution of the actor.
Returns: None if successful, otherwise error message Return type: str
-
fix_config
(options)¶ Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
Parameters: options (dict) – the options to fix Returns: the (potentially) fixed options Return type: dict
-
quickinfo
¶ Returns a short string describing some of the options of the actor.
Returns: the info, None if not available Return type: str
-