Agents API

Visual Agent


Abstract interface for an agent that works for visual agent.

class sail_on_client.agent.visual_agent.VisualAgent[source]

Abstract class for Visual Agent.

static __new__(cls, *args, **kwargs)
Return type

~P

Parameters
  • cls (Type[smqtk_core.plugin.P]) –

  • args (Any) –

  • kwargs (Any) –

abstract execute(toolset, step_descriptor)[source]

Execute method used by the protocol to run different steps associated with the algorithm.

Parameters
  • toolset (dict) – Dictionary containing parameters for different steps

  • step_descriptor (str) – Name of the step

Return type

Any

abstract feature_extraction(fe_toolset)[source]

Abstract method for feature extraction.

Parameters

fe_toolset (Dict) – Parameters for feature extraction

Return type

Tuple[Dict, Dict]

Returns

Tuple of dictionary with features and logits.

classmethod from_config(config_dict, merge_default=True)

Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.

This base method is adequate without modification when a class’s constructor argument types are JSON-compliant. If one or more are not, however, this method then needs to be overridden in order to convert from a JSON-compliant stand-in into the more complex object the constructor requires. It is recommended that when complex types are used they also inherit from the Configurable in order to hopefully make easier the conversion to and from JSON-compliant stand-ins.

When this method does need to be overridden, this usually looks like the following pattern:

D = TypeVar("D", bound="MyClass")

class MyClass (Configurable):

    @classmethod
    def from_config(
        cls: Type[D],
        config_dict: Dict,
        merge_default: bool = True
    ) -> D:
        # Perform a shallow copy of the input ``config_dict`` which
        # is important to maintain idempotency.
        config_dict = dict(config_dict)

        # Optionally guarantee default values are present in the
        # configuration dictionary.  This is useful when the
        # configuration dictionary input is partial and the logic
        # contained here wants to use config parameters that may
        # have defaults defined in the constructor.
        if merge_default:
            config_dict = merge_dict(cls.get_default_config(),
                                     config_dict)

        #
        # Perform any overriding of `config_dict` values here.
        #

        # Create and return an instance using the super method.
        return super().from_config(config_dict,
                                   merge_default=merge_default)

Note on type annotations: When defining a sub-class of configurable and override this class method, we will need to defined a new TypeVar that is bound at the new class type. This is because super requires a type to be given that descends from the implementing type. If C is used as defined in this interface module, which is upper-bounded on the base Configurable class, the type analysis will see that we are attempting to invoke super with a type that may not strictly descend from the implementing type (MyClass in the example above), and cause an error during type analysis.

Parameters
  • config_dict (dict) – JSON compliant dictionary encapsulating a configuration.

  • merge_default (bool) – Merge the given configuration on top of the default provided by get_default_config.

Return type

~C

Returns

Constructed instance from the provided config.

get_config()[source]

Return a default configuration dictionary.

Return type

Dict

classmethod get_default_config()

Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it.

By default, we observe what this class’s constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types.

It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class.

Returns

Default configuration dictionary for the class.

Return type

dict

>>> # noinspection PyUnresolvedReferences
>>> class SimpleConfig(Configurable):
...     def __init__(self, a=1, b='foo'):
...         self.a = a
...         self.b = b
...     def get_config(self):
...         return {'a': self.a, 'b': self.b}
>>> self = SimpleConfig()
>>> config = self.get_default_config()
>>> assert config == {'a': 1, 'b': 'foo'}
classmethod get_impls()

Discover and return a set of classes that implement the calling class.

See the various discover_via_*() functions in this module for more details on the logic of how implementing classes (aka “plugins”) are discovered.

The class-level variables PLUGIN_ENV_VAR and PLUGIN_NAMESPACE may be overridden to change what environment and entry-point extension are looked for, respectively.

Return type

Set[Type[~P]]

Returns

Set of discovered class types that are considered “valid” plugins of this type. See is_valid_plugin() for what we define a “valid” type to be be relative to this class.

classmethod is_usable()[source]

Determine if this class with be detected by SMQTK’s plugin.

Return type

bool

abstract world_detection(wd_toolset)[source]

Abstract method for detecting that the world has changed.

Parameters

wd_toolset (Dict) – Parameters for feature extraction

Return type

str

Returns

Path to results for detecting that the world has changed.

OND Agents


Abstract interface for an agent that works under OND.

class sail_on_client.agent.ond_agent.ONDAgent[source]

Abstract class for OND agent.

static __new__(cls, *args, **kwargs)
Return type

~P

Parameters
  • cls (Type[smqtk_core.plugin.P]) –

  • args (Any) –

  • kwargs (Any) –

abstract execute(toolset, step_descriptor)

Execute method used by the protocol to run different steps associated with the algorithm.

Parameters
  • toolset (dict) – Dictionary containing parameters for different steps

  • step_descriptor (str) – Name of the step

Return type

Any

abstract feature_extraction(fe_toolset)

Abstract method for feature extraction.

Parameters

fe_toolset (Dict) – Parameters for feature extraction

Return type

Tuple[Dict, Dict]

Returns

Tuple of dictionary with features and logits.

classmethod from_config(config_dict, merge_default=True)

Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.

This base method is adequate without modification when a class’s constructor argument types are JSON-compliant. If one or more are not, however, this method then needs to be overridden in order to convert from a JSON-compliant stand-in into the more complex object the constructor requires. It is recommended that when complex types are used they also inherit from the Configurable in order to hopefully make easier the conversion to and from JSON-compliant stand-ins.

When this method does need to be overridden, this usually looks like the following pattern:

D = TypeVar("D", bound="MyClass")

class MyClass (Configurable):

    @classmethod
    def from_config(
        cls: Type[D],
        config_dict: Dict,
        merge_default: bool = True
    ) -> D:
        # Perform a shallow copy of the input ``config_dict`` which
        # is important to maintain idempotency.
        config_dict = dict(config_dict)

        # Optionally guarantee default values are present in the
        # configuration dictionary.  This is useful when the
        # configuration dictionary input is partial and the logic
        # contained here wants to use config parameters that may
        # have defaults defined in the constructor.
        if merge_default:
            config_dict = merge_dict(cls.get_default_config(),
                                     config_dict)

        #
        # Perform any overriding of `config_dict` values here.
        #

        # Create and return an instance using the super method.
        return super().from_config(config_dict,
                                   merge_default=merge_default)

Note on type annotations: When defining a sub-class of configurable and override this class method, we will need to defined a new TypeVar that is bound at the new class type. This is because super requires a type to be given that descends from the implementing type. If C is used as defined in this interface module, which is upper-bounded on the base Configurable class, the type analysis will see that we are attempting to invoke super with a type that may not strictly descend from the implementing type (MyClass in the example above), and cause an error during type analysis.

Parameters
  • config_dict (dict) – JSON compliant dictionary encapsulating a configuration.

  • merge_default (bool) – Merge the given configuration on top of the default provided by get_default_config.

Return type

~C

Returns

Constructed instance from the provided config.

get_config()[source]

Return a default configuration dictionary.

Return type

Dict

classmethod get_default_config()

Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it.

By default, we observe what this class’s constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types.

It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class.

Returns

Default configuration dictionary for the class.

Return type

dict

>>> # noinspection PyUnresolvedReferences
>>> class SimpleConfig(Configurable):
...     def __init__(self, a=1, b='foo'):
...         self.a = a
...         self.b = b
...     def get_config(self):
...         return {'a': self.a, 'b': self.b}
>>> self = SimpleConfig()
>>> config = self.get_default_config()
>>> assert config == {'a': 1, 'b': 'foo'}
classmethod get_impls()

Discover and return a set of classes that implement the calling class.

See the various discover_via_*() functions in this module for more details on the logic of how implementing classes (aka “plugins”) are discovered.

The class-level variables PLUGIN_ENV_VAR and PLUGIN_NAMESPACE may be overridden to change what environment and entry-point extension are looked for, respectively.

