>>> tot = sum(eigen_vals)
    >>> var_exp = [(i / tot) for i in
    ...            sorted(eigen_vals, reverse=True)]
    >>> cum_var_exp = np.cumsum(var_exp)
    >>> import matplotlib.pyplot as plt
    >>> plt.bar(range(1,14), var_exp, align='center',
    ...         label='Individual explained variance')
    >>> plt.step(range(1,14), cum_var_exp, where='mid',
    ...          label='Cumulative explained variance')
    >>> plt.ylabel('Explained variance ratio')
    >>> plt.xlabel('Principal component index')
    >>> plt.legend(loc='best')
    >>> plt.tight_layout()
    >>> plt.show()
    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.