compute

package
v0.0.0-...-39ca940 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2021 License: Apache-2.0 Imports: 19 Imported by: 24

Documentation

Index

Constants

View Source
const (
	// DefaultResourceID is the default name of the main resource id in a schema.
	DefaultResourceID = "learningData"
	// DefaultExposedOutputKey is the standard output key applied to pipelines.
	DefaultExposedOutputKey = "outputs.0"
	// SolutionPendingStatus represents that the solution request has been acknoledged by not yet sent to the API
	SolutionPendingStatus = "SOLUTION_PENDING"
	// SolutionFittingStatus represents that the solution request has been sent to the API.
	SolutionFittingStatus = "SOLUTION_FITTING"
	// SolutionScoringStatus represents that the solution request has been sent to the API.
	SolutionScoringStatus = "SOLUTION_SCORING"
	// SolutionProducingStatus represents that the solution request has been sent to the API.
	SolutionProducingStatus = "SOLUTION_PRODUCING"
	// SolutionErroredStatus represents that the solution request has terminated with an error.
	SolutionErroredStatus = "SOLUTION_ERRORED"
	// SolutionCompletedStatus represents that the solution request has completed successfully.
	SolutionCompletedStatus = "SOLUTION_COMPLETED"
	// SolutionCancelledStatus represents that the solution request was intentionally cancelled.
	SolutionCancelledStatus = "SOLUTION_CANCELLED"
	// RequestPendingStatus represents that the solution request has been acknoledged by not yet sent to the API
	RequestPendingStatus = "REQUEST_PENDING"
	// RequestRunningStatus represents that the solution request has been sent to the API.
	RequestRunningStatus = "REQUEST_RUNNING"
	// RequestErroredStatus represents that the solution request has terminated with an error.
	RequestErroredStatus = "REQUEST_ERRORED"
	// RequestCompletedStatus represents that the solution request has completed successfully.
	RequestCompletedStatus = "REQUEST_COMPLETED"
	// D3MLearningData provides the name of the training csv file as defined in the D3M schema
	D3MLearningData = "learningData.csv"
	// DistilParquetLearningData provides the name of the training parquet file introduced by Distil
	DistilParquetLearningData = "learningData.parquet"
	// D3MDataFolder provides the name of the directory containing the dataset
	D3MDataFolder = "tables"
	// D3MDataSchema provides the name of the D3M data schema file
	D3MDataSchema = "datasetDoc.json"
	// D3MDatasetSchemaVersion is the current version supported when persisting
	D3MDatasetSchemaVersion = "3.0"
	// D3MResourceType is the resource type of persisted datasets
	D3MResourceType = "table"
	// D3MResourceFormat is the resource format of persisted dataset
	D3MResourceFormat = "text/csv"
	// DistilParquetResourceFormat is the parquet resource format of persisted dataset introduced by Distil
	DistilParquetResourceFormat = "application/parquet"
)
View Source
const (

	// ForecastingTask represents timeseries forcasting
	ForecastingTask = "forecasting"
	// ClassificationTask represents a classification task on image, timeseries or basic tabular data
	ClassificationTask = "classification"
	// RegressionTask represents a regression task on image, timeseries or basic tabular data
	RegressionTask = "regression"
	// ClusteringTask represents an unsupervised clustering task on image, timeseries or basic tabular data
	ClusteringTask = "clustering"
	// LinkPredictionTask represents a link prediction task on graph data
	LinkPredictionTask = "linkPrediction"
	// VertexClassificationTask represents a vertex nomination task on graph data
	VertexClassificationTask = "vertexClassification"
	// VertexNominationTask represents a vertex nomination task on graph data
	VertexNominationTask = "vertexNomination"
	// CommunityDetectionTask represents an unsupervised community detectiontask on on graph data
	CommunityDetectionTask = "communityDetection"
	// GraphMatchingTask represents an unsupervised matching task on graph data
	GraphMatchingTask = "graphMatching"
	// CollaborativeFilteringTask represents a collaborative filtering recommendation task on basic tabular data
	CollaborativeFilteringTask = "collaborativeFiltering"
	// ObjectDetectionTask represents an object detection task on image data
	ObjectDetectionTask = "objectDetection"
	// SemiSupervisedTask represents a semi-supervised classification task on tabular data
	SemiSupervisedTask = "semiSupervised"
	// BinaryTask represents task involving a single binary value for each prediction
	BinaryTask = "binary"
	// MultiClassTask represents a task involving a multi class value for each prediction
	MultiClassTask = "multiClass"
	// MultiLabelTask represents a task involving multiple lables for each each prediction
	MultiLabelTask = "multiLabel"
	// UnivariateTask represents a task involving predictions on a single variable
	UnivariateTask = "univariate"
	// MultivariateTask represents a task involving predictions on multiple variables
	MultivariateTask = "multivariate"
	// OverlappingTask represents a task involving overlapping predictions
	OverlappingTask = "overlapping"
	// NonOverlappingTask represents a task involving non-overlapping predictions
	NonOverlappingTask = "nonOverlapping"
	// TabularTask represents a task involving tabular data
	TabularTask = "tabular"
	// RelationalTask represents a task involving relational data
	RelationalTask = "relational"
	// ImageTask represents a task involving image data
	ImageTask = "image"
	// AudioTask represents a task involving audio data
	AudioTask = "audio"
	// VideoTask represents a task involving video data
	VideoTask = "video"
	// SpeechTask represents a task involving speech data
	SpeechTask = "speech"
	// TextTask represents a task involving text data
	TextTask = "text"
	// GraphTask represents a task involving graph data
	GraphTask = "graph"
	// MultiGraphTask represents a task involving multiple graph data
	MultiGraphTask = "multigraph"
	// TimeSeriesTask represents a task involving timeseries data
	TimeSeriesTask = "timeseries"
	// GroupedTask represents a task involving grouped data
	GroupedTask = "grouped"
	// GeospatialTask represents a task involving geospatial data
	GeospatialTask = "geospatial"
	// RemoteSensingTask represents a task involving remote sensing data
	RemoteSensingTask = "remoteSensing"
	// LupiTask represents a task involving LUPI (Learning Using Priveleged Information) data
	LupiTask = "lupi"
	// UndefinedTask is a flag for undefined/unknown task values
	UndefinedTask = "undefined"

	// UndefinedMetric is a flag for undefined/uknown metric values
	UndefinedMetric = "undefined"

	// CSVURIValueType denotes a CSV file URI at the TA2 level
	CSVURIValueType = "CSV_URI"
	// DatasetURIValueType denotes a D3M dataset file URI at the TA2 level
	DatasetURIValueType = "DATASET_URI"
	// ParquetURIValueType denotes a parquet file URI at the TA2 level
	ParquetURIValueType = "PARQUET_URI"
	// RawValueType denotes a raw numeric value
	RawValueType = "RAW"

	// HoldoutEvaluationMethod indicates a hold out model evaluation at the TA2 level
	HoldoutEvaluationMethod = "HOLDOUT"
)

