# Path: mlfromscratch/utils/data_operation.py
# def calculate_covariance_matrix(X, Y=None):
#     """ Calculate the covariance matrix for the dataset X """
#     if Y is None:
#         Y = X
#     n_samples = np.shape(X)[0]
#     covariance_matrix = (1 / (n_samples-1)) * (X - X.mean(axis=0)).T.dot(Y - Y.mean(axis=0))
# 
#     return np.array(covariance_matrix, dtype=float)
# 
# Path: mlfromscratch/utils/data_operation.py
# def calculate_correlation_matrix(X, Y=None):
#     """ Calculate the correlation matrix for the dataset X """
#     if Y is None:
#         Y = X
#     n_samples = np.shape(X)[0]
#     covariance = (1 / n_samples) * (X - X.mean(0)).T.dot(Y - Y.mean(0))
#     std_dev_X = np.expand_dims(calculate_std_dev(X), 1)
#     std_dev_y = np.expand_dims(calculate_std_dev(Y), 1)
#     correlation_matrix = np.divide(covariance, std_dev_X.dot(std_dev_y.T))
# 
#     return np.array(correlation_matrix, dtype=float)
# 
# Path: mlfromscratch/utils/data_manipulation.py
# def standardize(X):
#     """ Standardize the dataset X """
#     X_std = X
#     mean = X.mean(axis=0)
#     std = X.std(axis=0)
#     for col in range(np.shape(X)[1]):
#         if std[col]:
#             X_std[:, col] = (X_std[:, col] - mean[col]) / std[col]
#     # X_std = (X - X.mean(axis=0)) / X.std(axis=0)
#     return X_std


import progressbar
import matplotlib.pyplot as plt
import matplotlib.cm as cmx
import matplotlib.colors as colors
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from mlfromscratch.utils.data_operation import calculate_covariance_matrix
from mlfromscratch.utils.data_operation import calculate_correlation_matrix
from mlfromscratch.utils.data_manipulation import standardize


bar_widgets = [
    'Training: ', progressbar.Percentage(), ' ', progressbar.Bar(marker="-", left="[", right="]"),
    ' ', progressbar.ETA()
]

class Plot():
    def __init__(self): 
        self.cmap = plt.get_cmap('viridis')

    def _transform(self, X, dim):

# Path: mlfromscratch/utils/data_operation.py
# def calculate_covariance_matrix(X, Y=None):
#     """ Calculate the covariance matrix for the dataset X """
#     if Y is None:
#         Y = X
#     n_samples = np.shape(X)[0]
#     covariance_matrix = (1 / (n_samples-1)) * (X - X.mean(axis=0)).T.dot(Y - Y.mean(axis=0))
# 
#     return np.array(covariance_matrix, dtype=float)
# 
# Path: mlfromscratch/utils/data_operation.py
# def calculate_correlation_matrix(X, Y=None):
#     """ Calculate the correlation matrix for the dataset X """
#     if Y is None:
#         Y = X
#     n_samples = np.shape(X)[0]
#     covariance = (1 / n_samples) * (X - X.mean(0)).T.dot(Y - Y.mean(0))
#     std_dev_X = np.expand_dims(calculate_std_dev(X), 1)
#     std_dev_y = np.expand_dims(calculate_std_dev(Y), 1)
#     correlation_matrix = np.divide(covariance, std_dev_X.dot(std_dev_y.T))
# 
#     return np.array(correlation_matrix, dtype=float)
# 
# Path: mlfromscratch/utils/data_manipulation.py
# def standardize(X):
#     """ Standardize the dataset X """
#     X_std = X
#     mean = X.mean(axis=0)
#     std = X.std(axis=0)
#     for col in range(np.shape(X)[1]):
#         if std[col]:
#             X_std[:, col] = (X_std[:, col] - mean[col]) / std[col]
#     # X_std = (X - X.mean(axis=0)) / X.std(axis=0)
#     return X_std


# Path: mlfromscratch/utils/misc.py
import progressbar
import matplotlib.pyplot as plt
import matplotlib.cm as cmx
import matplotlib.colors as colors
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from mlfromscratch.utils.data_operation import calculate_covariance_matrix
from mlfromscratch.utils.data_operation import calculate_correlation_matrix
from mlfromscratch.utils.data_manipulation import standardize



bar_widgets = [
    'Training: ', progressbar.Percentage(), ' ', progressbar.Bar(marker="-", left="[", right="]"),
    ' ', progressbar.ETA()
]

class Plot():
    def __init__(self): 
        self.cmap = plt.get_cmap('viridis')

    def _transform(self, X, dim):

        covariance = calculate_covariance_matrix(X)