I'm currently building my SVM model, I'm new to ML and have been building my model just by looking at the tutorial here and there. I have a problem at data visualization. This is the reference that I used https://data-flair.training/blogs/svm-support-vector-machine-tutorial/ This is my data visualization code:
markers = ('x', '.')
colors = ('blue', 'green')
cmap = ListedColormap(colors[:len(np.unique(y_test))])
for idx, cl in enumerate(np.unique(y)):
plt.scatter(x=X[y == cl, 0], y=X[y == cl, 1],
c=cmap(idx), marker=markers[idx], label=cl)
and this is the error message:
TypeError Traceback (most recent call last)
<ipython-input-17-cd1df4df7bea> in <module>()
4 print(cmap)
5 for idx, cl in enumerate(np.unique(y)):
----> 6 plt.scatter(x=X[y == cl, 0], y=X[y == cl, 1],
7 c=cmap(idx), marker=markers[idx], label=cl)
3 frames
/usr/local/lib/python3.7/dist-packages/pandas/core/frame.py in __getitem__(self, key)
3456 if self.columns.nlevels > 1:
3457 return self._getitem_multilevel(key)
-> 3458 indexer = self.columns.get_loc(key)
3459 if is_integer(indexer):
3460 indexer = [indexer]
/usr/local/lib/python3.7/dist-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
3359 casted_key = self._maybe_cast_indexer(key)
3360 try:
-> 3361 return self._engine.get_loc(casted_key)
3362 except KeyError as err:
3363 raise KeyError(key) from err
/usr/local/lib/python3.7/dist-packages/pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
/usr/local/lib/python3.7/dist-packages/pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
TypeError: '(0 True
1 True
2 True
3 True
4 True
...
12283 False
12284 False
12285 False
12286 False
12287 False
Name: Label, Length: 12288, dtype: bool, 0)' is an invalid key
I'm using datasets that have 2 labels and 8 features. What should I put as the plt.scatter parameter?