Return type

Set[Type[~P]]

Returns

Set of discovered class types that are considered “valid” plugins of this type. See is_valid_plugin() for what we define a “valid” type to be be relative to this class.

classmethod is_usable()

Determine if this class with be detected by SMQTK’s plugin.

Return type

bool

abstract novelty_adaptation(na_toolset)[source]

Abstract method for novelty adaptation.

Parameters

na_toolset (Dict) – Parameters for novelty adaptation

Return type

None

Returns

None

abstract novelty_characterization(nc_toolset)[source]

Abstract method for novelty novelty_characterization.

Parameters

nc_toolset (Dict) – Parameters for feature extraction

Return type

str

Returns

Path to results for novelty characterization.

abstract novelty_classification(ncl_toolset)[source]

Abstract method for novelty classification.

Parameters

ncl_toolset (Dict) – Parameters for feature extraction

Return type

str

Returns

Path to results for novelty classification.

abstract world_detection(wd_toolset)

Abstract method for detecting that the world has changed.

Parameters

wd_toolset (Dict) – Parameters for feature extraction

Return type

str

Returns

Path to results for detecting that the world has changed.


Abstract interface for a baseline that is used to compute reaction performance.

class sail_on_client.agent.ond_reaction_agent.ONDReactionAgent[source]

Abstract class for OND Reaction Agent.

static __new__(cls, *args, **kwargs)
Return type

~P

Parameters
  • cls (Type[smqtk_core.plugin.P]) –

  • args (Any) –

  • kwargs (Any) –

abstract execute(toolset, step_descriptor)[source]

Execute method used by the protocol to run different steps associated with the algorithm.

Parameters
  • toolset (dict) – Dictionary containing parameters for different steps

  • step_descriptor (str) – Name of the step

Return type

Any

abstract feature_extraction(fe_toolset)[source]

Abstract method for feature extraction.

Parameters

fe_toolset (Dict) – Parameters for feature extraction

Return type

Tuple[Dict, Dict]

Returns

Tuple of dictionary with features and logits.

classmethod from_config(config_dict, merge_default=True)

Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.

This base method is adequate without modification when a class’s constructor argument types are JSON-compliant. If one or more are not, however, this method then needs to be overridden in order to convert from a JSON-compliant stand-in into the more complex object the constructor requires. It is recommended that when complex types are used they also inherit from the Configurable in order to hopefully make easier the conversion to and from JSON-compliant stand-ins.

When this method does need to be overridden, this usually looks like the following pattern:

D = TypeVar("D", bound="MyClass")

class MyClass (Configurable):

    @classmethod
    def from_config(
        cls: Type[D],
        config_dict: Dict,
        merge_default: bool = True
    ) -> D:
        # Perform a shallow copy of the input ``config_dict`` which
        # is important to maintain idempotency.
        config_dict = dict(config_dict)

        # Optionally guarantee default values are present in the
        # configuration dictionary.  This is useful when the
        # configuration dictionary input is partial and the logic
        # contained here wants to use config parameters that may
        # have defaults defined in the constructor.
        if merge_default:
            config_dict = merge_dict(cls.get_default_config(),
                                     config_dict)

        #
        # Perform any overriding of `config_dict` values here.
        #

        # Create and return an instance using the super method.
        return super().from_config(config_dict,
                                   merge_default=merge_default)

Note on type annotations: When defining a sub-class of configurable and override this class method, we will need to defined a new TypeVar that is bound at the new class type. This is because super requires a type to be given that descends from the implementing type. If C is used as defined in this interface module, which is upper-bounded on the base Configurable class, the type analysis will see that we are attempting to invoke super with a type that may not strictly descend from the implementing type (MyClass in the example above), and cause an error during type analysis.

Parameters
  • config_dict (dict) – JSON compliant dictionary encapsulating a configuration.

  • merge_default (bool) – Merge the given configuration on top of the default provided by get_default_config.

Return type

~C

Returns

Constructed instance from the provided config.

get_config()[source]

Return a default configuration dictionary.

Return type

Dict

classmethod get_default_config()

Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it.

By default, we observe what this class’s constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types.

It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class.

Returns

Default configuration dictionary for the class.

Return type

dict

>>> # noinspection PyUnresolvedReferences
>>> class SimpleConfig(Configurable):
...     def __init__(self, a=1, b='foo'):
...         self.a = a
...         self.b = b
...     def get_config(self):
...         return {'a': self.a, 'b': self.b}
>>> self = SimpleConfig()
>>> config = self.get_default_config()
>>> assert config == {'a': 1, 'b': 'foo'}
classmethod get_impls()

Discover and return a set of classes that implement the calling class.

See the various discover_via_*() functions in this module for more details on the logic of how implementing classes (aka “plugins”) are discovered.

The class-level variables PLUGIN_ENV_VAR and PLUGIN_NAMESPACE may be overridden to change what environment and entry-point extension are looked for, respectively.

Return type

Set[Type[~P]]

Returns

Set of discovered class types that are considered “valid” plugins of this type. See is_valid_plugin() for what we define a “valid” type to be be relative to this class.

classmethod is_usable()[source]

Determine if this class with be detected by SMQTK’s plugin.

Return type

bool

abstract novelty_classification(ncl_toolset)[source]

Abstract method for detecting that the world has changed.

Parameters

ncl_toolset (Dict) – Parameters for novelty classification

Return type

str

Returns

Path to results for sample wise classification.

Note

reaction agents are primarily used for baselines since they are not required to detect when the world changes

Mock OND Agents


Mocks mainly used for testing protocols.

class sail_on_client.agent.mock_ond_agents.MockONDAdapterWithCheckpoint[source]

Mock Adapter for testing checkpointing.

__init__(toolset)[source]

Detector constructor.

Parameters

toolset (dict) – Dictionary containing parameters for the constructor

Return type

None

static __new__(cls, *args, **kwargs)
Return type

~P

Parameters
  • cls (Type[smqtk_core.plugin.P]) –

  • args (Any) –

  • kwargs (Any) –

execute(toolset, step_descriptor)[source]

Execute method used by the protocol to run different steps.

Parameters
  • toolset (dict) – Dictionary containing parameters for different steps

  • step_descriptor (str) – Name of the step

Return type

Any

feature_extraction(toolset)

Feature extraction step for the algorithm.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

Tuple[Dict[str, Any], Dict[str, Any]]

Returns

Tuple of dictionary

classmethod from_config(config_dict, merge_default=True)

Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.

This base method is adequate without modification when a class’s constructor argument types are JSON-compliant. If one or more are not, however, this method then needs to be overridden in order to convert from a JSON-compliant stand-in into the more complex object the constructor requires. It is recommended that when complex types are used they also inherit from the Configurable in order to hopefully make easier the conversion to and from JSON-compliant stand-ins.

When this method does need to be overridden, this usually looks like the following pattern:

D = TypeVar("D", bound="MyClass")

class MyClass (Configurable):

    @classmethod
    def from_config(
        cls: Type[D],
        config_dict: Dict,
        merge_default: bool = True
    ) -> D:
        # Perform a shallow copy of the input ``config_dict`` which
        # is important to maintain idempotency.
        config_dict = dict(config_dict)

        # Optionally guarantee default values are present in the
        # configuration dictionary.  This is useful when the
        # configuration dictionary input is partial and the logic
        # contained here wants to use config parameters that may
        # have defaults defined in the constructor.
        if merge_default:
            config_dict = merge_dict(cls.get_default_config(),
                                     config_dict)

        #
        # Perform any overriding of `config_dict` values here.
        #

        # Create and return an instance using the super method.
        return super().from_config(config_dict,
                                   merge_default=merge_default)

Note on type annotations: When defining a sub-class of configurable and override this class method, we will need to defined a new TypeVar that is bound at the new class type. This is because super requires a type to be given that descends from the implementing type. If C is used as defined in this interface module, which is upper-bounded on the base Configurable class, the type analysis will see that we are attempting to invoke super with a type that may not strictly descend from the implementing type (MyClass in the example above), and cause an error during type analysis.

