幾行python代碼實現one-hot編碼

#假設y是np.array數組形式的數組,形狀爲(row, col) #t是類別標籤,也爲數組,形狀爲(row,),好比[0,2,3,5,2,6] one_hot_t= np.zeros_like(y) #生成和y形狀同樣的元素爲零的數組 for j, i in zip(range(t.size), t): #有多少個樣本就應該對應多少個標籤 one_hot_t[j][i] =
相關文章
相關標籤/搜索