資源簡介
linear_algebra-master.rar
代碼片段和文件信息
import?numpy?as?np?
def?generateMatrix(rankseedsingular=False):
????np.random.seed(seed)
????while?True:
????????matrix?=?np.random.randint(-1010?size=(rank?rank))
????????if?(np.linalg.matrix_rank(matrix)?!=?rank)?^?(not?singular):
????????????return?matrix
def?printInMatrixFormat(Abpadding=7truncating=3):
????rank?=?len(Ab)
????rowFormat?=?‘‘.join([“{{:>{}.{}f}}“.format(paddingtruncating)]?*?rank)?+?“?||?{{:^{}.{}f}}“.format(paddingtruncating)?????
????matrixFormat?=?‘\n‘.join([rowFormat]?*?rank)
????flattern?=?[e?for?row?in?Ab?for?e?in?row]
????print(matrixFormat.format(*flattern))
def?generatePoints(seednum=100):
????np.random.seed(seed)
????m?=?np.random.random()?*?10?-?5?#?-5?~?5
????b?=?np.random.random()?*?10?+?5?#?5?~?15
????x?=?np.random.
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1309??2017-12-18?11:17??helper.pyc
?????文件????2301909??2018-01-08?10:59??linear_regression_project.ipynb
?????文件???????4961??2017-12-06?23:13??README.md
?????文件???????4935??2017-12-14?00:54??test.py
?????文件????????922??2017-12-14?00:54??helper.py
-----------?---------??----------?-----??----
??????????????2314036????????????????????5
評論
共有 條評論