def preprocess(): autoRegressiveMovingAverageForecastingDataset = importAutoRegressiveMovingAverageForecastingDataset( "DailyTotalFemaleBirths.csv") X_train, X_test = splitAutoRegressiveMovingAverageForecastingDataset( autoRegressiveMovingAverageForecastingDataset) saveTrainingAndTestingDataset(X_train, X_test)
def trainAutoRegressiveMovingAverageForecastingModelOnFullDataset(): autoRegressiveMovingAverageForecastingDataset = importAutoRegressiveMovingAverageForecastingDataset("DailyTotalFemaleBirths.csv") #training model on the whole dataset autoRegressiveMovingAverageForecastingModel = ARMA(autoRegressiveMovingAverageForecastingDataset["Births"], order = (2, 2)) autoRegressiveMovingAverageForecastingModelFitResult = autoRegressiveMovingAverageForecastingModel.fit() autoRegressiveMovingAverageForecastingModelFitResult.summary() saveAutoRegressiveMovingAverageForecastingModelForFullDataset(autoRegressiveMovingAverageForecastingModelFitResult)
def plotAutoRegressiveMovingAverageForecastingForecastedValues(): #reading the dataset autoRegressiveMovingAverageForecastingDataset = importAutoRegressiveMovingAverageForecastingDataset( "DailyTotalFemaleBirths.csv") #reading the forecated values autoRegressiveMovingAverageForecastingForecastedValues = readAutoRegressiveMovingAverageForecastingForecastedValues( ) #visualizing the forecated values visualizeAutoRegressiveMovingAverageForecastingForecastedValues( autoRegressiveMovingAverageForecastingDataset, autoRegressiveMovingAverageForecastingForecastedValues)
def forecastAutoRegressiveMovingAverageForecastingModel(): #reading the dataset autoRegressiveMovingAverageForecastingDataset = importAutoRegressiveMovingAverageForecastingDataset( "DailyTotalFemaleBirths.csv") #reading the model whichis trained on the whole dataset autoRegressiveMovingAverageForecastingModel = readAutoRegressiveMovingAverageForecastingModelForFullDataset( ) #forecasting for 11 months autoRegressiveMovingAverageForecastingForecastedValues = autoRegressiveMovingAverageForecastingModel.predict( len(autoRegressiveMovingAverageForecastingDataset), len(autoRegressiveMovingAverageForecastingDataset) + 11, typ='levels').rename("ARMA(2,2) Prediction") #saving the forecasted values saveAutoRegressiveMovingAverageForecastingForecastedValues( autoRegressiveMovingAverageForecastingForecastedValues)
def determineARMAOrderOfPAndQ(): autoRegressiveMovingAverageForecastingDataset = importAutoRegressiveMovingAverageForecastingDataset("DailyTotalFemaleBirths.csv") auto_arima(autoRegressiveMovingAverageForecastingDataset["Births"], seasonal = False, trace = True).summary()
def testIsDatasetStationary(): autoRegressiveMovingAverageForecastingDataset = importAutoRegressiveMovingAverageForecastingDataset("DailyTotalFemaleBirths.csv") agumentedDickeyFullerTest(autoRegressiveMovingAverageForecastingDataset["Births"])