Commit 7afc3143 authored by Mitar's avatar Mitar

Merge branch 'tamu_primitives' into 'master'

Add TAMU primitives

See merge request !40
parents 043f9f7b 27aa4d6c
Pipeline #98243894 passed with stages
in 184 minutes and 24 seconds
{
"id": "49c57f54-4781-493d-8826-cc5bb7b23719",
"schema": "https://metadata.datadrivendiscovery.org/schemas/v0/pipeline.json",
"created": "2019-11-25T02:01:58.436088Z",
"inputs": [
{
"name": "inputs"
}
],
"outputs": [
{
"data": "steps.8.produce",
"name": "output predictions"
}
],
"steps": [
{
"type": "PRIMITIVE",
"primitive": {
"id": "4b42ce1e-9b98-4a25-b68e-fad13311eb65",
"version": "0.3.0",
"python_path": "d3m.primitives.data_transformation.dataset_to_dataframe.Common",
"name": "Extract a DataFrame from a Dataset"
},
"arguments": {
"inputs": {
"type": "CONTAINER",
"data": "inputs.0"
}
},
"outputs": [
{
"id": "produce"
}
]
},
{
"type": "PRIMITIVE",
"primitive": {
"id": "adc6e2e6-a477-41cf-8ce2-5dc1b475246e",
"version": "0.1.0",
"python_path": "d3m.primitives.data_transformation.dataframe_sampling.TAMU",
"name": "DataFrame Sampling"
},
"arguments": {
"inputs": {
"type": "CONTAINER",
"data": "steps.0.produce"
}
},
"outputs": [
{
"id": "produce"
}
]
},
{
"type": "PRIMITIVE",
"primitive": {
"id": "9fe84601-a3d7-4881-86b2-44fecd42b296",
"version": "0.1.0",
"python_path": "d3m.primitives.data_transformation.dataframe_list_extractor.TAMU",
"name": "Select dataframe from list of dataframes"
},
"arguments": {
"inputs": {
"type": "CONTAINER",
"data": "steps.1.produce"
}
},
"outputs": [
{
"id": "produce"
}
]
},
{
"type": "PRIMITIVE",
"primitive": {
"id": "d510cb7a-1782-4f51-b44c-58f0236e47c7",
"version": "0.5.0",
"python_path": "d3m.primitives.data_transformation.column_parser.Common",
"name": "Parses strings into their types"
},
"arguments": {
"inputs": {
"type": "CONTAINER",
"data": "steps.2.produce"
}
},
"outputs": [
{
"id": "produce"
}
]
},
{
"type": "PRIMITIVE",
"primitive": {
"id": "4503a4c6-42f7-45a1-a1d4-ed69699cf5e1",
"version": "0.3.0",
"python_path": "d3m.primitives.data_transformation.extract_columns_by_semantic_types.Common",
"name": "Extracts columns by semantic type"
},
"arguments": {
"inputs": {
"type": "CONTAINER",
"data": "steps.3.produce"
}
},
"outputs": [
{
"id": "produce"
}
],
"hyperparams": {
"semantic_types": {
"type": "VALUE",
"data": [
"https://metadata.datadrivendiscovery.org/types/Attribute"
]
}
}
},
{
"type": "PRIMITIVE",
"primitive": {
"id": "4503a4c6-42f7-45a1-a1d4-ed69699cf5e1",
"version": "0.3.0",
"python_path": "d3m.primitives.data_transformation.extract_columns_by_semantic_types.Common",
"name": "Extracts columns by semantic type"
},
"arguments": {
"inputs": {
"type": "CONTAINER",
"data": "steps.2.produce"
}
},
"outputs": [
{
"id": "produce"
}
],
"hyperparams": {
"semantic_types": {
"type": "VALUE",
"data": [
"https://metadata.datadrivendiscovery.org/types/TrueTarget"
]
}
}
},
{
"type": "PRIMITIVE",
"primitive": {
"id": "d016df89-de62-3c53-87ed-c06bb6a23cde",
"version": "2019.6.7",
"python_path": "d3m.primitives.data_cleaning.imputer.SKlearn",
"name": "sklearn.impute.SimpleImputer"
},
"arguments": {
"inputs": {
"type": "CONTAINER",
"data": "steps.4.produce"
}
},
"outputs": [
{
"id": "produce"
}
]
},
{
"type": "PRIMITIVE",
"primitive": {
"id": "c8a28f02-ef4a-35a8-87f1-cf79980f5c3e",
"version": "2019.6.7",
"python_path": "d3m.primitives.classification.extra_trees.SKlearn",
"name": "sklearn.ensemble.forest.ExtraTreesClassifier"
},
"arguments": {
"inputs": {
"type": "CONTAINER",
"data": "steps.6.produce"
},
"outputs": {
"type": "CONTAINER",
"data": "steps.5.produce"
}
},
"outputs": [
{
"id": "produce"
}
]
},
{
"type": "PRIMITIVE",
"primitive": {
"id": "8d38b340-f83f-4877-baaa-162f8e551736",
"version": "0.3.0",
"python_path": "d3m.primitives.data_transformation.construct_predictions.Common",
"name": "Construct pipeline predictions output"
},
"arguments": {
"inputs": {
"type": "CONTAINER",
"data": "steps.7.produce"
},
"reference": {
"type": "CONTAINER",
"data": "steps.2.produce"
}
},
"outputs": [
{
"id": "produce"
}
]
}
]
}
\ No newline at end of file
{
"id": "9fe84601-a3d7-4881-86b2-44fecd42b296",
"version": "0.1.0",
"name": "Select dataframe from list of dataframes",
"python_path": "d3m.primitives.data_transformation.dataframe_list_extractor.TAMU",
"source": {
"name": "TAMU",
"contact": "mailto:[email protected]",
"uris": [
"https://gitlab.com/TAMU_D3M/d3m_primitives/blob/master/tamu_primitives/dataframe_list_extractor.py",
"https://gitlab.com/TAMU_D3M/d3m_primitives.git"
]
},
"installation": [
{
"type": "PIP",
"package_uri": "git+https://gitlab.com/TAMU_D3M/[email protected]#egg=tamu_primitives"
}
],
"algorithm_types": [
"ARRAY_SLICING"
],
"primitive_family": "DATA_TRANSFORMATION",
"schema": "https://metadata.datadrivendiscovery.org/schemas/v0/primitive.json",
"original_python_path": "tamu_primitives.dataframe_list_extractor.DataframeListExtractorPrimitive",
"primitive_code": {
"class_type_arguments": {
"Inputs": "d3m.container.list.List",
"Outputs": "d3m.container.pandas.DataFrame",
"Hyperparams": "tamu_primitives.dataframe_list_extractor.Hyperparams",
"Params": "NoneType"
},
"interfaces_version": "2019.11.10",
"interfaces": [
"transformer.TransformerPrimitiveBase",
"base.PrimitiveBase"
],
"hyperparams": {
"dataframe_to_extract": {
"type": "d3m.metadata.hyperparams.Bounded",
"default": 0,
"structural_type": "int",
"semantic_types": [
"https://metadata.datadrivendiscovery.org/types/ControlParameter"
],
"description": "Index of the dataframe to extract from the list",
"lower": 0,
"upper": null,
"lower_inclusive": true,
"upper_inclusive": false
}
},
"arguments": {
"hyperparams": {
"type": "tamu_primitives.dataframe_list_extractor.Hyperparams",
"kind": "RUNTIME"
},
"random_seed": {
"type": "int",
"kind": "RUNTIME",
"default": 0
},
"docker_containers": {
"type": "typing.Union[NoneType, typing.Dict[str, d3m.primitive_interfaces.base.DockerContainer]]",
"kind": "RUNTIME",
"default": null
},
"volumes": {
"type": "typing.Union[NoneType, typing.Dict[str, str]]",
"kind": "RUNTIME",
"default": null
},
"temporary_directory": {
"type": "typing.Union[NoneType, str]",
"kind": "RUNTIME",
"default": null
},
"timeout": {
"type": "typing.Union[NoneType, float]",
"kind": "RUNTIME",
"default": null
},
"iterations": {
"type": "typing.Union[NoneType, int]",
"kind": "RUNTIME",
"default": null
},
"produce_methods": {
"type": "typing.Sequence[str]",
"kind": "RUNTIME"
},
"inputs": {
"type": "d3m.container.list.List",
"kind": "PIPELINE"
},
"params": {
"type": "NoneType",
"kind": "RUNTIME"
}
},
"class_methods": {},
"instance_methods": {
"__init__": {
"kind": "OTHER",
"arguments": [
"hyperparams",
"random_seed",
"docker_containers",
"volumes",
"temporary_directory"
],
"returns": "NoneType",
"description": "All primitives should accept all their hyper-parameters in a constructor as one value,\nan instance of type ``Hyperparams``.\n\nProvided random seed should control all randomness used by this primitive.\nPrimitive should behave exactly the same for the same random seed across multiple\ninvocations. You can call `numpy.random.RandomState(random_seed)` to obtain an\ninstance of a random generator using provided seed. If your primitive does not\nuse randomness, consider not exposing this argument in your primitive's constructor\nto signal that.\n\nPrimitives can be wrappers around or use one or more Docker images which they can\nspecify as part of ``installation`` field in their metadata. Each Docker image listed\nthere has a ``key`` field identifying that image. When primitive is created,\n``docker_containers`` contains a mapping between those keys and connection information\nwhich primitive can use to connect to a running Docker container for a particular Docker\nimage and its exposed ports. Docker containers might be long running and shared between\nmultiple instances of a primitive. If your primitive does not use Docker images,\nconsider not exposing this argument in your primitive's constructor.\n\n**Note**: Support for primitives using Docker containers has been put on hold.\nCurrently it is not expected that any runtime running primitives will run\nDocker containers for a primitive.\n\nPrimitives can also use additional static files which can be added as a dependency\nto ``installation`` metadata. When done so, given volumes are provided to the\nprimitive through ``volumes`` argument to the primitive's constructor as a\ndict mapping volume keys to file and directory paths where downloaded and\nextracted files are available to the primitive. All provided files and directories\nare read-only. If your primitive does not use static files, consider not exposing\nthis argument in your primitive's constructor.\n\nPrimitives can also use the provided temporary directory to store any files for\nthe duration of the current pipeline run phase. Directory is automatically\ncleaned up after the current pipeline run phase finishes. Do not store in this\ndirectory any primitive's state you would like to preserve between \"fit\" and\n\"produce\" phases of pipeline execution. Use ``Params`` for that. The main intent\nof this temporary directory is to store files referenced by any ``Dataset`` object\nyour primitive might create and followup primitives in the pipeline should have\naccess to. When storing files into this directory consider using capabilities\nof Python's `tempfile` module to generate filenames which will not conflict with\nany other files stored there. Use provided temporary directory as ``dir`` argument\nto set it as base directory to generate additional temporary files and directories\nas needed. If your primitive does not use temporary directory, consider not exposing\nthis argument in your primitive's constructor.\n\nNo other arguments to the constructor are allowed (except for private arguments)\nbecause we want instances of primitives to be created without a need for any other\nprior computation.\n\nModule in which a primitive is defined should be kept lightweight and on import not do\nany (pre)computation, data loading, or resource allocation/reservation. Any loading\nand resource allocation/reservation should be done in the constructor. Any (pre)computation\nshould be done lazily when needed once requested through other methods and not in the constructor."
},
"fit": {
"kind": "OTHER",
"arguments": [
"timeout",
"iterations"
],
"returns": "d3m.primitive_interfaces.base.CallResult[NoneType]",
"description": "A noop.\n\nParameters\n----------\ntimeout : float\n A maximum time this primitive should be fitting during this method call, in seconds.\niterations : int\n How many of internal iterations should the primitive do.\n\nReturns\n-------\nCallResult[None]\n A ``CallResult`` with ``None`` value."
},
"fit_multi_produce": {
"kind": "OTHER",
"arguments": [
"produce_methods",
"inputs",
"timeout",
"iterations"
],
"returns": "d3m.primitive_interfaces.base.MultiCallResult",
"description": "A method calling ``fit`` and after that multiple produce methods at once.\n\nParameters\n----------\nproduce_methods : Sequence[str]\n A list of names of produce methods to call.\ninputs : Inputs\n The inputs given to all produce methods.\ntimeout : float\n A maximum time this primitive should take to both fit the primitive and produce outputs\n for all produce methods listed in ``produce_methods`` argument, in seconds.\niterations : int\n How many of internal iterations should the primitive do for both fitting and producing\n outputs of all produce methods.\n\nReturns\n-------\nMultiCallResult\n A dict of values for each produce method wrapped inside ``MultiCallResult``."
},
"get_params": {
"kind": "OTHER",
"arguments": [],
"returns": "NoneType",
"description": "A noop.\n\nReturns\n-------\nParams\n An instance of parameters."
},
"multi_produce": {
"kind": "OTHER",
"arguments": [
"produce_methods",
"inputs",
"timeout",
"iterations"
],
"returns": "d3m.primitive_interfaces.base.MultiCallResult",
"description": "A method calling multiple produce methods at once.\n\nWhen a primitive has multiple produce methods it is common that they might compute the\nsame internal results for same inputs but return different representations of those results.\nIf caller is interested in multiple of those representations, calling multiple produce\nmethods might lead to recomputing same internal results multiple times. To address this,\nthis method allows primitive author to implement an optimized version which computes\ninternal results only once for multiple calls of produce methods, but return those different\nrepresentations.\n\nIf any additional method arguments are added to primitive's produce method(s), they have\nto be added to this method as well. This method should accept an union of all arguments\naccepted by primitive's produce method(s) and then use them accordingly when computing\nresults.\n\nThe default implementation of this method just calls all produce methods listed in\n``produce_methods`` in order and is potentially inefficient.\n\nIf primitive should have been fitted before calling this method, but it has not been,\nprimitive should raise a ``PrimitiveNotFittedError`` exception.\n\nParameters\n----------\nproduce_methods : Sequence[str]\n A list of names of produce methods to call.\ninputs : Inputs\n The inputs given to all produce methods.\ntimeout : float\n A maximum time this primitive should take to produce outputs for all produce methods\n listed in ``produce_methods`` argument, in seconds.\niterations : int\n How many of internal iterations should the primitive do.\n\nReturns\n-------\nMultiCallResult\n A dict of values for each produce method wrapped inside ``MultiCallResult``."
},
"produce": {
"kind": "PRODUCE",
"arguments": [
"inputs",
"timeout",
"iterations"
],
"returns": "d3m.primitive_interfaces.base.CallResult[d3m.container.pandas.DataFrame]",
"singleton": false,
"inputs_across_samples": [],
"description": "Produce primitive's best choice of the output for each of the inputs.\n\nThe output value should be wrapped inside ``CallResult`` object before returning.\n\nIn many cases producing an output is a quick operation in comparison with ``fit``, but not\nall cases are like that. For example, a primitive can start a potentially long optimization\nprocess to compute outputs. ``timeout`` and ``iterations`` can serve as a way for a caller\nto guide the length of this process.\n\nIdeally, a primitive should adapt its call to try to produce the best outputs possible\ninside the time allocated. If this is not possible and the primitive reaches the timeout\nbefore producing outputs, it should raise a ``TimeoutError`` exception to signal that the\ncall was unsuccessful in the given time. The state of the primitive after the exception\nshould be as the method call has never happened and primitive should continue to operate\nnormally. The purpose of ``timeout`` is to give opportunity to a primitive to cleanly\nmanage its state instead of interrupting execution from outside. Maintaining stable internal\nstate should have precedence over respecting the ``timeout`` (caller can terminate the\nmisbehaving primitive from outside anyway). If a longer ``timeout`` would produce\ndifferent outputs, then ``CallResult``'s ``has_finished`` should be set to ``False``.\n\nSome primitives have internal iterations (for example, optimization iterations).\nFor those, caller can provide how many of primitive's internal iterations\nshould a primitive do before returning outputs. Primitives should make iterations as\nsmall as reasonable. If ``iterations`` is ``None``, then there is no limit on\nhow many iterations the primitive should do and primitive should choose the best amount\nof iterations on its own (potentially controlled through hyper-parameters).\nIf ``iterations`` is a number, a primitive has to do those number of iterations,\nif possible. ``timeout`` should still be respected and potentially less iterations\ncan be done because of that. Primitives with internal iterations should make\n``CallResult`` contain correct values.\n\nFor primitives which do not have internal iterations, any value of ``iterations``\nmeans that they should run fully, respecting only ``timeout``.\n\nIf primitive should have been fitted before calling this method, but it has not been,\nprimitive should raise a ``PrimitiveNotFittedError`` exception.\n\nParameters\n----------\ninputs : Inputs\n The inputs of shape [num_inputs, ...].\ntimeout : float\n A maximum time this primitive should take to produce outputs during this method call, in seconds.\niterations : int\n How many of internal iterations should the primitive do.\n\nReturns\n-------\nCallResult[Outputs]\n The outputs of shape [num_inputs, ...] wrapped inside ``CallResult``."
},
"set_params": {
"kind": "OTHER",
"arguments": [
"params"
],
"returns": "NoneType",
"description": "A noop.\n\nParameters\n----------\nparams : Params\n An instance of parameters."
},
"set_training_data": {
"kind": "OTHER",
"arguments": [],
"returns": "NoneType",
"description": "A noop.\n\nParameters\n----------"
}
},
"class_attributes": {
"logger": "logging.Logger",
"metadata": "d3m.metadata.base.PrimitiveMetadata"
},
"instance_attributes": {
"hyperparams": "d3m.metadata.hyperparams.Hyperparams",
"random_seed": "int",
"docker_containers": "typing.Dict[str, d3m.primitive_interfaces.base.DockerContainer]",
"volumes": "typing.Dict[str, str]",
"temporary_directory": "typing.Union[NoneType, str]"
}
},
"structural_type": "tamu_primitives.dataframe_list_extractor.DataframeListExtractorPrimitive",
"description": "A primitive which concatenates multiple DataFrames horizontally.\n\nIt is required that all DataFrames have the same number of samples.\n\nAttributes\n----------\nmetadata : PrimitiveMetadata\n Primitive's metadata. Available as a class attribute.\nlogger : Logger\n Primitive's logger. Available as a class attribute.\nhyperparams : Hyperparams\n Hyperparams passed to the constructor.\nrandom_seed : int\n Random seed passed to the constructor.\ndocker_containers : Dict[str, DockerContainer]\n A dict mapping Docker image keys from primitive's metadata to (named) tuples containing\n container's address under which the container is accessible by the primitive, and a\n dict mapping exposed ports to ports on that address.\nvolumes : Dict[str, str]\n A dict mapping volume keys from primitive's metadata to file and directory paths\n where downloaded and extracted files are available to the primitive.\ntemporary_directory : str\n An absolute path to a temporary directory a primitive can use to store any files\n for the duration of the current pipeline run phase. Directory is automatically\n cleaned up after the current pipeline run phase finishes.",
"digest": "03aac7c2233ce1227fa0962296704d2c60933000142867e00a4ab4cff0262cb3"
}
{
"id": "49c57f54-4781-493d-8826-cc5bb7b23719",
"schema": "https://metadata.datadrivendiscovery.org/schemas/v0/pipeline.json",
"created": "2019-11-25T02:01:58.436088Z",
"inputs": [
{
"name": "inputs"
}
],
"outputs": [
{
"data": "steps.8.produce",
"name": "output predictions"
}
],
"steps": [
{
"type": "PRIMITIVE",
"primitive": {
"id": "4b42ce1e-9b98-4a25-b68e-fad13311eb65",
"version": "0.3.0",
"python_path": "d3m.primitives.data_transformation.dataset_to_dataframe.Common",
"name": "Extract a DataFrame from a Dataset"
},
"arguments": {
"inputs": {
"type": "CONTAINER",
"data": "inputs.0"
}
},
"outputs": [
{
"id": "produce"
}
]
},
{
"type": "PRIMITIVE",
"primitive": {
"id": "adc6e2e6-a477-41cf-8ce2-5dc1b475246e",
"version": "0.1.0",
"python_path": "d3m.primitives.data_transformation.dataframe_sampling.TAMU",
"name": "DataFrame Sampling"
},
"arguments": {
"inputs": {
"type": "CONTAINER",
"data": "steps.0.produce"
}
},
"outputs": [
{
"id": "produce"
}
]
},
{
"type": "PRIMITIVE",
"primitive": {
"id": "9fe84601-a3d7-4881-86b2-44fecd42b296",
"version": "0.1.0",
"python_path": "d3m.primitives.data_transformation.dataframe_list_extractor.TAMU",
"name": "Select dataframe from list of dataframes"
},
"arguments": {
"inputs": {
"type": "CONTAINER",
"data": "steps.1.produce"
}
},
"outputs": [
{
"id": "produce"
}
]
},
{
"type": "PRIMITIVE",
"primitive": {
"id": "d510cb7a-1782-4f51-b44c-58f0236e47c7",
"version": "0.5.0",
"python_path": "d3m.primitives.data_transformation.column_parser.Common",
"name": "Parses strings into their types"
},
"arguments": {
"inputs": {
"type": "CONTAINER",
"data": "steps.2.produce"
}
},
"outputs": [
{
"id": "produce"
}
]
},
{
"type": "PRIMITIVE",
"primitive": {
"id": "4503a4c6-42f7-45a1-a1d4-ed69699cf5e1",
"version": "0.3.0",
"python_path": "d3m.primitives.data_transformation.extract_columns_by_semantic_types.Common",
"name": "Extracts columns by semantic type"
},
"arguments": {
"inputs": {
"type": "CONTAINER",
"data": "steps.3.produce"
}
},
"outputs": [
{
"id": "produce"
}
],
"hyperparams": {
"semantic_types": {
"type": "VALUE",
"data": [
"https://metadata.datadrivendiscovery.org/types/Attribute"
]
}
}
},
{
"type": "PRIMITIVE",
"primitive": {
"id": "4503a4c6-42f7-45a1-a1d4-ed69699cf5e1",
"version": "0.3.0",
"python_path": "d3m.primitives.data_transformation.extract_columns_by_semantic_types.Common",
"name": "Extracts columns by semantic type"
},
"arguments": {
"inputs": {
"type": "CONTAINER",
"data": "steps.2.produce"
}
},
"outputs": [
{
"id": "produce"
}
],
"hyperparams": {
"semantic_types": {
"type": "VALUE",
"data": [
"https://metadata.datadrivendiscovery.org/types/TrueTarget"
]
}
}
},
{
"type": "PRIMITIVE",
"primitive": {
"id": "d016df89-de62-3c53-87ed-c06bb6a23cde",
"version": "2019.6.7",
"python_path": "d3m.primitives.data_cleaning.imputer.SKlearn",
"name": "sklearn.impute.SimpleImputer"
},
"arguments": {
"inputs": {
"type": "CONTAINER",
"data": "steps.4.produce"
}
},
"outputs": [
{
"id": "produce"
}
]
},
{
"type": "PRIMITIVE",
"primitive": {
"id": "c8a28f02-ef4a-35a8-87f1-cf79980f5c3e",
"version": "2019.6.7",
"python_path": "d3m.primitives.classification.extra_trees.SKlearn",
"name": "sklearn.ensemble.forest.ExtraTreesClassifier"
},
"arguments": {
"inputs": {
"type": "CONTAINER",
"data": "steps.6.produce"
},
"outputs": {
"type": "CONTAINER",
"data": "steps.5.produce"
}
},
"outputs": [
{
"id": "produce"
}
]
},