如何保存lda模型并在另一个函数中调用它以供将来预测
data=pd.DataFrame(ivector_list,index=label)
data.to_csv("ivector/Ivector.csv")
Y=data.index
X=data.reset_index(drop=True)
X_train, X_test, y_train, y_test = train_test_split(X, Y, test_size=0.25,random_state=50)
lda = LinearDiscriminantAnalysis(n_components = 50)
model=lda.fit_transform(X_train,y_train)
predictions = lda.predict(X_test)
saved_model=pickle.dumps(model)
但是当我尝试使用saved_model预测时会收到此错误
AttributeError: 'numpy.ndarray' object has no attribute 'predict'
pre=saved_model.predict(d1)