私はsklearnとpandasで作業しています。私の予測はインデックスとして設定された正しいIDのない配列として出てきます。私の出力で正しいIdをプリントアウトするには
マイコード:私は彼らが右ACTIVITY_IDリストをプリントアウトして取得することができますどのように
train = train.set_index('activity_id')
test = test.set_index('activity_id')
y_train = train['outcome']
x_train = train.drop('people_id', axis=1)
x_test = test
model = DecisionTreeClassifier(min_samples_leaf=100)
model.fit(x_train,y_train)
scores = cross_val_score(model, x_train,y_train, cv=10)
print('mean: {:.3f} (std: {:.3f})'.format(scores.mean(), scores.std()), end='\n\n')
print(model.score(x_train,y_train))
#make predictions
y_pred = model.predict(x_test)
任意の考え?ありがとう!
あなたが予測値の隣に正しい値を見たいですか?使用しているデータの例もあります。例えば'y_train.head()'と 'x_train.head()'です。 – josh
これは私のコード全体ではなく、質問に関連していると思う部分ですが、チップに感謝します。 – Bolajio