Parameters
  • config_dict (dict) – JSON compliant dictionary encapsulating a configuration.

  • merge_default (bool) – Merge the given configuration on top of the default provided by get_default_config.

Return type

~C

Returns

Constructed instance from the provided config.

get_config()[source]

Get config for the plugin.

Return type

Dict

Returns

Parameters for the agent

classmethod get_default_config()

Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it.

By default, we observe what this class’s constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types.

It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class.

Returns

Default configuration dictionary for the class.

Return type

dict

>>> # noinspection PyUnresolvedReferences
>>> class SimpleConfig(Configurable):
...     def __init__(self, a=1, b='foo'):
...         self.a = a
...         self.b = b
...     def get_config(self):
...         return {'a': self.a, 'b': self.b}
>>> self = SimpleConfig()
>>> config = self.get_default_config()
>>> assert config == {'a': 1, 'b': 'foo'}
classmethod get_impls()

Discover and return a set of classes that implement the calling class.

See the various discover_via_*() functions in this module for more details on the logic of how implementing classes (aka “plugins”) are discovered.

The class-level variables PLUGIN_ENV_VAR and PLUGIN_NAMESPACE may be overridden to change what environment and entry-point extension are looked for, respectively.

Return type

Set[Type[~P]]

Returns

Set of discovered class types that are considered “valid” plugins of this type. See is_valid_plugin() for what we define a “valid” type to be be relative to this class.

initialize(toolset)

Algorithm Initialization.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

None

Returns

None

classmethod is_usable()

Determine if this class with be detected by SMQTK’s plugin.

Return type

bool

novelty_adaptation(toolset)

Update models based on novelty classification and characterization.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

None

Returns

None

novelty_characterization(toolset)

Characterize novelty by clustering different novel samples.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for novelty characterization step

novelty_classification(toolset)

Classify data provided in known classes and unknown class.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for novelty classification step

restore_attributes(step_descriptor)

Restore attribute for a detector.

Parameters

step_descriptor (str) – String describing steps for protocol

Return type

None

Returns

None

save_attributes(step_descriptor)

Save attribute for a detector.

Parameters

step_descriptor (str) – String describing steps for protocol

Return type

None

Returns

None

Return type

None

Parameters

step_descriptor (str) –

world_detection(toolset)

Detect change in world ( Novelty has been introduced ).

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for change in world

class sail_on_client.agent.mock_ond_agents.MockONDAgent[source]

Mock Detector for OND Protocol.

__init__()[source]

Construct Mock OND Detector.

Return type

None

static __new__(cls, *args, **kwargs)
Return type

~P

Parameters
  • cls (Type[smqtk_core.plugin.P]) –

  • args (Any) –

  • kwargs (Any) –

execute(toolset, step_descriptor)[source]

Execute method used by the protocol to run different steps.

Parameters
  • toolset (dict) – Dictionary containing parameters for different steps

  • step_descriptor (str) – Name of the step

Return type

Any

feature_extraction(toolset)[source]

Feature extraction step for the algorithm.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

Tuple[Dict[str, Any], Dict[str, Any]]

Returns

Tuple of dictionary

classmethod from_config(config_dict, merge_default=True)

Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.

This base method is adequate without modification when a class’s constructor argument types are JSON-compliant. If one or more are not, however, this method then needs to be overridden in order to convert from a JSON-compliant stand-in into the more complex object the constructor requires. It is recommended that when complex types are used they also inherit from the Configurable in order to hopefully make easier the conversion to and from JSON-compliant stand-ins.

When this method does need to be overridden, this usually looks like the following pattern:

D = TypeVar("D", bound="MyClass")

class MyClass (Configurable):

    @classmethod
    def from_config(
        cls: Type[D],
        config_dict: Dict,
        merge_default: bool = True
    ) -> D:
        # Perform a shallow copy of the input ``config_dict`` which
        # is important to maintain idempotency.
        config_dict = dict(config_dict)

        # Optionally guarantee default values are present in the
        # configuration dictionary.  This is useful when the
        # configuration dictionary input is partial and the logic
        # contained here wants to use config parameters that may
        # have defaults defined in the constructor.
        if merge_default:
            config_dict = merge_dict(cls.get_default_config(),
                                     config_dict)

        #
        # Perform any overriding of `config_dict` values here.
        #

        # Create and return an instance using the super method.
        return super().from_config(config_dict,
                                   merge_default=merge_default)

Note on type annotations: When defining a sub-class of configurable and override this class method, we will need to defined a new TypeVar that is bound at the new class type. This is because super requires a type to be given that descends from the implementing type. If C is used as defined in this interface module, which is upper-bounded on the base Configurable class, the type analysis will see that we are attempting to invoke super with a type that may not strictly descend from the implementing type (MyClass in the example above), and cause an error during type analysis.

Parameters
  • config_dict (dict) – JSON compliant dictionary encapsulating a configuration.

  • merge_default (bool) – Merge the given configuration on top of the default provided by get_default_config.

Return type

~C

Returns

Constructed instance from the provided config.

get_config()

Return a default configuration dictionary.

Return type

Dict

classmethod get_default_config()

Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it.

By default, we observe what this class’s constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types.

It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class.

Returns

Default configuration dictionary for the class.

Return type

dict

>>> # noinspection PyUnresolvedReferences
>>> class SimpleConfig(Configurable):
...     def __init__(self, a=1, b='foo'):
...         self.a = a
...         self.b = b
...     def get_config(self):
...         return {'a': self.a, 'b': self.b}
>>> self = SimpleConfig()
>>> config = self.get_default_config()
>>> assert config == {'a': 1, 'b': 'foo'}
classmethod get_impls()

Discover and return a set of classes that implement the calling class.

See the various discover_via_*() functions in this module for more details on the logic of how implementing classes (aka “plugins”) are discovered.

The class-level variables PLUGIN_ENV_VAR and PLUGIN_NAMESPACE may be overridden to change what environment and entry-point extension are looked for, respectively.

Return type

Set[Type[~P]]

Returns

Set of discovered class types that are considered “valid” plugins of this type. See is_valid_plugin() for what we define a “valid” type to be be relative to this class.

initialize(toolset)[source]

Algorithm Initialization.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

None

Returns

None

classmethod is_usable()

Determine if this class with be detected by SMQTK’s plugin.

Return type

bool

novelty_adaptation(toolset)[source]

Update models based on novelty classification and characterization.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

None

Returns

None

novelty_characterization(toolset)[source]

Characterize novelty by clustering different novel samples.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for novelty characterization step

novelty_classification(toolset)[source]

Classify data provided in known classes and unknown class.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for novelty classification step

world_detection(toolset)[source]

Detect change in world ( Novelty has been introduced ).

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for change in world

class sail_on_client.agent.mock_ond_agents.MockONDAgentWithAttributes[source]

Mock Detector for testing checkpointing.

__init__()[source]

Detector constructor.

Parameters

toolset (dict) – Dictionary containing parameters for the constructor

Return type

None

static __new__(cls, *args, **kwargs)
Return type

~P

Parameters
  • cls (Type[smqtk_core.plugin.P]) –

  • args (Any) –

  • kwargs (Any) –

execute(toolset, step_descriptor)

Execute method used by the protocol to run different steps.

Parameters
  • toolset (dict) – Dictionary containing parameters for different steps

  • step_descriptor (str) – Name of the step

Return type

Any

feature_extraction(toolset)[source]

Feature extraction step for the algorithm.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

Tuple[Dict[str, Any], Dict[str, Any]]

Returns

Tuple of dictionary

classmethod from_config(config_dict, merge_default=True)

Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.

This base method is adequate without modification when a class’s constructor argument types are JSON-compliant. If one or more are not, however, this method then needs to be overridden in order to convert from a JSON-compliant stand-in into the more complex object the constructor requires. It is recommended that when complex types are used they also inherit from the Configurable in order to hopefully make easier the conversion to and from JSON-compliant stand-ins.

