d3m.primitive_interfaces.distance module

class d3m.primitive_interfaces.distance.PairwiseDistanceLearnerPrimitiveBase(*, hyperparams, random_seed=0, docker_containers=None, volumes=None, temporary_directory=None)[source]

Bases: d3m.primitive_interfaces.base.PrimitiveBase

A base class for primitives which learn distances (however defined) between two different sets of instances.

Class is parameterized using five type variables, Inputs, InputLabels, Outputs, Params, and Hyperparams.

metadata[source]

Primitive’s metadata. Available as a class attribute.

logger[source]

Primitive’s logger. Available as a class attribute.

hyperparams[source]

Hyperparams passed to the constructor.

random_seed[source]

Random seed passed to the constructor.

docker_containers[source]

A dict mapping Docker image keys from primitive’s metadata to (named) tuples containing container’s address under which the container is accessible by the primitive, and a dict mapping exposed ports to ports on that address.

volumes[source]

A dict mapping volume keys from primitive’s metadata to file and directory paths where downloaded and extracted files are available to the primitive.

temporary_directory[source]

An absolute path to a temporary directory a primitive can use to store any files for the duration of the current pipeline run phase. Directory is automatically cleaned up after the current pipeline run phase finishes.

docker_containers = None[source]
fit_multi_produce(*, produce_methods, inputs, input_labels, second_inputs, timeout=None, iterations=None)[source]

A method calling fit and after that multiple produce methods at once.

Parameters
  • produce_methods (Sequence[str]) – A list of names of produce methods to call.

  • inputs (~Inputs) – The first set of collections of instances.

  • input_labels (~InputLabels) – A set of class labels for the inputs.

  • second_inputs (~Inputs) – The second set of collections of instances.

  • timeout (Optional[float]) – A maximum time this primitive should take to both fit the primitive and produce outputs for all produce methods listed in produce_methods argument, in seconds.

  • iterations (Optional[int]) – How many of internal iterations should the primitive do for both fitting and producing outputs of all produce methods.

Returns

Return type

A dict of values for each produce method wrapped inside MultiCallResult.

hyperparams = None[source]
multi_produce(*, produce_methods, inputs, second_inputs, timeout=None, iterations=None)[source]

A method calling multiple produce methods at once.

Parameters
  • produce_methods (Sequence[str]) – A list of names of produce methods to call.

  • inputs (~Inputs) – The first set of collections of instances.

  • second_inputs (~Inputs) – The second set of collections of instances.

  • timeout (Optional[float]) – A maximum time this primitive should take to produce outputs for all produce methods listed in produce_methods argument, in seconds.

  • iterations (Optional[int]) – How many of internal iterations should the primitive do.

Returns

Return type

A dict of values for each produce method wrapped inside MultiCallResult.

abstract produce(*, inputs, second_inputs, timeout=None, iterations=None)[source]

Computes distance matrix between two sets of data.

Implementations of this method should use inputs_across_samples decorator to mark inputs and second_inputs as being computed across samples.

Parameters
  • inputs (~Inputs) – The first set of collections of instances.

  • second_inputs (~Inputs) – The second set of collections of instances.

  • timeout (Optional[float]) – A maximum time this primitive should take to produce outputs during this method call, in seconds.

  • iterations (Optional[int]) – How many of internal iterations should the primitive do.

Return type

CallResult[~Outputs]

Returns

  • A n by m distance matrix describing the relationship between each instance in inputs[0] and each instance

  • in inputs[1] (n and m are the number of instances in inputs[0] and inputs[1], respectively),

  • wrapped inside CallResult.

random_seed = None[source]
abstract set_training_data(*, inputs, input_labels)[source]

Sets training data of this primitive.

Parameters
  • inputs (~Inputs) – The inputs.

  • input_labels (~InputLabels) – A set of class labels for the inputs.

Return type

None

temporary_directory = None[source]
volumes = None[source]
class d3m.primitive_interfaces.distance.PairwiseDistanceTransformerPrimitiveBase(*, hyperparams, random_seed=0, docker_containers=None, volumes=None, temporary_directory=None)[source]

Bases: d3m.primitive_interfaces.transformer.TransformerPrimitiveBase

A base class for primitives which compute distances (however defined) between two different sets of instances without learning any sort of model.

metadata[source]

Primitive’s metadata. Available as a class attribute.

logger[source]

Primitive’s logger. Available as a class attribute.

hyperparams[source]

Hyperparams passed to the constructor.

random_seed[source]

Random seed passed to the constructor.

docker_containers[source]

A dict mapping Docker image keys from primitive’s metadata to (named) tuples containing container’s address under which the container is accessible by the primitive, and a dict mapping exposed ports to ports on that address.

volumes[source]

A dict mapping volume keys from primitive’s metadata to file and directory paths where downloaded and extracted files are available to the primitive.

temporary_directory[source]

An absolute path to a temporary directory a primitive can use to store any files for the duration of the current pipeline run phase. Directory is automatically cleaned up after the current pipeline run phase finishes.

docker_containers = None[source]
fit_multi_produce(*, produce_methods, inputs, second_inputs, timeout=None, iterations=None)[source]

A method calling fit and after that multiple produce methods at once.

Parameters
  • produce_methods (Sequence[str]) – A list of names of produce methods to call.

  • inputs (~Inputs) – The first set of collections of instances.

  • second_inputs (~Inputs) – The second set of collections of instances.

  • timeout (Optional[float]) – A maximum time this primitive should take to both fit the primitive and produce outputs for all produce methods listed in produce_methods argument, in seconds.

  • iterations (Optional[int]) – How many of internal iterations should the primitive do for both fitting and producing outputs of all produce methods.

Returns

Return type

A dict of values for each produce method wrapped inside MultiCallResult.

hyperparams = None[source]
multi_produce(*, produce_methods, inputs, second_inputs, timeout=None, iterations=None)[source]

A method calling multiple produce methods at once.

Parameters
  • produce_methods (Sequence[str]) – A list of names of produce methods to call.

  • inputs (~Inputs) – The first set of collections of instances.

  • second_inputs (~Inputs) – The second set of collections of instances.

  • timeout (Optional[float]) – A maximum time this primitive should take to produce outputs for all produce methods listed in produce_methods argument, in seconds.

  • iterations (Optional[int]) – How many of internal iterations should the primitive do.

Returns

Return type

A dict of values for each produce method wrapped inside MultiCallResult.

abstract produce(*, inputs, second_inputs, timeout=None, iterations=None)[source]

Computes distance matrix between two sets of data.

Implementations of this method should use inputs_across_samples decorator to mark inputs and second_inputs as being computed across samples.

Parameters
  • inputs (~Inputs) – The first set of collections of instances.

  • second_inputs (~Inputs) – The second set of collections of instances.

  • timeout (Optional[float]) – A maximum time this primitive should take to produce outputs during this method call, in seconds.

  • iterations (Optional[int]) – How many of internal iterations should the primitive do.

Return type

CallResult[~Outputs]

Returns

  • A n by m distance matrix describing the relationship between each instance in inputs[0] and each instance

  • in inputs[1] (n and m are the number of instances in inputs[0] and inputs[1], respectively),

  • wrapped inside CallResult.

random_seed = None[source]
temporary_directory = None[source]
volumes = None[source]