Linear Regression with Python numpy
问题 I'm trying to make a simple linear regression function but continue to encounter a numpy.linalg.linalg.LinAlgError: Singular matrix error Existing function (with debug prints): def makeLLS(inputData, targetData): print "In makeLLS:" print " Shape inputData:",inputData.shape print " Shape targetData:",targetData.shape term1 = np.dot(inputData.T, inputData) term2 = np.dot(inputData.T, targetData) print " Shape term1:",term1.shape print " Shape term2:",term2.shape #print term1 #print term2