When this method does need to be overridden, this usually looks like the following pattern:

D = TypeVar("D", bound="MyClass")

class MyClass (Configurable):

    @classmethod
    def from_config(
        cls: Type[D],
        config_dict: Dict,
        merge_default: bool = True
    ) -> D:
        # Perform a shallow copy of the input ``config_dict`` which
        # is important to maintain idempotency.
        config_dict = dict(config_dict)

        # Optionally guarantee default values are present in the
        # configuration dictionary.  This is useful when the
        # configuration dictionary input is partial and the logic
        # contained here wants to use config parameters that may
        # have defaults defined in the constructor.
        if merge_default:
            config_dict = merge_dict(cls.get_default_config(),
                                     config_dict)

        #
        # Perform any overriding of `config_dict` values here.
        #

        # Create and return an instance using the super method.
        return super().from_config(config_dict,
                                   merge_default=merge_default)

Note on type annotations: When defining a sub-class of configurable and override this class method, we will need to defined a new TypeVar that is bound at the new class type. This is because super requires a type to be given that descends from the implementing type. If C is used as defined in this interface module, which is upper-bounded on the base Configurable class, the type analysis will see that we are attempting to invoke super with a type that may not strictly descend from the implementing type (MyClass in the example above), and cause an error during type analysis.

Parameters
  • config_dict (dict) – JSON compliant dictionary encapsulating a configuration.

  • merge_default (bool) – Merge the given configuration on top of the default provided by get_default_config.

Return type

~C

Returns

Constructed instance from the provided config.

get_config()

Return a default configuration dictionary.

Return type

Dict

classmethod get_default_config()

Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it.

By default, we observe what this class’s constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types.

It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class.

Returns

Default configuration dictionary for the class.

Return type

dict

>>> # noinspection PyUnresolvedReferences
>>> class SimpleConfig(Configurable):
...     def __init__(self, a=1, b='foo'):
...         self.a = a
...         self.b = b
...     def get_config(self):
...         return {'a': self.a, 'b': self.b}
>>> self = SimpleConfig()
>>> config = self.get_default_config()
>>> assert config == {'a': 1, 'b': 'foo'}
classmethod get_impls()

Discover and return a set of classes that implement the calling class.

See the various discover_via_*() functions in this module for more details on the logic of how implementing classes (aka “plugins”) are discovered.

The class-level variables PLUGIN_ENV_VAR and PLUGIN_NAMESPACE may be overridden to change what environment and entry-point extension are looked for, respectively.

Return type

Set[Type[~P]]

Returns

Set of discovered class types that are considered “valid” plugins of this type. See is_valid_plugin() for what we define a “valid” type to be be relative to this class.

initialize(toolset)

Algorithm Initialization.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

None

Returns

None

classmethod is_usable()

Determine if this class with be detected by SMQTK’s plugin.

Return type

bool

novelty_adaptation(toolset)

Update models based on novelty classification and characterization.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

None

Returns

None

novelty_characterization(toolset)

Characterize novelty by clustering different novel samples.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for novelty characterization step

novelty_classification(toolset)

Classify data provided in known classes and unknown class.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for novelty classification step

world_detection(toolset)

Detect change in world ( Novelty has been introduced ).

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for change in world

Pre Computed Agents


Agents that use precomputed values in the protocol.

class sail_on_client.agent.pre_computed_detector.PreComputedAgent[source]

Detector for submitting precomputed results.

__init__(algorithm_name, cache_dir, has_roundwise_file, round_size)[source]

Construct agent with precomputed results.

Parameters
  • algorithm_name (str) – Name of the algorithm

  • cache_dir (str) – Path to cache directory

  • has_roundwise_file (bool) – Flag to determine if the cache has files for rounds

  • round_size (int) – Size of a round

Return type

None

static __new__(cls, *args, **kwargs)
Return type

~P

Parameters
  • cls (Type[smqtk_core.plugin.P]) –

  • args (Any) –

  • kwargs (Any) –

execute(toolset, step_descriptor)[source]

Execute method used by the protocol to run different steps associated with the algorithm.

Parameters
  • toolset (dict) – Dictionary containing parameters for different steps

  • step_descriptor (str) – Name of the step

Return type

Any

feature_extraction(toolset)[source]

Feature extraction step for the algorithm.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

Tuple[Dict[str, Any], Dict[str, Any]]

Returns

Tuple of dictionary

classmethod from_config(config_dict, merge_default=True)

Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.

This base method is adequate without modification when a class’s constructor argument types are JSON-compliant. If one or more are not, however, this method then needs to be overridden in order to convert from a JSON-compliant stand-in into the more complex object the constructor requires. It is recommended that when complex types are used they also inherit from the Configurable in order to hopefully make easier the conversion to and from JSON-compliant stand-ins.

When this method does need to be overridden, this usually looks like the following pattern:

D = TypeVar("D", bound="MyClass")

class MyClass (Configurable):

    @classmethod
    def from_config(
        cls: Type[D],
        config_dict: Dict,
        merge_default: bool = True
    ) -> D:
        # Perform a shallow copy of the input ``config_dict`` which
        # is important to maintain idempotency.
        config_dict = dict(config_dict)

        # Optionally guarantee default values are present in the
        # configuration dictionary.  This is useful when the
        # configuration dictionary input is partial and the logic
        # contained here wants to use config parameters that may
        # have defaults defined in the constructor.
        if merge_default:
            config_dict = merge_dict(cls.get_default_config(),
                                     config_dict)

        #
        # Perform any overriding of `config_dict` values here.
        #

        # Create and return an instance using the super method.
        return super().from_config(config_dict,
                                   merge_default=merge_default)

Note on type annotations: When defining a sub-class of configurable and override this class method, we will need to defined a new TypeVar that is bound at the new class type. This is because super requires a type to be given that descends from the implementing type. If C is used as defined in this interface module, which is upper-bounded on the base Configurable class, the type analysis will see that we are attempting to invoke super with a type that may not strictly descend from the implementing type (MyClass in the example above), and cause an error during type analysis.

Parameters
  • config_dict (dict) – JSON compliant dictionary encapsulating a configuration.

  • merge_default (bool) – Merge the given configuration on top of the default provided by get_default_config.

Return type

~C

Returns

Constructed instance from the provided config.

get_config()[source]

Return a default configuration dictionary.

Return type

Dict

classmethod get_default_config()

Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it.

By default, we observe what this class’s constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types.

It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class.

Returns

Default configuration dictionary for the class.

Return type

dict

>>> # noinspection PyUnresolvedReferences
>>> class SimpleConfig(Configurable):
...     def __init__(self, a=1, b='foo'):
...         self.a = a
...         self.b = b
...     def get_config(self):
...         return {'a': self.a, 'b': self.b}
>>> self = SimpleConfig()
>>> config = self.get_default_config()
>>> assert config == {'a': 1, 'b': 'foo'}
classmethod get_impls()

Discover and return a set of classes that implement the calling class.

See the various discover_via_*() functions in this module for more details on the logic of how implementing classes (aka “plugins”) are discovered.

The class-level variables PLUGIN_ENV_VAR and PLUGIN_NAMESPACE may be overridden to change what environment and entry-point extension are looked for, respectively.

Return type

Set[Type[~P]]

Returns

Set of discovered class types that are considered “valid” plugins of this type. See is_valid_plugin() for what we define a “valid” type to be be relative to this class.

initialize(toolset)[source]

Algorithm Initialization.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

None

Returns

None

classmethod is_usable()

Determine if this class with be detected by SMQTK’s plugin.

Return type

bool

world_detection(toolset)[source]

Detect change in world ( Novelty has been introduced ).

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for change in world

class sail_on_client.agent.pre_computed_detector.PreComputedCONDDAAgent[source]

