d3m.base.utils¶
-
d3m.base.utils.combine_columns(inputs, column_indices, columns_list, *, return_result, add_index_columns)[source]¶ Method which appends existing columns, replaces them, or creates new result from them, based on
return_resultargument, which can beappend,replace, ornew.add_index_columnscontrols if when creating a new result, primary index columns should be added if they are not already among columns.inputsis a DataFrame for which we are appending on replacing columns, or if we are creating new result, from where a primary index column can be taken.column_indicescontrols which columns ininputswere used to createcolumns_list, and which columns should be replaced when replacing them.columns_listis a list of DataFrames representing all together new columns. The reason it is a list is to make it easier to operate per-column when preparingcolumns_listand not have to concat them all together unnecessarily.Top-level metadata in
columns_listis ignored, except when creating new result. In that case top-level metadata from the first element in the list is used.When
column_indicescolumns are being replaced withcolumns_list, existing metadata incolumn_indicescolumns is not preserved but replaced with metadata incolumns_list. Ideally, metadata forcolumns_listhas been constructed by copying source metadata fromcolumn_indicescolumns and modifying it as necessary to adapt it to new columns. Butcolumns_listalso can have completely new metadata, if this is more reasonable, but it should be understood that in this case when replacingcolumn_indicescolumns, any custom additional metadata on those columns will be lost.column_indicesandcolumns_listdo not have to match in number of columns. Columns are first replaced in order for matching indices and columns. If then there are morecolumn_indicesthancolumns_list, additionalcolumn_indicescolumns are removed. If there are morecolumns_listthancolumn_indicescolumns, then additionalcolumns_listare inserted after the last replaced column.If
column_indicesis empty, then the replacing behavior is equivalent to appending.- Return type
-
d3m.base.utils.combine_columns_metadata(inputs, column_indices, columns_list, *, return_result, add_index_columns)[source]¶ Analogous to
combine_columnsbut operates only on metadata.- Return type
-
d3m.base.utils.construct_file_uri(location_base_uris, filename)[source]¶ Construct the file URI given
location_base_urisvalues and afilename(which should be in POSIX format). Generally,filenamecomes from the column of a collection resource.- Return type
-
d3m.base.utils.get_columns_to_use(metadata, use_columns, exclude_columns, can_use_column)[source]¶ A helper function which computes a list of columns to use and a list of columns to ignore given
use_columns,exclude_columns, and acan_use_columnfunction which should returnTruewhen column can be used.
-
d3m.base.utils.get_tabular_resource(dataset, resource_id, *, pick_entry_point=True, pick_one=True, has_hyperparameter=True)[source]¶