ValueError: X has 2 features, but SVR is expecting 1 features as input


I’m traying to do a 3d ml, and when reaching the point of model.predict([xx,yy)], it gives me this error … and dont know what to do.

I’ve used as start point this dash

import numpy as np

import as px

import plotly.graph_objects as go

from sklearn.svm import SVR

mesh_size = .02

margin = 0

df =

X = df[['sepal_width', 'sepal_length']]

y = df['petal_width']

print("X es : ",X)

print("X tipo : ",type(X))

# Condition the model on sepal width and length, predict the petal width

model = SVR(C=1.), y)

# Create a mesh grid on which we will run our model

x_min, x_max = X.sepal_width.min() - margin, X.sepal_width.max() + margin

y_min, y_max = X.sepal_length.min() - margin, X.sepal_length.max() + margin

xrange = np.arange(x_min, x_max, mesh_size)

yrange = np.arange(y_min, y_max, mesh_size)

xx, yy = np.meshgrid(xrange, yrange)

# Run model

pred = model.predict(np.c_[xx.ravel(), yy.ravel()])

pred = pred.reshape(xx.shape)

# Generate the plot

fig = px.scatter_3d(df, x='sepal_width', y='sepal_length', z='petal_width')


fig.add_traces(go.Surface(x=xrange, y=yrange, z=pred, name='pred_surface'))