Detector for submitting precomputed results in CONDDA.

__init__(algorithm_name, cache_dir, has_roundwise_file, round_size)[source]

Construct agent with precomputed results for CONDDA.

Parameters
  • algorithm_name (str) – Name of the algorithm

  • cache_dir (str) – Path to cache directory

  • has_roundwise_file (bool) – Flag to determine if the cache has files for rounds

  • round_size (int) – Size of a round

Return type

None

static __new__(cls, *args, **kwargs)
Return type

~P

Parameters
  • cls (Type[smqtk_core.plugin.P]) –

  • args (Any) –

  • kwargs (Any) –

execute(toolset, step_descriptor)

Execute method used by the protocol to run different steps associated with the algorithm.

Parameters
  • toolset (dict) – Dictionary containing parameters for different steps

  • step_descriptor (str) – Name of the step

Return type

Any

feature_extraction(toolset)

Feature extraction step for the algorithm.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

Tuple[Dict[str, Any], Dict[str, Any]]

Returns

Tuple of dictionary

classmethod from_config(config_dict, merge_default=True)

Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.

This base method is adequate without modification when a class’s constructor argument types are JSON-compliant. If one or more are not, however, this method then needs to be overridden in order to convert from a JSON-compliant stand-in into the more complex object the constructor requires. It is recommended that when complex types are used they also inherit from the Configurable in order to hopefully make easier the conversion to and from JSON-compliant stand-ins.

When this method does need to be overridden, this usually looks like the following pattern:

D = TypeVar("D", bound="MyClass")

class MyClass (Configurable):

    @classmethod
    def from_config(
        cls: Type[D],
        config_dict: Dict,
        merge_default: bool = True
    ) -> D:
        # Perform a shallow copy of the input ``config_dict`` which
        # is important to maintain idempotency.
        config_dict = dict(config_dict)

        # Optionally guarantee default values are present in the
        # configuration dictionary.  This is useful when the
        # configuration dictionary input is partial and the logic
        # contained here wants to use config parameters that may
        # have defaults defined in the constructor.
        if merge_default:
            config_dict = merge_dict(cls.get_default_config(),
                                     config_dict)

        #
        # Perform any overriding of `config_dict` values here.
        #

        # Create and return an instance using the super method.
        return super().from_config(config_dict,
                                   merge_default=merge_default)

Note on type annotations: When defining a sub-class of configurable and override this class method, we will need to defined a new TypeVar that is bound at the new class type. This is because super requires a type to be given that descends from the implementing type. If C is used as defined in this interface module, which is upper-bounded on the base Configurable class, the type analysis will see that we are attempting to invoke super with a type that may not strictly descend from the implementing type (MyClass in the example above), and cause an error during type analysis.

Parameters
  • config_dict (dict) – JSON compliant dictionary encapsulating a configuration.

  • merge_default (bool) – Merge the given configuration on top of the default provided by get_default_config.

Return type

~C

Returns

Constructed instance from the provided config.

get_config()

Return a default configuration dictionary.

Return type

Dict

classmethod get_default_config()

Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it.

By default, we observe what this class’s constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types.

It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class.

Returns

Default configuration dictionary for the class.

Return type

dict

>>> # noinspection PyUnresolvedReferences
>>> class SimpleConfig(Configurable):
...     def __init__(self, a=1, b='foo'):
...         self.a = a
...         self.b = b
...     def get_config(self):
...         return {'a': self.a, 'b': self.b}
>>> self = SimpleConfig()
>>> config = self.get_default_config()
>>> assert config == {'a': 1, 'b': 'foo'}
classmethod get_impls()

Discover and return a set of classes that implement the calling class.

See the various discover_via_*() functions in this module for more details on the logic of how implementing classes (aka “plugins”) are discovered.

The class-level variables PLUGIN_ENV_VAR and PLUGIN_NAMESPACE may be overridden to change what environment and entry-point extension are looked for, respectively.

Return type

Set[Type[~P]]

Returns

Set of discovered class types that are considered “valid” plugins of this type. See is_valid_plugin() for what we define a “valid” type to be be relative to this class.

initialize(toolset)

Algorithm Initialization.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

None

Returns

None

classmethod is_usable()

Determine if this class with be detected by SMQTK’s plugin.

Return type

bool

novelty_characterization(toolset)[source]

Characterize novelty by clustering different novel samples.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for novelty characterization step

world_detection(toolset)

Detect change in world ( Novelty has been introduced ).

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for change in world

class sail_on_client.agent.pre_computed_detector.PreComputedONDAgent[source]

Detector for submitting precomputed results in OND.

__init__(algorithm_name, cache_dir, has_roundwise_file, round_size)[source]

Construct agent with precomputed results for OND.

Parameters
  • algorithm_name (str) – Name of the algorithm

  • cache_dir (str) – Path to cache directory

  • has_roundwise_file (bool) – Flag to determine if the cache has files for rounds

  • round_size (int) – Size of a round

Return type

None

static __new__(cls, *args, **kwargs)
Return type

~P

Parameters
  • cls (Type[smqtk_core.plugin.P]) –

  • args (Any) –

  • kwargs (Any) –

execute(toolset, step_descriptor)

Execute method used by the protocol to run different steps associated with the algorithm.

Parameters
  • toolset (dict) – Dictionary containing parameters for different steps

  • step_descriptor (str) – Name of the step

Return type

Any

feature_extraction(toolset)

Feature extraction step for the algorithm.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

Tuple[Dict[str, Any], Dict[str, Any]]

Returns

Tuple of dictionary

classmethod from_config(config_dict, merge_default=True)

Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.

This base method is adequate without modification when a class’s constructor argument types are JSON-compliant. If one or more are not, however, this method then needs to be overridden in order to convert from a JSON-compliant stand-in into the more complex object the constructor requires. It is recommended that when complex types are used they also inherit from the Configurable in order to hopefully make easier the conversion to and from JSON-compliant stand-ins.

When this method does need to be overridden, this usually looks like the following pattern:

D = TypeVar("D", bound="MyClass")

class MyClass (Configurable):

    @classmethod
    def from_config(
        cls: Type[D],
        config_dict: Dict,
        merge_default: bool = True
    ) -> D:
        # Perform a shallow copy of the input ``config_dict`` which
        # is important to maintain idempotency.
        config_dict = dict(config_dict)

        # Optionally guarantee default values are present in the
        # configuration dictionary.  This is useful when the
        # configuration dictionary input is partial and the logic
        # contained here wants to use config parameters that may
        # have defaults defined in the constructor.
        if merge_default:
            config_dict = merge_dict(cls.get_default_config(),
                                     config_dict)

        #
        # Perform any overriding of `config_dict` values here.
        #

        # Create and return an instance using the super method.
        return super().from_config(config_dict,
                                   merge_default=merge_default)

Note on type annotations: When defining a sub-class of configurable and override this class method, we will need to defined a new TypeVar that is bound at the new class type. This is because super requires a type to be given that descends from the implementing type. If C is used as defined in this interface module, which is upper-bounded on the base Configurable class, the type analysis will see that we are attempting to invoke super with a type that may not strictly descend from the implementing type (MyClass in the example above), and cause an error during type analysis.

Parameters
  • config_dict (dict) – JSON compliant dictionary encapsulating a configuration.

  • merge_default (bool) – Merge the given configuration on top of the default provided by get_default_config.

Return type

~C

Returns

Constructed instance from the provided config.

get_config()

Return a default configuration dictionary.

Return type

Dict

classmethod get_default_config()

Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it.

By default, we observe what this class’s constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types.

It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class.

Returns

Default configuration dictionary for the class.

Return type

dict

>>> # noinspection PyUnresolvedReferences
>>> class SimpleConfig(Configurable):
...     def __init__(self, a=1, b='foo'):
...         self.a = a
...         self.b = b
...     def get_config(self):
...         return {'a': self.a, 'b': self.b}
>>> self = SimpleConfig()
>>> config = self.get_default_config()
>>> assert config == {'a': 1, 'b': 'foo'}
classmethod get_impls()

