Package com.morpheusdata.embed
Class LeastSquaresCostForecastProvider
java.lang.Object
com.morpheusdata.embed.LeastSquaresCostForecastProvider
- All Implemented Interfaces:
CostForecastProvider
,PluginProvider
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 Summary
Modifier and TypeMethodDescriptiongenerateForecast
(Interval interval, List<CostHistory> costHistory, Integer numberOfForecastIntervals) Generate a forecast based on historical cost data.getCode()
A unique shortcode used for referencing the provided provider.Provide a description of this method of cost trend forecastinggetMinimumHistoricalData
(Interval interval) Determine the minimum number of historical data points required to generate a forecastReturns the Morpheus Context for interacting with data stored in the Main Morpheus ApplicationgetName()
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.Returns the instance of the Plugin class that this provider is loaded fromDetermine if this forecasting method requires historical data to generate forecastsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.morpheusdata.core.providers.PluginProvider
isPlugin
-
Method Details
-
getRequiresHistoricalData
Description copied from interface:CostForecastProvider
Determine if this forecasting method requires historical data to generate forecasts- Specified by:
getRequiresHistoricalData
in interfaceCostForecastProvider
- Returns:
- the boolean value indicating if historical data is required
-
getMinimumHistoricalData
Description copied from interface:CostForecastProvider
Determine the minimum number of historical data points required to generate a forecast- Specified by:
getMinimumHistoricalData
in interfaceCostForecastProvider
- 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 interfaceCostForecastProvider
- Parameters:
interval
- the interval of the historical data i.e. monthly based, quarterly, or yearlycostHistory
- the historical cost data to use for forecastingnumberOfForecastIntervals
- the number of intervals to forecast into the future- Returns:
- the list of forecasted cost data
-
getMorpheus
Returns the Morpheus Context for interacting with data stored in the Main Morpheus Application- Specified by:
getMorpheus
in interfacePluginProvider
- Returns:
- an implementation of the MorpheusContext for running Future based rxJava queries
-
getPlugin
Returns the instance of the Plugin class that this provider is loaded from- Specified by:
getPlugin
in interfacePluginProvider
- Returns:
- Plugin class contains references to other providers
-
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 interfacePluginProvider
- Returns:
- short code string that should be unique across all other plugin implementations.
-
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 interfacePluginProvider
- Returns:
- either an English name of a Provider or an i18n based key that can be scanned for in a properties file.
-
getDescription
Description copied from interface:CostForecastProvider
Provide a description of this method of cost trend forecasting- Specified by:
getDescription
in interfaceCostForecastProvider
- Returns:
- the description of the forecasting method
-