d3m.contrib.primitives.null module¶
-
class
d3m.contrib.primitives.null.
NullDataFrameUnsupervisedLearnerPrimitive
(*, hyperparams, random_seed=0, docker_containers=None, volumes=None, temporary_directory=None)[source]¶ Bases:
d3m.primitive_interfaces.unsupervised_learning.UnsupervisedLearnerPrimitiveBase
[[d3m.container.pandas.DataFrame
,d3m.container.pandas.DataFrame
,d3m.contrib.primitives.null.Params
],d3m.contrib.primitives.null.Hyperparams
]A primitive which passes through inputs as outputs.
It does not really care if inputs is a Dataframe.
-
fit
(*, timeout=None, iterations=None)[source]¶ A noop.
- Parameters
- Returns
A
CallResult
withNone
value.- Return type
CallResult
[None
]
-
produce
(*, inputs, timeout=None, iterations=None)[source]¶ Produce primitive’s best choice of the output for each of the inputs.
The output value should be wrapped inside
CallResult
object before returning.In many cases producing an output is a quick operation in comparison with
fit
, but not all cases are like that. For example, a primitive can start a potentially long optimization process to compute outputs.timeout
anditerations
can serve as a way for a caller to guide the length of this process.Ideally, a primitive should adapt its call to try to produce the best outputs possible inside the time allocated. If this is not possible and the primitive reaches the timeout before producing outputs, it should raise a
TimeoutError
exception to signal that the call was unsuccessful in the given time. The state of the primitive after the exception should be as the method call has never happened and primitive should continue to operate normally. The purpose oftimeout
is to give opportunity to a primitive to cleanly manage its state instead of interrupting execution from outside. Maintaining stable internal state should have precedence over respecting thetimeout
(caller can terminate the misbehaving primitive from outside anyway). If a longertimeout
would produce different outputs, thenCallResult
’shas_finished
should be set toFalse
.Some primitives have internal iterations (for example, optimization iterations). For those, caller can provide how many of primitive’s internal iterations should a primitive do before returning outputs. Primitives should make iterations as small as reasonable. If
iterations
isNone
, then there is no limit on how many iterations the primitive should do and primitive should choose the best amount of iterations on its own (potentially controlled through hyper-parameters). Ifiterations
is a number, a primitive has to do those number of iterations, if possible.timeout
should still be respected and potentially less iterations can be done because of that. Primitives with internal iterations should makeCallResult
contain correct values.For primitives which do not have internal iterations, any value of
iterations
means that they should run fully, respecting onlytimeout
.If primitive should have been fitted before calling this method, but it has not been, primitive should raise a
PrimitiveNotFittedError
exception.- Parameters
- Returns
The outputs of shape [num_inputs, …] wrapped inside
CallResult
.- Return type
-
set_params
(*, params)[source]¶ A noop.
- Parameters
params (
Params
) – An instance of parameters.- Return type
None
-
logger
: typing.ClassVar[logging.Logger] = <Logger d3m.primitives.operator.null.DataFrameUnsupervisedLearnerCore (WARNING)>[source]¶ Primitive’s logger. Available as a class attribute. This gets automatically set to primitive’s logger in metaclass.
-
metadata
: ClassVar[d3m.metadata.base.PrimitiveMetadata] = <d3m.metadata.base.PrimitiveMetadata object>[source]¶ Primitive’s metadata. Available as a class attribute. Primitive author should provide all fields which cannot be determined automatically inside the code. In this way metadata is close to the code and it is easier for consumers to make sure metadata they are using is really matching the code they are using. PrimitiveMetadata class updates itself with metadata about code and other things it can extract automatically.
-
-
class
d3m.contrib.primitives.null.
NullTransformerPrimitive
(*, hyperparams, random_seed=0, docker_containers=None, volumes=None, temporary_directory=None)[source]¶ Bases:
d3m.primitive_interfaces.transformer.TransformerPrimitiveBase
[[d3m.container.list.List
,d3m.container.list.List
],d3m.contrib.primitives.null.Hyperparams
]A primitive which passes through inputs as outputs.
It does not really care if inputs is list.
-
produce
(*, inputs, timeout=None, iterations=None)[source]¶ Produce primitive’s best choice of the output for each of the inputs.
The output value should be wrapped inside
CallResult
object before returning.In many cases producing an output is a quick operation in comparison with
fit
, but not all cases are like that. For example, a primitive can start a potentially long optimization process to compute outputs.timeout
anditerations
can serve as a way for a caller to guide the length of this process.Ideally, a primitive should adapt its call to try to produce the best outputs possible inside the time allocated. If this is not possible and the primitive reaches the timeout before producing outputs, it should raise a
TimeoutError
exception to signal that the call was unsuccessful in the given time. The state of the primitive after the exception should be as the method call has never happened and primitive should continue to operate normally. The purpose oftimeout
is to give opportunity to a primitive to cleanly manage its state instead of interrupting execution from outside. Maintaining stable internal state should have precedence over respecting thetimeout
(caller can terminate the misbehaving primitive from outside anyway). If a longertimeout
would produce different outputs, thenCallResult
’shas_finished
should be set toFalse
.Some primitives have internal iterations (for example, optimization iterations). For those, caller can provide how many of primitive’s internal iterations should a primitive do before returning outputs. Primitives should make iterations as small as reasonable. If
iterations
isNone
, then there is no limit on how many iterations the primitive should do and primitive should choose the best amount of iterations on its own (potentially controlled through hyper-parameters). Ifiterations
is a number, a primitive has to do those number of iterations, if possible.timeout
should still be respected and potentially less iterations can be done because of that. Primitives with internal iterations should makeCallResult
contain correct values.For primitives which do not have internal iterations, any value of
iterations
means that they should run fully, respecting onlytimeout
.If primitive should have been fitted before calling this method, but it has not been, primitive should raise a
PrimitiveNotFittedError
exception.- Parameters
- Returns
The outputs of shape [num_inputs, …] wrapped inside
CallResult
.- Return type
-
logger
: typing.ClassVar[logging.Logger] = <Logger d3m.primitives.operator.null.TransformerCore (WARNING)>[source]¶ Primitive’s logger. Available as a class attribute. This gets automatically set to primitive’s logger in metaclass.
-
metadata
: ClassVar[d3m.metadata.base.PrimitiveMetadata] = <d3m.metadata.base.PrimitiveMetadata object>[source]¶ Primitive’s metadata. Available as a class attribute. Primitive author should provide all fields which cannot be determined automatically inside the code. In this way metadata is close to the code and it is easier for consumers to make sure metadata they are using is really matching the code they are using. PrimitiveMetadata class updates itself with metadata about code and other things it can extract automatically.
-
-
class
d3m.contrib.primitives.null.
NullUnsupervisedLearnerPrimitive
(*, hyperparams, random_seed=0, docker_containers=None, volumes=None, temporary_directory=None)[source]¶ Bases:
d3m.primitive_interfaces.unsupervised_learning.UnsupervisedLearnerPrimitiveBase
[[d3m.container.list.List
,d3m.container.list.List
,d3m.contrib.primitives.null.Params
],d3m.contrib.primitives.null.Hyperparams
]A primitive which passes through inputs as outputs.
It does not really care if inputs is list.
-
fit
(*, timeout=None, iterations=None)[source]¶ A noop.
- Parameters
- Returns
A
CallResult
withNone
value.- Return type
CallResult
[None
]
-
produce
(*, inputs, timeout=None, iterations=None)[source]¶ Produce primitive’s best choice of the output for each of the inputs.
The output value should be wrapped inside
CallResult
object before returning.In many cases producing an output is a quick operation in comparison with
fit
, but not all cases are like that. For example, a primitive can start a potentially long optimization process to compute outputs.timeout
anditerations
can serve as a way for a caller to guide the length of this process.Ideally, a primitive should adapt its call to try to produce the best outputs possible inside the time allocated. If this is not possible and the primitive reaches the timeout before producing outputs, it should raise a
TimeoutError
exception to signal that the call was unsuccessful in the given time. The state of the primitive after the exception should be as the method call has never happened and primitive should continue to operate normally. The purpose oftimeout
is to give opportunity to a primitive to cleanly manage its state instead of interrupting execution from outside. Maintaining stable internal state should have precedence over respecting thetimeout
(caller can terminate the misbehaving primitive from outside anyway). If a longertimeout
would produce different outputs, thenCallResult
’shas_finished
should be set toFalse
.Some primitives have internal iterations (for example, optimization iterations). For those, caller can provide how many of primitive’s internal iterations should a primitive do before returning outputs. Primitives should make iterations as small as reasonable. If
iterations
isNone
, then there is no limit on how many iterations the primitive should do and primitive should choose the best amount of iterations on its own (potentially controlled through hyper-parameters). Ifiterations
is a number, a primitive has to do those number of iterations, if possible.timeout
should still be respected and potentially less iterations can be done because of that. Primitives with internal iterations should makeCallResult
contain correct values.For primitives which do not have internal iterations, any value of
iterations
means that they should run fully, respecting onlytimeout
.If primitive should have been fitted before calling this method, but it has not been, primitive should raise a
PrimitiveNotFittedError
exception.- Parameters
- Returns
The outputs of shape [num_inputs, …] wrapped inside
CallResult
.- Return type
-
set_params
(*, params)[source]¶ A noop.
- Parameters
params (
Params
) – An instance of parameters.- Return type
None
-
logger
: typing.ClassVar[logging.Logger] = <Logger d3m.primitives.operator.null.UnsupervisedLearnerCore (WARNING)>[source]¶ Primitive’s logger. Available as a class attribute. This gets automatically set to primitive’s logger in metaclass.
-
metadata
: ClassVar[d3m.metadata.base.PrimitiveMetadata] = <d3m.metadata.base.PrimitiveMetadata object>[source]¶ Primitive’s metadata. Available as a class attribute. Primitive author should provide all fields which cannot be determined automatically inside the code. In this way metadata is close to the code and it is easier for consumers to make sure metadata they are using is really matching the code they are using. PrimitiveMetadata class updates itself with metadata about code and other things it can extract automatically.
-