Discover and return a set of classes that implement the calling class.

See the various discover_via_*() functions in this module for more details on the logic of how implementing classes (aka “plugins”) are discovered.

The class-level variables PLUGIN_ENV_VAR and PLUGIN_NAMESPACE may be overridden to change what environment and entry-point extension are looked for, respectively.

Return type

Set[Type[~P]]

Returns

Set of discovered class types that are considered “valid” plugins of this type. See is_valid_plugin() for what we define a “valid” type to be be relative to this class.

initialize(toolset)

Algorithm Initialization.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

None

Returns

None

classmethod is_usable()

Determine if this class with be detected by SMQTK’s plugin.

Return type

bool

novelty_adaptation(toolset)[source]

Update models based on novelty classification and characterization.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

None

Returns

None

novelty_characterization(toolset)[source]

Characterize novelty by clustering different novel samples.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for novelty characterization step

novelty_classification(toolset)[source]

Classify data provided in known classes and unknown class.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for novelty classification step

world_detection(toolset)

Detect change in world ( Novelty has been introduced ).

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for change in world


Reaction agent that use precomputed values in the OND protocol.

class sail_on_client.agent.pre_computed_reaction_agent.PreComputedONDReactionAgent[source]

Detector for submitting precomputed results for computing reaction performance.

__init__(algorithm_name, cache_dir, has_roundwise_file, round_size)[source]

Construct agent with precomputed results.

Parameters
  • algorithm_name (str) – Name of the algorithm

  • cache_dir (str) – Path to cache directory

  • has_roundwise_file (bool) – Flag to determine if the cache has files for rounds

  • round_size (int) – Size of a round

Return type

None

static __new__(cls, *args, **kwargs)
Return type

~P

Parameters
  • cls (Type[smqtk_core.plugin.P]) –

  • args (Any) –

  • kwargs (Any) –

execute(toolset, step_descriptor)[source]

Execute method used by the protocol to run different steps associated with the algorithm.

Parameters
  • toolset (dict) – Dictionary containing parameters for different steps

  • step_descriptor (str) – Name of the step

Return type

Any

feature_extraction(toolset)[source]

Feature extraction step for the algorithm.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

Tuple[Dict[str, Any], Dict[str, Any]]

Returns

Tuple of dictionary

classmethod from_config(config_dict, merge_default=True)

Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.

This base method is adequate without modification when a class’s constructor argument types are JSON-compliant. If one or more are not, however, this method then needs to be overridden in order to convert from a JSON-compliant stand-in into the more complex object the constructor requires. It is recommended that when complex types are used they also inherit from the Configurable in order to hopefully make easier the conversion to and from JSON-compliant stand-ins.

When this method does need to be overridden, this usually looks like the following pattern:

D = TypeVar("D", bound="MyClass")

class MyClass (Configurable):

    @classmethod
    def from_config(
        cls: Type[D],
        config_dict: Dict,
        merge_default: bool = True
    ) -> D:
        # Perform a shallow copy of the input ``config_dict`` which
        # is important to maintain idempotency.
        config_dict = dict(config_dict)

        # Optionally guarantee default values are present in the
        # configuration dictionary.  This is useful when the
        # configuration dictionary input is partial and the logic
        # contained here wants to use config parameters that may
        # have defaults defined in the constructor.
        if merge_default:
            config_dict = merge_dict(cls.get_default_config(),
                                     config_dict)

        #
        # Perform any overriding of `config_dict` values here.
        #

        # Create and return an instance using the super method.
        return super().from_config(config_dict,
                                   merge_default=merge_default)

Note on type annotations: When defining a sub-class of configurable and override this class method, we will need to defined a new TypeVar that is bound at the new class type. This is because super requires a type to be given that descends from the implementing type. If C is used as defined in this interface module, which is upper-bounded on the base Configurable class, the type analysis will see that we are attempting to invoke super with a type that may not strictly descend from the implementing type (MyClass in the example above), and cause an error during type analysis.

Parameters
  • config_dict (dict) – JSON compliant dictionary encapsulating a configuration.

  • merge_default (bool) – Merge the given configuration on top of the default provided by get_default_config.

Return type

~C

Returns

Constructed instance from the provided config.

get_config()[source]

Return a default configuration dictionary.

Return type

Dict

classmethod get_default_config()

Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it.

By default, we observe what this class’s constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types.

It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class.

Returns

Default configuration dictionary for the class.

Return type

dict

>>> # noinspection PyUnresolvedReferences
>>> class SimpleConfig(Configurable):
...     def __init__(self, a=1, b='foo'):
...         self.a = a
...         self.b = b
...     def get_config(self):
...         return {'a': self.a, 'b': self.b}
>>> self = SimpleConfig()
>>> config = self.get_default_config()
>>> assert config == {'a': 1, 'b': 'foo'}
classmethod get_impls()

Discover and return a set of classes that implement the calling class.

See the various discover_via_*() functions in this module for more details on the logic of how implementing classes (aka “plugins”) are discovered.

The class-level variables PLUGIN_ENV_VAR and PLUGIN_NAMESPACE may be overridden to change what environment and entry-point extension are looked for, respectively.

Return type

Set[Type[~P]]

Returns

Set of discovered class types that are considered “valid” plugins of this type. See is_valid_plugin() for what we define a “valid” type to be be relative to this class.

initialize(toolset)[source]

Algorithm Initialization.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

None

Returns

None

classmethod is_usable()

Determine if this class with be detected by SMQTK’s plugin.

Return type

bool

novelty_classification(toolset)[source]

Classify data provided in known classes and unknown class.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for novelty classification step

CONDDA Agents


Abstract interface for an agent that works under CONDDA.

class sail_on_client.agent.condda_agent.CONDDAAgent[source]

Abstract class for OND agent.

static __new__(cls, *args, **kwargs)
Return type

~P

Parameters
  • cls (Type[smqtk_core.plugin.P]) –

  • args (Any) –

  • kwargs (Any) –

abstract execute(toolset, step_descriptor)

Execute method used by the protocol to run different steps associated with the algorithm.

Parameters
  • toolset (dict) – Dictionary containing parameters for different steps

  • step_descriptor (str) – Name of the step

Return type

Any

abstract feature_extraction(fe_toolset)

Abstract method for feature extraction.

Parameters

fe_toolset (Dict) – Parameters for feature extraction

Return type

Tuple[Dict, Dict]

Returns

Tuple of dictionary with features and logits.

classmethod from_config(config_dict, merge_default=True)

Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.

This base method is adequate without modification when a class’s constructor argument types are JSON-compliant. If one or more are not, however, this method then needs to be overridden in order to convert from a JSON-compliant stand-in into the more complex object the constructor requires. It is recommended that when complex types are used they also inherit from the Configurable in order to hopefully make easier the conversion to and from JSON-compliant stand-ins.

When this method does need to be overridden, this usually looks like the following pattern:

D = TypeVar("D", bound="MyClass")

class MyClass (Configurable):

    @classmethod
    def from_config(
        cls: Type[D],
        config_dict: Dict,
        merge_default: bool = True
    ) -> D:
        # Perform a shallow copy of the input ``config_dict`` which
        # is important to maintain idempotency.
        config_dict = dict(config_dict)

        # Optionally guarantee default values are present in the
        # configuration dictionary.  This is useful when the
        # configuration dictionary input is partial and the logic
        # contained here wants to use config parameters that may
        # have defaults defined in the constructor.
        if merge_default:
            config_dict = merge_dict(cls.get_default_config(),
                                     config_dict)

        #
        # Perform any overriding of `config_dict` values here.
        #

        # Create and return an instance using the super method.
        return super().from_config(config_dict,
                                   merge_default=merge_default)

