Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please define a python class as described below: Constructor : Takes the name of the data file as its only parameter. The constructor will use

Please define a python class as described below:

  • Constructor: Takes the name of the data file as its only parameter. The constructor will use Pandas to load the data from the file into a pandas DataFrame. It will then extract the data values form the DataFrame and save it in an instance variable of type numpy array called data.
  • A method called stats: This method will use aggregators to find max, min, sum, mean, standrad deviation of each column. The results should be stored in numpy arrays representing each computation. For example, the max array should hold max values of the columns.
  • A method called normalize: This method will use broadcasting to normalize each column of the data to the corresponding column's mean and standard deviation. That is, the standard deviation of each column is subtracted from each data point in the column and the result is then divided by the mean of that column. The method should first call the stats methods and then use stats produced to accomplish its tasks. Here is the formula that summarizes what needs to be done:

image text in transcribed

  • A method called plot_data: This method will take as input the following:
    • axis: This is the axis for the plot
    • feature: This is the feature to be plotted
    • normalize: This is a Boolean value indicating if the normalized data (True) or the original data should be plotted. Default should be True.
    The method should then plot the data as indicated.
  • A method called save_normalized_data_csv: This method should take as input the name of the output file and then save the normalized data as csv in the corresponding file. HINT: Convert the normalized data to a DataFrame and then save the DataFrame to the file. Bes sure to set index=False when saving the data frame so that the index is not produced to the output file.
  • A method called save_normalized_data_pickle: This method should take as input the name of the output file and then save the normalized data in the corresponding file in binary. HINT: Convert the normalized data to a DataFrame and then save the DataFrame to the file.
(1) (i) x; -std(x;) x_normalized. mean(x;) X; is the sample values of column x") is the ith sample value of columni std(x;) is the standard deviation of columni mean(x;) is the mean of column j, and x_normalized) is the normalized value of the ith sample of column j. (i (1) (i) x; -std(x;) x_normalized. mean(x;) X; is the sample values of column x") is the ith sample value of columni std(x;) is the standard deviation of columni mean(x;) is the mean of column j, and x_normalized) is the normalized value of the ith sample of column j. (i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Using QuickBooks Accountant 2018 For Accounting

Authors: Glenn Owen

16th Edition

0357042085, 9780357042083

More Books

Students also viewed these Accounting questions

Question

2. Should a disciplinary system be established at Carter Cleaning?

Answered: 1 week ago