我收到错误为
“ValueError:预期的二维数组,而是得到一维数组:数组=[ 45000. 50000. 60000. 80000. 110000. 150000. 200000. 300000. 500000. 1000000. 1000000. 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000. ) 如果您的数据具有单个特征或 array.reshape(1, -1) 如果它包含单个样本。”
在执行以下代码时:
# SVR
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Position_S.csv')
X = dataset.iloc[:, 1:2].values
y = dataset.iloc[:, 2].values
# Feature Scaling
from sklearn.preprocessing import StandardScaler
sc_X = StandardScaler()
sc_y = StandardScaler()
X = sc_X.fit_transform(X)
y = sc_y.fit_transform(y)
# Fitting SVR to the dataset
from sklearn.svm …Run Code Online (Sandbox Code Playgroud)