Note on type annotations: When defining a sub-class of configurable and override this class method, we will need to defined a new TypeVar that is bound at the new class type. This is because super requires a type to be given that descends from the implementing type. If C is used as defined in this interface module, which is upper-bounded on the base Configurable class, the type analysis will see that we are attempting to invoke super with a type that may not strictly descend from the implementing type (MyClass in the example above), and cause an error during type analysis.

Parameters
  • config_dict (dict) – JSON compliant dictionary encapsulating a configuration.

  • merge_default (bool) – Merge the given configuration on top of the default provided by get_default_config.

Return type

~C

Returns

Constructed instance from the provided config.

get_config()[source]

Return a default configuration dictionary.

Return type

Dict

classmethod get_default_config()

Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it.

By default, we observe what this class’s constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types.

It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class.

Returns

Default configuration dictionary for the class.

Return type

dict

>>> # noinspection PyUnresolvedReferences
>>> class SimpleConfig(Configurable):
...     def __init__(self, a=1, b='foo'):
...         self.a = a
...         self.b = b
...     def get_config(self):
...         return {'a': self.a, 'b': self.b}
>>> self = SimpleConfig()
>>> config = self.get_default_config()
>>> assert config == {'a': 1, 'b': 'foo'}
classmethod get_impls()

Discover and return a set of classes that implement the calling class.

See the various discover_via_*() functions in this module for more details on the logic of how implementing classes (aka “plugins”) are discovered.

The class-level variables PLUGIN_ENV_VAR and PLUGIN_NAMESPACE may be overridden to change what environment and entry-point extension are looked for, respectively.

Return type

Set[Type[~P]]

Returns

Set of discovered class types that are considered “valid” plugins of this type. See is_valid_plugin() for what we define a “valid” type to be be relative to this class.

classmethod is_usable()

Determine if this class with be detected by SMQTK’s plugin.

Return type

bool

abstract novelty_characterization(nc_toolset)[source]

Abstract method for novelty novelty_characterization.

Parameters

nc_toolset (Dict) – Parameters for feature extraction

Return type

str

Returns

Path to results for novelty characterization.

abstract world_detection(wd_toolset)

Abstract method for detecting that the world has changed.

Parameters

wd_toolset (Dict) – Parameters for feature extraction

Return type

str

Returns

Path to results for detecting that the world has changed.

Mock CONDDA Agents


Mocks mainly used for testing CONDDA.

class sail_on_client.agent.mock_condda_agents.MockCONDDAAdapterWithCheckpoint[source]

Mock Adapter for testing checkpointing.

__init__(toolset)[source]

Detector constructor.

Parameters

toolset (dict) – Dictionary containing parameters for the constructor

Return type

None

static __new__(cls, *args, **kwargs)
Return type

~P

Parameters
  • cls (Type[smqtk_core.plugin.P]) –

  • args (Any) –

  • kwargs (Any) –

execute(toolset, step_descriptor)[source]

Execute method used by the protocol to run different steps.

Parameters
  • toolset (dict) – Dictionary containing parameters for different steps

  • step_descriptor (str) – Name of the step

Return type

Any

feature_extraction(toolset)

Feature extraction step for the algorithm.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

Tuple[Dict[str, Any], Dict[str, Any]]

Returns

Tuple of dictionary

classmethod from_config(config_dict, merge_default=True)

Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.

This base method is adequate without modification when a class’s constructor argument types are JSON-compliant. If one or more are not, however, this method then needs to be overridden in order to convert from a JSON-compliant stand-in into the more complex object the constructor requires. It is recommended that when complex types are used they also inherit from the Configurable in order to hopefully make easier the conversion to and from JSON-compliant stand-ins.

When this method does need to be overridden, this usually looks like the following pattern:

D = TypeVar("D", bound="MyClass")

class MyClass (Configurable):

    @classmethod
    def from_config(
        cls: Type[D],
        config_dict: Dict,
        merge_default: bool = True
    ) -> D:
        # Perform a shallow copy of the input ``config_dict`` which
        # is important to maintain idempotency.
        config_dict = dict(config_dict)

        # Optionally guarantee default values are present in the
        # configuration dictionary.  This is useful when the
        # configuration dictionary input is partial and the logic
        # contained here wants to use config parameters that may
        # have defaults defined in the constructor.
        if merge_default:
            config_dict = merge_dict(cls.get_default_config(),
                                     config_dict)

        #
        # Perform any overriding of `config_dict` values here.
        #

        # Create and return an instance using the super method.
        return super().from_config(config_dict,
                                   merge_default=merge_default)

Note on type annotations: When defining a sub-class of configurable and override this class method, we will need to defined a new TypeVar that is bound at the new class type. This is because super requires a type to be given that descends from the implementing type. If C is used as defined in this interface module, which is upper-bounded on the base Configurable class, the type analysis will see that we are attempting to invoke super with a type that may not strictly descend from the implementing type (MyClass in the example above), and cause an error during type analysis.

Parameters
  • config_dict (dict) – JSON compliant dictionary encapsulating a configuration.

  • merge_default (bool) – Merge the given configuration on top of the default provided by get_default_config.

Return type

~C

Returns

Constructed instance from the provided config.

get_config()[source]

Get config for the plugin.

Return type

Dict

Returns

Parameters for the agent

classmethod get_default_config()

Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it.

By default, we observe what this class’s constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types.

It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class.

Returns

Default configuration dictionary for the class.

Return type

dict

>>> # noinspection PyUnresolvedReferences
>>> class SimpleConfig(Configurable):
...     def __init__(self, a=1, b='foo'):
...         self.a = a
...         self.b = b
...     def get_config(self):
...         return {'a': self.a, 'b': self.b}
>>> self = SimpleConfig()
>>> config = self.get_default_config()
>>> assert config == {'a': 1, 'b': 'foo'}
classmethod get_impls()

Discover and return a set of classes that implement the calling class.

See the various discover_via_*() functions in this module for more details on the logic of how implementing classes (aka “plugins”) are discovered.

The class-level variables PLUGIN_ENV_VAR and PLUGIN_NAMESPACE may be overridden to change what environment and entry-point extension are looked for, respectively.

Return type

Set[Type[~P]]

Returns

Set of discovered class types that are considered “valid” plugins of this type. See is_valid_plugin() for what we define a “valid” type to be be relative to this class.

initialize(toolset)

Algorithm Initialization.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

None

Returns

None

classmethod is_usable()

Determine if this class with be detected by SMQTK’s plugin.

Return type

bool

novelty_characterization(toolset)

Characterize novelty by clustering different novel samples.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for novelty characterization step

restore_attributes(step_descriptor)

Restore attribute for a detector.

Parameters

step_descriptor (str) – String describing steps for protocol

Return type

None

Returns

None

save_attributes(step_descriptor)

Save attribute for a detector.

Parameters

step_descriptor (str) – String describing steps for protocol

Return type

None

Returns

None

Return type

None

Parameters

step_descriptor (str) –

world_detection(toolset)

Detect change in world ( Novelty has been introduced ).

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for change in world

class sail_on_client.agent.mock_condda_agents.MockCONDDAAgent[source]

Mock Detector for CONDDA Protocol.

__init__()[source]

Construct Mock CONDDA Detector.

Return type

None

static __new__(cls, *args, **kwargs)
Return type

~P

Parameters
  • cls (Type[smqtk_core.plugin.P]) –

  • args (Any) –

  • kwargs (Any) –

execute(toolset, step_descriptor)[source]

Execute method used by the protocol to run different steps.

Parameters
  • toolset (dict) – Dictionary containing parameters for different steps

  • step_descriptor (str) – Name of the step

Return type

Any

feature_extraction(toolset)[source]

Feature extraction step for the algorithm.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

Tuple[Dict[str, Any], Dict[str, Any]]

Returns

Tuple of dictionary

classmethod from_config(config_dict, merge_default=True)

Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.

