Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 反变换不适用于最小-最大标量_Python - Fatal编程技术网

Python 反变换不适用于最小-最大标量

Python 反变换不适用于最小-最大标量,python,Python,在应用列车测试分割之前,我在形状(4851,7)的数据上应用了最小-最大标量,其中包括列车和测试数据 scaler = MinMaxScaler() b = pd.DataFrame(scaler.fit_transform(a), columns=a.columns) 在尝试以下两种方法以恢复原始格式的预测值后 #1 yhat_new = scaler.inverse_transform(yhat)[:,[0]] #2 yhat_new = scaler.inverse_transform(

在应用列车测试分割之前,我在形状(4851,7)的数据上应用了最小-最大标量,其中包括列车和测试数据

scaler = MinMaxScaler()
b = pd.DataFrame(scaler.fit_transform(a), columns=a.columns)
在尝试以下两种方法以恢复原始格式的预测值后

#1
yhat_new = scaler.inverse_transform(yhat)[:,[0]]
#2
yhat_new = scaler.inverse_transform(yhat)
我得到如下错误:

ValueError:形状为(6,1)的不可广播输出操作数与广播形状(6,7)不匹配

我在一个变量“yhat”中得到了我的输出,该变量被创建为一个包含6个条目的列表

In[33] : yhat[0]
Out[33]: array([0.2938185], dtype=float32)