Class LeastSquaresCostForecastProvider

java.lang.Object
com.morpheusdata.embed.LeastSquaresCostForecastProvider
All Implemented Interfaces:
CostForecastProvider, PluginProvider

public class LeastSquaresCostForecastProvider extends Object implements CostForecastProvider
This is an implementation of the Least Squares Cost Forecasting Method It is a simple linear regression model that uses the least squares method to fit a line to the data and then uses that line to forecast future costs.
Since:
1.1.2
  • Method Details

    • getRequiresHistoricalData

      public Boolean getRequiresHistoricalData()
      Description copied from interface: CostForecastProvider
      Determine if this forecasting method requires historical data to generate forecasts
      Specified by:
      getRequiresHistoricalData in interface CostForecastProvider
      Returns:
      the boolean value indicating if historical data is required
    • getMinimumHistoricalData

      public Integer getMinimumHistoricalData(Interval interval)
      Description copied from interface: CostForecastProvider
      Determine the minimum number of historical data points required to generate a forecast
      Specified by:
      getMinimumHistoricalData in interface CostForecastProvider
      Parameters:
      interval - the interval of the historical data i.e. monthly based, quarterly, or yearly
      Returns:
      the minimum number of historical data points required
    • generateForecast

      public List<Forecast> generateForecast(Interval interval, List<CostHistory> costHistory, Integer numberOfForecastIntervals)
      Description copied from interface: CostForecastProvider
      Generate a forecast based on historical cost data. This is where the magic happens.
      Specified by:
      generateForecast in interface CostForecastProvider
      Parameters:
      interval - the interval of the historical data i.e. monthly based, quarterly, or yearly
      costHistory - the historical cost data to use for forecasting
      numberOfForecastIntervals - the number of intervals to forecast into the future
      Returns:
      the list of forecasted cost data
    • getMorpheus

      public MorpheusContext getMorpheus()
      Returns the Morpheus Context for interacting with data stored in the Main Morpheus Application
      Specified by:
      getMorpheus in interface PluginProvider
      Returns:
      an implementation of the MorpheusContext for running Future based rxJava queries
    • getPlugin

      public Plugin getPlugin()
      Returns the instance of the Plugin class that this provider is loaded from
      Specified by:
      getPlugin in interface PluginProvider
      Returns:
      Plugin class contains references to other providers
    • getCode

      public String getCode()
      A unique shortcode used for referencing the provided provider. Make sure this is going to be unique as any data that is seeded or generated related to this provider will reference it by this code.
      Specified by:
      getCode in interface PluginProvider
      Returns:
      short code string that should be unique across all other plugin implementations.
    • getName

      public String getName()
      Provides the provider name for reference when adding to the Morpheus Orchestrator NOTE: This may be useful to set as an i18n key for UI reference and localization support.
      Specified by:
      getName in interface PluginProvider
      Returns:
      either an English name of a Provider or an i18n based key that can be scanned for in a properties file.
    • getDescription

      public String getDescription()
      Description copied from interface: CostForecastProvider
      Provide a description of this method of cost trend forecasting
      Specified by:
      getDescription in interface CostForecastProvider
      Returns:
      the description of the forecasting method