This base method is adequate without modification when a class’s constructor argument types are JSON-compliant. If one or more are not, however, this method then needs to be overridden in order to convert from a JSON-compliant stand-in into the more complex object the constructor requires. It is recommended that when complex types are used they also inherit from the Configurable in order to hopefully make easier the conversion to and from JSON-compliant stand-ins.

When this method does need to be overridden, this usually looks like the following pattern:

D = TypeVar("D", bound="MyClass")

class MyClass (Configurable):

    @classmethod
    def from_config(
        cls: Type[D],
        config_dict: Dict,
        merge_default: bool = True
    ) -> D:
        # Perform a shallow copy of the input ``config_dict`` which
        # is important to maintain idempotency.
        config_dict = dict(config_dict)

        # Optionally guarantee default values are present in the
        # configuration dictionary.  This is useful when the
        # configuration dictionary input is partial and the logic
        # contained here wants to use config parameters that may
        # have defaults defined in the constructor.
        if merge_default:
            config_dict = merge_dict(cls.get_default_config(),
                                     config_dict)

        #
        # Perform any overriding of `config_dict` values here.
        #

        # Create and return an instance using the super method.
        return super().from_config(config_dict,
                                   merge_default=merge_default)

Note on type annotations: When defining a sub-class of configurable and override this class method, we will need to defined a new TypeVar that is bound at the new class type. This is because super requires a type to be given that descends from the implementing type. If C is used as defined in this interface module, which is upper-bounded on the base Configurable class, the type analysis will see that we are attempting to invoke super with a type that may not strictly descend from the implementing type (MyClass in the example above), and cause an error during type analysis.

Parameters
  • config_dict (dict) – JSON compliant dictionary encapsulating a configuration.

  • merge_default (bool) – Merge the given configuration on top of the default provided by get_default_config.

Return type

~C

Returns

Constructed instance from the provided config.

get_config()[source]

Get config for the plugin.

Return type

Dict

Returns

Parameters for the agent

classmethod get_default_config()

Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it.

By default, we observe what this class’s constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types.

It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class.

Returns

Default configuration dictionary for the class.

Return type

dict

>>> # noinspection PyUnresolvedReferences
>>> class SimpleConfig(Configurable):
...     def __init__(self, a=1, b='foo'):
...         self.a = a
...         self.b = b
...     def get_config(self):
...         return {'a': self.a, 'b': self.b}
>>> self = SimpleConfig()
>>> config = self.get_default_config()
>>> assert config == {'a': 1, 'b': 'foo'}
classmethod get_impls()

Discover and return a set of classes that implement the calling class.

See the various discover_via_*() functions in this module for more details on the logic of how implementing classes (aka “plugins”) are discovered.

The class-level variables PLUGIN_ENV_VAR and PLUGIN_NAMESPACE may be overridden to change what environment and entry-point extension are looked for, respectively.

Return type

Set[Type[~P]]

Returns

Set of discovered class types that are considered “valid” plugins of this type. See is_valid_plugin() for what we define a “valid” type to be be relative to this class.

initialize(toolset)[source]

Algorithm Initialization.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

None

Returns

None

classmethod is_usable()

Determine if this class with be detected by SMQTK’s plugin.

Return type

bool

novelty_characterization(toolset)[source]

Characterize novelty by clustering different novel samples.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for novelty characterization step

world_detection(toolset)[source]

Detect change in world ( Novelty has been introduced ).

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for change in world

class sail_on_client.agent.mock_condda_agents.MockCONDDAAgentWithAttributes[source]

Mock Detector for testing checkpointing.

__init__()[source]

Detector constructor.

Parameters

toolset (dict) – Dictionary containing parameters for the constructor

Return type

None

static __new__(cls, *args, **kwargs)
Return type

~P

Parameters
  • cls (Type[smqtk_core.plugin.P]) –

  • args (Any) –

  • kwargs (Any) –

execute(toolset, step_descriptor)

Execute method used by the protocol to run different steps.

Parameters
  • toolset (dict) – Dictionary containing parameters for different steps

  • step_descriptor (str) – Name of the step

Return type

Any

feature_extraction(toolset)[source]

Feature extraction step for the algorithm.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

Tuple[Dict[str, Any], Dict[str, Any]]

Returns

Tuple of dictionary

classmethod from_config(config_dict, merge_default=True)

Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.

This base method is adequate without modification when a class’s constructor argument types are JSON-compliant. If one or more are not, however, this method then needs to be overridden in order to convert from a JSON-compliant stand-in into the more complex object the constructor requires. It is recommended that when complex types are used they also inherit from the Configurable in order to hopefully make easier the conversion to and from JSON-compliant stand-ins.

When this method does need to be overridden, this usually looks like the following pattern:

D = TypeVar("D", bound="MyClass")

class MyClass (Configurable):

    @classmethod
    def from_config(
        cls: Type[D],
        config_dict: Dict,
        merge_default: bool = True
    ) -> D:
        # Perform a shallow copy of the input ``config_dict`` which
        # is important to maintain idempotency.
        config_dict = dict(config_dict)

        # Optionally guarantee default values are present in the
        # configuration dictionary.  This is useful when the
        # configuration dictionary input is partial and the logic
        # contained here wants to use config parameters that may
        # have defaults defined in the constructor.
        if merge_default:
            config_dict = merge_dict(cls.get_default_config(),
                                     config_dict)

        #
        # Perform any overriding of `config_dict` values here.
        #

        # Create and return an instance using the super method.
        return super().from_config(config_dict,
                                   merge_default=merge_default)

Note on type annotations: When defining a sub-class of configurable and override this class method, we will need to defined a new TypeVar that is bound at the new class type. This is because super requires a type to be given that descends from the implementing type. If C is used as defined in this interface module, which is upper-bounded on the base Configurable class, the type analysis will see that we are attempting to invoke super with a type that may not strictly descend from the implementing type (MyClass in the example above), and cause an error during type analysis.

Parameters
  • config_dict (dict) – JSON compliant dictionary encapsulating a configuration.

  • merge_default (bool) – Merge the given configuration on top of the default provided by get_default_config.

Return type

~C

Returns

Constructed instance from the provided config.

get_config()

Get config for the plugin.

Return type

Dict

Returns

Parameters for the agent

classmethod get_default_config()

Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it.

By default, we observe what this class’s constructor takes as arguments, turning those argument names into configuration dictionary keys. If any of those arguments have defaults, we will add those values into the configuration dictionary appropriately. The dictionary returned should only contain JSON compliant value types.

It is not be guaranteed that the configuration dictionary returned from this method is valid for construction of an instance of this class.

Returns

Default configuration dictionary for the class.

Return type

dict

>>> # noinspection PyUnresolvedReferences
>>> class SimpleConfig(Configurable):
...     def __init__(self, a=1, b='foo'):
...         self.a = a
...         self.b = b
...     def get_config(self):
...         return {'a': self.a, 'b': self.b}
>>> self = SimpleConfig()
>>> config = self.get_default_config()
>>> assert config == {'a': 1, 'b': 'foo'}
classmethod get_impls()

Discover and return a set of classes that implement the calling class.

See the various discover_via_*() functions in this module for more details on the logic of how implementing classes (aka “plugins”) are discovered.

The class-level variables PLUGIN_ENV_VAR and PLUGIN_NAMESPACE may be overridden to change what environment and entry-point extension are looked for, respectively.

Return type

Set[Type[~P]]

Returns

Set of discovered class types that are considered “valid” plugins of this type. See is_valid_plugin() for what we define a “valid” type to be be relative to this class.

initialize(toolset)

Algorithm Initialization.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

None

Returns

None

classmethod is_usable()

Determine if this class with be detected by SMQTK’s plugin.

Return type

bool

novelty_characterization(toolset)

Characterize novelty by clustering different novel samples.

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for novelty characterization step

world_detection(toolset)

Detect change in world ( Novelty has been introduced ).

Parameters

toolset (dict) – Dictionary containing parameters for different steps

Return type

str

Returns

path to csv file containing the results for change in world