Models

Contains all possible time and cost regression models for GPU and non-GPU hardware instances

module models
class GPUModel

Finds best fit time/cost model as a function of hardware for GPU instances.

Public Functions

__init__(self, x, y)

GPUModel Constructor.

Parameters:
  • x – Hardware Data

  • y – Time, Cost, or Objective Cost

getModel(self)

Gets best fit model.

Returns:

Best Fit Model

regression(self, model, coeff_len)

Performs regression based on model type.

Parameters:
  • model – Regression Model Type

  • coeff_len – Number of coefficients required for this regression model

Returns:

Tuple containing R^2 and coefficients of given model

const_model(self, x, *coefficients, predict=False, single=False)

Constant Regression Model.

Returns:

Model Outputs

linear_model(self, x, *coefficients, predict=False, single=False)

Linear Regression Model.

Returns:

Model Outputs

log_model(self, x, *coefficients, predict=False, single=False)

Log Regression Model.

Returns:

Model Outputs

exp_model(self, x, *coefficients, predict=False, single=False)

Exponential Regression Model.

Returns:

Model Outputs

power_model(self, x, *coefficients, predict=False, single=False)

Power Regression Model.

Returns:

Model Outputs

hyper_model(self, x, *coefficients, predict=False, single=False)

Hyperbolic Regression Model.

Returns:

Model Outputs

Public Members

x_

Hardware Data.

y_

Time, Cost, or Objective Cost.

r_squared_threshold_

Minimum r^2 for best fit model (if it is below, then we say the correlation isn’t strong enough)

max_rsquared_

R^2 for best fit model.

model_

Best fit model.

is_const_model_

Const model boolean is true if the best fit model doesn’t have a strong enough correlation.

class Model

Finds best fit time/cost model as a function of hardware for non-GPU instances.

Public Functions

__init__(self, x, y)

Model Constructor.

Parameters:
  • x – Hardware Data

  • y – Time, Cost, or Objective Cost

getModel(self)

Gets best fit model.

Returns:

Best Fit Model

regression(self, model, coeff_len)

Performs regression based on model type.

Parameters:
  • model – Regression Model Type

  • coeff_len – Number of coefficients required for this regression model

Returns:

Tuple containing R^2 and coefficients of given model

linear_linear_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is linear and Memory is linear.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

linear_log_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is linear and Memory is log.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

linear_exp_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is linear and Memory is exponential.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

linear_power_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is linear and Memory is power.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

linear_hyper_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is linear and Memory is hyperbolic.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

log_linear_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is log and Memory is linear.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

log_log_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is log and Memory is log.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

log_exp_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is log and Memory is exponential.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

log_power_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is log and Memory is power.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

log_hyper_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is log and Memory is hyper.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

exp_linear_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is exponential and Memory is linear.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

exp_log_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is exponential and Memory is log.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

exp_exp_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is exponential and Memory is exponential.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

exp_power_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is exponential and Memory is power.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

exp_hyper_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is exponential and Memory is hyperbolic.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

power_linear_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is power and Memory is linear.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

power_log_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is power and Memory is log.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

power_exp_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is power and Memory is exponential.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

power_power_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is power and Memory is power.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

power_hyper_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is power and Memory is hyperbolic.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

hyper_linear_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is hyperbolic and Memory is linear.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

hyper_log_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is hyperbolic and Memory is log.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

hyper_exp_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is hyperbolic and Memory is exponential.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

hyper_power_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is hyperbolic and Memory is power.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

hyper_hyper_model(self, x, *coefficients, predict=False, single=False)

Model where CPU is hyperbolic and Memory is hyperbolic.

Parameters:
  • xModel Input

  • coefficientsModel coefficients

  • predict – Boolean if we are predicting (False if we are trying to curve fit and solve)

  • single – Boolean if we just want to run the model for single input

Returns:

Model Output

Public Members

x_

Hardware Data.

y_

Time, Cost, or Objective Cost.

max_rsquared_

R^2 for best fit model.

model_

Best fit model.