S
- a source-of-rows that is duplicated for each new thread (to prevent any concurrency
issues)public class FeatureExporter<S> extends Object
ExportFeatures
task.Modifier and Type | Field and Description |
---|---|
static String |
OUTPUT_THUMBNAILS
The output-name for writing thumbnails.
|
Constructor and Description |
---|
FeatureExporter(FeatureOutputMetadata outputMetadata,
java.util.function.Supplier<S> featureSource,
Optional<InputGrouper> grouper,
FeatureExporterContext context)
Creates the shared state.
|
Modifier and Type | Method and Description |
---|---|
void |
closeAndWriteOutputs(Optional<NamedFeatureStore<FeatureInputResults>> featuresAggregate,
boolean includeGroups,
java.util.function.Function<InputOutputContext,FeatureCSVWriterFactory> csvWriterCreator,
InputOutputContext context)
Writes all the results that have been collected as a CSV file, and closes open I/O handles
and memory structures.
|
static <T extends FeatureInput> |
create(FeatureOutputNames outputNames,
FeatureTableCalculator<T> features,
LabelHeaders identifierHeaders,
Optional<InputGrouper> grouper,
FeatureExporterContext context)
Alternative static constructor that creates a shared-state from a
NamedFeatureStore . |
static <T extends FeatureInput> |
create(List<NamedBean<FeatureListProvider<T>>> features,
LabelHeaders metadataHeaders,
FeatureOutputNames outputNames,
Optional<InputGrouper> grouper,
FeatureExporterContext context)
Alternative static constructor that creates a shared-state from a list of named
FeatureListProvider s. |
static <T extends FeatureInput> |
create(NamedFeatureStore<T> featureStore,
LabelHeaders metadataHeaders,
FeatureOutputNames outputNames,
Optional<InputGrouper> grouper,
FeatureExporterContext context)
Alternative static constructor that creates a shared-state from a
NamedFeatureStore . |
FeatureCalculationContext<S> |
createCalculationContext(Optional<String> groupName,
ExecutionTimeRecorder executionTimeRecorder,
InputOutputContext ioContext)
Creates a
FeatureCalculationContext for calculating features to later use this
exporter. |
FeatureNameList |
getFeatureNames()
The names of the features to be exported.
|
Optional<InputGrouper> |
getGrouper()
When defined, assigns each input to a group.
|
FeatureResultsAndThumbnails |
getResults()
Saved store feature calculation results, and writes associated thumbnails.
|
public static final String OUTPUT_THUMBNAILS
public FeatureExporter(FeatureOutputMetadata outputMetadata, java.util.function.Supplier<S> featureSource, Optional<InputGrouper> grouper, FeatureExporterContext context) throws OutputWriteFailedException
outputMetadata
- headers and output-name for the feature CSV file that is written.featureSource
- source of rows in the feature-table (called independently for each
thread).grouper
- when defined, assigns each input to a group.context
- context for exporting features.OutputWriteFailedException
public static <T extends FeatureInput> FeatureExporter<FeatureList<T>> create(List<NamedBean<FeatureListProvider<T>>> features, LabelHeaders metadataHeaders, FeatureOutputNames outputNames, Optional<InputGrouper> grouper, FeatureExporterContext context) throws CreateException
FeatureListProvider
s.T
- feature input-type in storefeatures
- a list of beans to create the features.metadataHeaders
- headers to describe any metadata.outputNames
- customizable output names used by LabelledResultsCollector
.grouper
- when defined, assigns each input to a group.context
- context.FeatureExporter
.CreateException
- if it cannot be successfully created.public static <T extends FeatureInput> FeatureExporter<FeatureList<T>> create(NamedFeatureStore<T> featureStore, LabelHeaders metadataHeaders, FeatureOutputNames outputNames, Optional<InputGrouper> grouper, FeatureExporterContext context) throws CreateException
NamedFeatureStore
.T
- feature input-type in storefeatureStore
- a list of beans to create the features.metadataHeaders
- headers to describe any metadata.grouper
- when defined, assigns each input to a group.context
- context.FeatureExporter
.CreateException
- if it cannot be successfully created.public static <T extends FeatureInput> FeatureExporter<FeatureTableCalculator<T>> create(FeatureOutputNames outputNames, FeatureTableCalculator<T> features, LabelHeaders identifierHeaders, Optional<InputGrouper> grouper, FeatureExporterContext context) throws CreateException
NamedFeatureStore
.T
- feature input-type in storeoutputNames
- the names of the feature outputs.features
- a table calculator for features.identifierHeaders
- headers to describe the identifier metadata before the feature
values.grouper
- when defined, assigns each input to a group.context
- context.FeatureExporter
.CreateException
- if it cannot be successfully created.public FeatureCalculationContext<S> createCalculationContext(Optional<String> groupName, ExecutionTimeRecorder executionTimeRecorder, InputOutputContext ioContext)
FeatureCalculationContext
for calculating features to later use this
exporter.groupName
- the group to associate with the feature-results when outputted.executionTimeRecorder
- records execution-times.ioContext
- IO-context.public void closeAndWriteOutputs(Optional<NamedFeatureStore<FeatureInputResults>> featuresAggregate, boolean includeGroups, java.util.function.Function<InputOutputContext,FeatureCSVWriterFactory> csvWriterCreator, InputOutputContext context) throws OutputWriteFailedException
featuresAggregate
- features that can be used for generating additional "aggregated"
exports.includeGroups
- iff true a group-column is included in the CSV file and the group
exports occur, otherwise not.csvWriterCreator
- creates a CSV writer for a particular IO-context.context
- IO-context.OutputWriteFailedException
- if any output cannot be written, or there is an error
closing open I/O.public FeatureNameList getFeatureNames()
public FeatureResultsAndThumbnails getResults()
public Optional<InputGrouper> getGrouper()
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.