我想将多输入提供给 sklearn 模型。
x = np.array(Disease_symptoms[['Symptom_1','Symptom_2','Symptom_3']])
y = np.array(Disease_symptoms['Precaution'])
print(x.shape ,"--", x.ndim)
cv = CountVectorizer(
stop_words='english',
ngram_range=(1, 1),
dtype='double')
treeclf = DecisionTreeClassifier()
X_train , X_test , Y_train , Y_test = train_test_split(X , y , test_size=0.2 )
treeclf.fit(X_train , Y_train)
problem1 = 'itch'
problem2 = 'skinrash'
problem3 = 'dischromicpatch'
vectors1 = cv.fit_transform([problem1]).toarray()
vectors2 = cv.fit_transform([problem2]).toarray()
vectors3 = cv.fit_transform([problem3]).toarray()
# vect =
treeclf.predict([vectors1 , vectors2 , vectors3])
但是当尝试上面的代码时,我得到了一个错误:
Found array with dim 3. Estimator expected <= 2