from sklearn.preprocessing import Binarizer #数据预处理二元化Binarizer模型 def test_Binarizer(): X=[[1,2,3,4,5], [5,4,3,2,1], [3,3,3,3,3,], [1,1,1,1,1]] print("before transform:",X) binarizer=Binarizer(threshold=2.5) print("after transform:",binarizer.transform(X)) # 调用 test_Binarizer test_Binarizer()