aiq.profiler.forecasting.models.linear_model#
Attributes#
Classes#
A linear regression model that conforms to the BaseModel interface. |
Module Contents#
- logger#
- class LinearModel#
Bases:
aiq.profiler.forecasting.models.forecasting_base_model.ForecastingBaseModel
A linear regression model that conforms to the BaseModel interface.
- model#
- matrix_length = None#
- fit(
- raw_stats: list[list[aiq.data_models.intermediate_step.IntermediateStep]],
X: shape (N, M) # M = matrix_length * 4 y: shape (N, 4)
- predict(
- raw_stats: list[list[aiq.data_models.intermediate_step.IntermediateStep]],
Predict using the fitted linear model. Returns shape (N, 4)
- _prep_single(raw_stats) numpy.ndarray #
- _prep_for_model_training(raw_stats)#
- _extract_token_usage_meta(all_requests_data)#
- _preprocess_for_forecasting(arr: numpy.ndarray, matrix_length: int)#
Given a 2D NumPy array
arr
of shape (n_rows, 4), generate a list of (input_array, output_array) pairs for forecasting, each of shape:input_array: (matrix_length, 4) after padding/trimming
output_array: (1, 4)
- _flatten_features(x_list, y_list)#
x_list: list of arrays, each of shape (matrix_length, 4) y_list: list of arrays, each of shape (1, 4)
- Returns:
x_flat: np.array of shape (N, matrix_length*4) y_flat: np.array of shape (N, 4)