# -*- coding: utf-8 -*-

##########################################################################
# Project: COMP6004 - Machine learning pipeline for data analysis
# File: 06-visualisation.py
# Author: Diego Bueno - d.bueno.da.silva.10@student.scu.edu.au 
# Date: 26/04/2021
# Description: Visualising results of the ML pipeline.
#
##########################################################################
# Maintenance                            
# Author: 
# Date:  
# Description: 
#
##########################################################################>

import numpy as np
import pandas as pd
from functions import openfile
import matplotlib.pyplot as plt

#calling the function to Load data pre-reading on task 1
print("\nReading the step06 file\n")
_df = openfile('data/step06.csv')

print("\nChecking the current shape of the data:")
rows, columns = _df.shape
print( str(rows) + " rows and " + str(columns) + " columns")

print("\nBrief summary of data:\n")
print(_df.head(12))

lenDf = len(_df.index)

if lenDf > 0:
            
        jet = plt.get_cmap('jet')
        colors = iter(jet(np.linspace(0,1,lenDf - 1)))
    
        for index, row in _df.iterrows():
    
            if index > 1: # do not plot linear regression
                # Plotting values per error
                plt.scatter(row["arrival_date_month"],row["Demand"], color= next(colors) )
                plt.xlabel("Month ") 
                plt.ylabel("Demand" )
    
        # show the plot of Polynomial degree vs Cost Function by MSE
        plt.show()
