regressor

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrModelWeightsInvalid = fmt.Errorf("ModelWeights is invalid")
)

Functions

This section is empty.

Types

type AllWeights

type AllWeights struct {
	CategoricalVariables map[string]map[string]CategoricalFeature `json:"Categorical_Variables"`
	NumericalVariables   map[string]NormalizedNumericalFeature    `json:"Numerical_Variables"`
	BiasWeight           float64                                  `json:"Bias_Weight,omitempty"`
	CurveFitWeights      []float64                                `json:"CurveFit_Weights,omitempty"`
}

type CategoricalFeature

type CategoricalFeature struct {
	Weight float64 `json:"weight"`
}

type ComponentModelWeights

type ComponentModelWeights map[string]ModelWeights

type ExponentialPredictor

type ExponentialPredictor struct {
	ModelWeights
}

type LinearPredictor

type LinearPredictor struct {
	ModelWeights
}

type LogarithmicPredictor

type LogarithmicPredictor struct {
	ModelWeights
}

type LogisticPredictor

type LogisticPredictor struct {
	ModelWeights
}

type ModelRequest

type ModelRequest struct {
	MetricNames  []string `json:"metrics"`
	OutputType   string   `json:"output_type"`
	EnergySource string   `json:"source"`
	NodeType     int      `json:"node_type"`
	Weight       bool     `json:"weight"`
	TrainerName  string   `json:"trainer_name"`
	SelectFilter string   `json:"filter"`
}

ModelRequest defines a request to Kepler Model Server to get model weights

type ModelWeights

type ModelWeights struct {
	AllWeights `json:"All_Weights"`
}

type NormalizedNumericalFeature

type NormalizedNumericalFeature struct {
	Scale  float64 `json:"scale"` // to normalize the data
	Weight float64 `json:"weight,omitempty"`
}

type Predictor

type Predictor interface {
	// contains filtered or unexported methods
}

Predictor defines required implementation for power prediction

func NewExponentialPredictor

func NewExponentialPredictor(weight ModelWeights) (predictor Predictor, err error)

func NewLinearPredictor

func NewLinearPredictor(weight ModelWeights) (predictor Predictor, err error)

NewLinearPredictor creates a new LinearPredictor instance with the provided ModelWeights

func NewLogarithmicPredictor

func NewLogarithmicPredictor(weight ModelWeights) (predictor Predictor, err error)

func NewLogisticPredictor

func NewLogisticPredictor(weight ModelWeights) (predictor Predictor, err error)

type Regressor

type Regressor struct {
	ModelServerEndpoint  string
	OutputType           types.ModelOutputType
	EnergySource         string
	TrainerName          string
	SelectFilter         string
	ModelWeightsURL      string
	ModelWeightsFilepath string

	FloatFeatureNames           []string
	SystemMetaDataFeatureNames  []string
	SystemMetaDataFeatureValues []string
	// contains filtered or unexported fields
}

Regressor defines power estimator with regression approach

func (*Regressor) AddDesiredOutValue

func (r *Regressor) AddDesiredOutValue(y float64)

AddDesiredOutValue adds the the y, which is the response variable (or the dependent variable) of regression. Regressor is trained off-line then we do not add Y for trainning. We might implement it in the future.

func (*Regressor) AddNodeFeatureValues

func (r *Regressor) AddNodeFeatureValues(x []float64)

AddNodeFeatureValues adds the the x for prediction, which is the variable used to calculate the ratio. Regressor is not trained, then we cannot Add training samples, only samples for prediction. The Regressor does not differentiate node or process power estimation, the difference will only be the amount of resource utilization

func (*Regressor) AddProcessFeatureValues

func (r *Regressor) AddProcessFeatureValues(x []float64)

AddProcessFeatureValues adds the the x for prediction, which are the explanatory variables (or the independent variable) of regression. Regressor is trained off-line then we cannot Add training samples. We might implement it in the future. The Regressor does not differentiate node or process power estimation, the difference will only be the amount of resource utilization

func (*Regressor) GetComponentsPower

func (r *Regressor) GetComponentsPower(isIdlePower bool) ([]source.NodeComponentsEnergy, error)

GetComponentsPower applies each component's ModelWeight prediction and return a map of component power associated to each process/process/pod

func (*Regressor) GetGPUPower

func (r *Regressor) GetGPUPower(isIdlePower bool) ([]float64, error)

GetComponentsPower returns GPU Power in Watts associated to each each process

func (*Regressor) GetModelType

func (r *Regressor) GetModelType() types.ModelType

GetModelType returns the model type

func (*Regressor) GetNodeFeatureNamesList

func (r *Regressor) GetNodeFeatureNamesList() []string

GetNodeFeatureNamesList returns the list of float features that the model was configured to use The Regressor does not differentiate node or process power estimation, the difference will only be the amount of resource utilization

func (*Regressor) GetPlatformPower

func (r *Regressor) GetPlatformPower(isIdlePower bool) ([]float64, error)

GetPlatformPower applies ModelWeight prediction and return a list of power associated to each process/process/pod

func (*Regressor) GetProcessFeatureNamesList

func (r *Regressor) GetProcessFeatureNamesList() []string

GetProcessFeatureNamesList returns the list of float features that the model was configured to use The Regressor does not differentiate node or process power estimation, the difference will only be the amount of resource utilization

func (*Regressor) IsEnabled

func (r *Regressor) IsEnabled() bool

IsEnabled returns true if the power model was trained and is active

func (*Regressor) ResetSampleIdx

func (r *Regressor) ResetSampleIdx()

ResetSampleIdx set the sample vector index to 0 to overwrite the old samples with new ones for trainning or prediction.

func (*Regressor) Start

func (r *Regressor) Start() error

Start returns nil if model weight is obtainable

func (*Regressor) Train

func (r *Regressor) Train() error

Train triggers the regressiong fit after adding data points to create a new power model. Regressor is trained off-line then we cannot trigger the trainning. We might implement it in the future.

Jump to

Keyboard shortcuts

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