Python Numpy TypeError: ufunc 'isfinite' not supported for the input types

前端 未结 1 1627
刺人心
刺人心 2020-12-06 10:52

Here\'s my code:

def topK(dataMat,sensitivity):
    meanVals = np.mean(dataMat, axis=0)
    meanRemoved = dataMat - meanVals
    covMat = np.cov(meanRemoved,         


        
相关标签:
1条回答
  • 2020-12-06 11:17

    Your array has a dtype of object, but this should be some floating point dtype. Use e.g.

    covMat = np.array(covMat, dtype=float)
    

    to convert the dtype

    0 讨论(0)
提交回复
热议问题