-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
I had an error when my model predicting.
The errors is as follows:
IndexError: only integers, slices (:
), ellipsis (...
), numpy.newaxis (None
) and integer or boolean arrays are valid indices
data:
https://drive.google.com/file/d/1shHSwV-D10B3dd25RU1hytpCMMYkfwjr/view?usp=sharing
This task is multi-classification task.
and my implementation environment:
Google colab, pycaret 2.2.3
my code is as follows:
from pycaret.classification import *
import pandas as pd
import numpy as np
train = pd.read_csv('train_features.csv')
train_label = pd.read_csv('train_labels.csv')
test = pd.read_csv('test_features.csv')
submission = pd.read_csv('sample_submission.csv')
features = ['id', 'acc_x', 'acc_y', 'acc_z', 'gy_x', 'gy_y', 'gy_z']
X_train = train[features].groupby('id').aggregate([np.min, np.max, np.mean]).round(decimals=2)
X_test = test[features].groupby('id').aggregate([np.min, np.max, np.mean]).round(decimals=2)
X_train.columns = [a+b for a,b in X_train.keys()]
X_train.reset_index(inplace=True)
X_train
X_train['label'] = train_label['label']
clf = setup(data = X_train, target = 'label')
compare_models()
dt = create_model('dt')
tuned_dt = tune_model(dt)
predict_model(tuned_dt)
output
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-44-ba50f62b176f> in <module>()
----> 1 predict_model(tuned_dt)
1 frames
/usr/local/lib/python3.6/dist-packages/pycaret/classification.py in predict_model(estimator, data, probability_threshold, encoded_labels, round, verbose)
1907 round=round,
1908 verbose=verbose,
-> 1909 ml_usecase=MLUsecase.CLASSIFICATION,
1910 )
1911
/usr/local/lib/python3.6/dist-packages/pycaret/internal/tabular.py in predict_model(estimator, data, probability_threshold, encoded_labels, round, verbose, ml_usecase, display)
8399 d = []
8400 for i in range(0, len(score)):
-> 8401 d.append(score[i][pred[i]])
8402
8403 score = d
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
how to solve this error? please give me some advice. thanks :)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working