No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2023-10-21 21:51:56 +00:00
Main completed solution with excel out 2023-10-21 17:21:31 -04:00
Assignment_1_-_Colin_Robbins.docx Upload submitting word doc 2023-10-21 21:51:56 +00:00
README.md Adjustments to readme 2023-10-21 21:51:18 +00:00

School-MeanCovarianceData

Assignment 1 – Mean, Covariance of Multivariate Data

Requirements

  • Question 1 – Using the Excel file dataA.xlsx, which contains a 500x3 data matrix (500 data points with 3 attributes), calculate both the mean and the covariance matrix.
  • Question 2 - Using the Excel file dataB.xlsx, which contains a 500x10 data matrix (500 data points with 10 attributes), calculate both the mean and the covariance matrix.
  • Question 3 – The data generated is random and normally distributed with a mean for dataA, dataB and covariance for dataA and dataB given in meanA.xlsx, meanB.xlsx, covarianceA.xlsx and covarianceB.xlsx respectively. Briefly explain why your answers are different from the parameters used to generate the data.

Custom Modules

Using "modules" to be able to condense code and create a level of reusability. They can be fine tuned but are good for the functional requirements of the assignment.

modules.Calculations.py

  • convert_to_numpy
    • Takes in the Pandas DataFrame and converts it to a NumPy array.
  • calculate_mean
    • Takes in Pandas DataFrame, runs the mean calculation after converting to a NumPy array and returns the result mean of the columns.
  • calculate_cov
    • Takes in a Pandas DataFrame, runs the covariance calculation by first substracting the mean of the DataFrame, returns the covariance result.

modules.ReadWriteExcel.py

  • Initialization
    • Constructor pulls the output locations from the config.ini file.
  • read_excel_file
    • Pulls from an excel file identified in the input variables, reads and returns the file as a Pandas DataFrame.
  • write_excel_file
    • Takes in the resulting NumPy array and the resulting file name. If its mean transpose the file to show the column mean, if its covariance output directly to the excel file.