Variables

This section is empty.

Functions

func BuildSchemaFileURI

func BuildSchemaFileURI(uri string) string

BuildSchemaFileURI updates a URI to match the expected structure of a the TA2TA3 API.

func ConvertDatasetTA3ToTA2

func ConvertDatasetTA3ToTA2(dataset string) string

ConvertDatasetTA3ToTA2 converts a dataset name from TA3 to TA2.

func ConvertMetricsFromTA3ToTA2

func ConvertMetricsFromTA3ToTA2(metrics []string, posLabel string) []*pipeline.ProblemPerformanceMetric

ConvertMetricsFromTA3ToTA2 converts metrics from TA3 to TA2 values.

func ConvertProblemMetricToTA2

func ConvertProblemMetricToTA2(metric string) string

ConvertProblemMetricToTA2 converts a problem schema metric to a TA2 metric.

func ConvertProblemTaskToTA2

func ConvertProblemTaskToTA2(metric string) string

ConvertProblemTaskToTA2 converts a problem schema metric to a TA2 task.

func ConvertTargetFeaturesTA3ToTA2

func ConvertTargetFeaturesTA3ToTA2(target string, columnIndex int) []*pipeline.ProblemTarget

ConvertTargetFeaturesTA3ToTA2 creates a problem target from a target name.

func ConvertTaskKeywordsFromTA3ToTA2

func ConvertTaskKeywordsFromTA3ToTA2(taskKeywords []string) []string

ConvertTaskKeywordsFromTA3ToTA2 converts a task from TA3 to TA2.

func GetAPIVersion

func GetAPIVersion() string

GetAPIVersion retrieves the ta3-ta2 API version embedded in the pipeline_core.proto file. This is a non-trivial operation, so the value is cached for quick access.

func GetDefaultTaskMetricsTA3

func GetDefaultTaskMetricsTA3(taskKeywords []string) []string

GetDefaultTaskMetricsTA3 returns the default TA3 metrics for a supplied list of TA3 task keywords.

func GetMetricLabel

func GetMetricLabel(metric string) string

GetMetricLabel returns a label string for a metric.

func GetMetricScoreMultiplier

func GetMetricScoreMultiplier(metric string) float64

GetMetricScoreMultiplier returns a weight to determine whether a higher or lower score is `better`.

func PullFromAPI

func PullFromAPI(maxPulls int, timeout time.Duration, pull PullFunc) error

PullFromAPI pulls from the api.

Types

type Client

type Client struct {
	UserAgent         string
	PullTimeout       time.Duration
	PullMax           int
	SkipPreprocessing bool
	// contains filtered or unexported fields
}

Client provides facilities for managing GPRC solution requests. Requests are isssued and a context object containing rx channels is returned to the caller for consumption of results. The context for running requests can also be fetched, along with their buffered results. Spawning a grpc.ClientConn per RPC call is not considered good practice - the system is designed such that multiple go routines make RPC calls to a single shared client, and synch is managed internally.

