机器学习实战-学习笔记-第一章

Added C:Anaconda and C:AnacondaScripts to PATH.

C:Anaconda>python
Python 2.7.10 |Anaconda 2.3.0 (64-bit)| (default, May 28 2015, 16:44:52) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>> from numpy import *
>>> random.rand(4,4)
array([[ 0.38283202, 0.24411293, 0.20685839, 0.86908758],
[ 0.82204289, 0.79030666, 0.54425868, 0.62909817],
[ 0.69141424, 0.05570164, 0.86871815, 0.40525779],
[ 0.49300032, 0.86729076, 0.62739796, 0.39128204]])
>>> randMat = mat(random.rand(4,4))
>>> randMat.I
matrix([[ -1.65887525, -0.54674459, 0.6650344 , 1.61916868],
[ 0.82374289, 6.37248535, 0.51246066, -3.93287389],
[ 3.12497009, 19.45526575, -2.25589289, -10.31209844],
[ -1.37650261, -18.53685293, 1.42581031, 10.04733715]])
>>> invRandMat = randMat.I
>>> randMat*invRandMat
matrix([[ 1.00000000e+00, -8.02451972e-18, 1.01938807e-16,
-6.19233770e-16],
[ 5.76917009e-17, 1.00000000e+00, -2.23558531e-17,
-8.65993001e-17],
[ -1.22922458e-17, 1.02609061e-16, 1.00000000e+00,
-1.43146861e-16],
[ -3.67067733e-17, 1.72130614e-16, 1.16959073e-16,
1.00000000e+00]])
>>> myEye = randMat*invRandMat
>>> myEye-eye(4)
matrix([[ 2.22044605e-16, -8.02451972e-18, 1.01938807e-16,
-6.19233770e-16],
[ 5.76917009e-17, -1.11022302e-16, -2.23558531e-17,
-8.65993001e-17],
[ -1.22922458e-17, 1.02609061e-16, 0.00000000e+00,
-1.43146861e-16],
[ -3.67067733e-17, 1.72130614e-16, 1.16959073e-16,
-3.33066907e-16]])
>>>

原文地址:https://www.cnblogs.com/littlesuccess/p/5020956.html