i have a decision tree model trained on my data set (df =…
- User
i have a decision tree model trained on my data set (df = pd.read_csv(r"C:\Users\mmmmm\Desktop\combined_BNB-BTC-BUSD-ETH-USDT_2dayprice_3label.csv")) my data labeled in 3 classes: 0,1 and 2
when separating my data set to train and dev set i saved my test set indices as indices_tes :
X_dev, X_test, y_dev, y_test, indices_dev, indices_test = train_test_split(X_temp, y_temp, indices_temp, test_size = 0.5, random_state = RANDOM_STATE)
after training i have the model prediction on my test_set:
y_test_pred = best_model.predict(X_test_scaled)
i want fetch the rows that model predicted as class 2,and also next 2 rows after that row, from the main data set ,and save them in a csv file with a column added to it as model predicted labels of corresponding rows
give me the proper python code
- Assistant