'How do I fix this error: "ValueError: Found array with 0 sample(s) (shape=(0, 18)) while a minimum of 1 is required." This is using the SVMSMOTE

I am trying to balance my classes in the dataset, but I am receiving an error after trying to apply the SVMSMOTE algorithm. I am receiving this full error below. I am hoping someone could help me figure out where I am going wrong.

ValueError                                Traceback (most recent call last)
<ipython-input-150-d907dac94024> in <module>()
      2 svmsmote = SVMSMOTE(random_state = 101)
      3 
----> 4 X, y = svmsmote.fit_resample(X,y)
      5 
      6 sns.countplot(y)

5 frames
/usr/local/lib/python3.7/dist-packages/sklearn/utils/validation.py in check_array(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, estimator)
    806                 "Found array with %d sample(s) (shape=%s) while a"
    807                 " minimum of %d is required%s."
--> 808                 % (n_samples, array.shape, ensure_min_samples, context)
    809             )
    810 

ValueError: Found array with 0 sample(s) (shape=(0, 18)) while a minimum of 1 is required.

For everyone else's sake, I am including the code that is producing the error.

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import confusion_matrix, accuracy_score
from sklearn import preprocessing

from google.colab import drive
drive.mount('/content/drive')

dataset = pd.read_csv("/content/drive/My Drive/IoT-23 _Final_Zeros.csv")
#dataset = pd.read_csv("/content/drive/My Drive/CYB509 Project/IoT-23 - 100 - Rows.csv")

X = dataset.iloc[:, :-1].values;
y = dataset.iloc[:, -1].values;

le = preprocessing.LabelEncoder()
for i in range(len(X[0])):
    X[:,i] = le.fit_transform(X[:,I])

y = le.fit_transform(y)

import seaborn as sns

sns.countplot(y='Labels', data=dataset)

from imblearn.over_sampling import SVMSMOTE 
svmsmote = SVMSMOTE(random_state = 101)

X, y = svmsmote.fit_resample(X,y) #error happens here.

sns.countplot(y)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source