func NewClient

func NewClient(serverAddr string, trace bool, userAgent string, label string,
	pullTimeout time.Duration, pullMax int, skipPreprocessing bool, logger middleware.MethodLogger) (*Client, error)

NewClient creates a new pipline request dispatcher instance. This will establish the connection to the solution server or return an error on fail

func (*Client) Close

func (c *Client) Close()

Close the connection to the solution service

func (*Client) EndSearch

func (c *Client) EndSearch(ctx context.Context, searchID string) error

EndSearch ends the solution search session.

func (*Client) ExecutePipeline

func (c *Client) ExecutePipeline(ctx context.Context, datasetURIs []string, pipelineDesc *pipeline.PipelineDescription) (*pipeline.PipelineExecuteResponse, error)

ExecutePipeline executes a pre-specified pipeline.

func (*Client) ExportSolution

func (c *Client) ExportSolution(ctx context.Context, solutionID string) error

ExportSolution exports the solution.

func (*Client) GeneratePredictions

GeneratePredictions generates predictions.

func (*Client) GenerateSolutionFit

func (c *Client) GenerateSolutionFit(ctx context.Context, request *pipeline.FitSolutionRequest) ([]*pipeline.GetFitSolutionResultsResponse, error)

GenerateSolutionFit generates fit for candidate solutions.

func (*Client) GenerateSolutionScores

func (c *Client) GenerateSolutionScores(ctx context.Context, solutionID string, datasetURI string, metrics []string, posLabel string) ([]*pipeline.GetScoreSolutionResultsResponse, error)

GenerateSolutionScores generates scrores for candidate solutions.

func (*Client) GetSolutionDescription

func (c *Client) GetSolutionDescription(ctx context.Context, solutionID string) (*pipeline.DescribeSolutionResponse, error)

GetSolutionDescription gets the solution description via API call.

func (*Client) Hello

func (c *Client) Hello() (string, error)

Hello does the hello message exchange to check for basic connectivity.

func (*Client) LoadFittedSolution

func (c *Client) LoadFittedSolution(ctx context.Context, fittedSolutionURI string) (string, error)

LoadFittedSolution will have the server load a fitted solution by URI.

func (*Client) LoadSolution

func (c *Client) LoadSolution(ctx context.Context, solutionURI string) (string, error)

LoadSolution will have the server load a solution by URI.

func (*Client) SaveFittedSolution

func (c *Client) SaveFittedSolution(ctx context.Context, fittedSolutionID string) (string, error)

SaveFittedSolution saves the fitted solution.

func (*Client) SaveSolution

func (c *Client) SaveSolution(ctx context.Context, solutionID string) (string, error)

SaveSolution saves the solution.

func (*Client) SearchSolutions

func (c *Client) SearchSolutions(ctx context.Context, searchID string, solutionHandler SearchSolutionHandler) error

SearchSolutions generates candidate pipelines and executes a provided handler for each result. While handlers are executing asynchronously, this method will not return until all handlers have finished.

func (*Client) StartSearch

func (c *Client) StartSearch(ctx context.Context, request *pipeline.SearchSolutionsRequest) (string, error)

StartSearch starts a solution search session.

func (*Client) StopSearch

func (c *Client) StopSearch(ctx context.Context, searchID string) error

StopSearch stop the solution search session.

type ExecPipelineRequest

type ExecPipelineRequest struct {
	// contains filtered or unexported fields
}

ExecPipelineRequest defines a request that will execute a fully specified pipline on a TA2 system.

func NewExecPipelineRequest

func NewExecPipelineRequest(datasetURIs []string, datasetURIsProduce []string, pipelineDesc *pipeline.PipelineDescription) *ExecPipelineRequest

NewExecPipelineRequest creates a new request that will run the supplied dataset through the pipeline description.

func (*ExecPipelineRequest) Dispatch

func (e *ExecPipelineRequest) Dispatch(client *Client, templateRequest *pipeline.SearchSolutionsRequest, allowedValueTypes []string) error

Dispatch dispatches a pipeline execute request for processing by TA2.

func (*ExecPipelineRequest) Listen

Listen listens for new solution statuses and invokes the caller supplied function when a status update is received. The call will block until the request completes.

type ExecPipelineStatus

type ExecPipelineStatus struct {
	Progress  string
	RequestID string
	Error     error
	Timestamp time.Time
	ResultURI string
}

ExecPipelineStatus contains status / result information for a pipeline status request.

type ExecPipelineStatusListener

type ExecPipelineStatusListener func(status ExecPipelineStatus)

ExecPipelineStatusListener defines a function type for handling pipeline execution result updates.

type PullFunc

type PullFunc func() error

PullFunc is a function that pulls from an api.

type SearchSolutionHandler

type SearchSolutionHandler func(*pipeline.GetSearchSolutionsResultsResponse)

SearchSolutionHandler is executed when a new search solution is returned.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL