成功解决sklearn.exceptions.NotFittedError: This StandardScaler instance is not fitted yet. Call ‘fit‘ wi

简介: 成功解决sklearn.exceptions.NotFittedError: This StandardScaler instance is not fitted yet. Call ‘fit‘ wi


目录

解决问题

解决思路

解决方法


 

 

 

解决问题

sklearn.exceptions.NotFittedError: This StandardScaler instance is not fitted yet. Call 'fit' with appropriate arguments before using this estimator.

 

 

 

解决思路

sklearn异常未装配错误:此StandardScaler实例尚未装配。在使用这个估计器之前,使用适当的参数调用“fit”。

 

 

解决方法

1. ss_X = StandardScaler()  
2. ss_y = StandardScaler()
3. X_train = ss_X.fit_transform(X_train)            
4. X_test  = ss_X.transform(X_test)

 

相关文章
|
4月前
|
算法框架/工具
【Tensorflow+keras】解决Exception has occurred: ValueError Shape mismatch: The shape of labels (received
在使用Keras构建的图像分类模型训练过程中,因使用了sparse_categorical_crossentropy损失函数而导致标签形状与模型输出形状不匹配的错误,解决方法是更换损失函数为categorical_crossentropy。
73 0
|
5月前
|
PyTorch 算法框架/工具 机器学习/深度学习
|
数据库
解决numpy.core._exceptions.UFuncTypeError: ufunc ‘add‘ did not contain a loop with signature matching
解决numpy.core._exceptions.UFuncTypeError: ufunc ‘add‘ did not contain a loop with signature matching
1145 0
解决numpy.core._exceptions.UFuncTypeError: ufunc ‘add‘ did not contain a loop with signature matching
|
PyTorch 算法框架/工具 开发者
RuntimeError: Can‘t call numpy() on Variable that requires grad. Use var.detach().numpy()
出现这个现象的原因是:待转换类型的PyTorch Tensor变量带有梯度,直接将其转换为numpy数据将破坏计算图,因此numpy拒绝进行数据转换,实际上这是对开发者的一种提醒。如果自己在转换数据时不需要保留梯度信息,可以在变量转换之前添加detach()调用。
189 0
【sklearn报错解决方案】UndefinedMetricWarning: Precision is ill-defined and being set to 0.0
【sklearn报错解决方案】UndefinedMetricWarning: Precision is ill-defined and being set to 0.0
1798 0
【sklearn报错解决方案】UndefinedMetricWarning: Precision is ill-defined and being set to 0.0
|
Python
解决ValueError: `validation_split` is only supported for Tensors or NumPy arrays, found following
解决ValueError: `validation_split` is only supported for Tensors or NumPy arrays, found following
641 0
解决ValueError: `validation_split` is only supported for Tensors or NumPy arrays, found following
|
PyTorch 算法框架/工具
Please ensure they have the same size. return F.mse_loss(input, target, reduction=self.reduction) 怎么解决?
这个通常是由于 input 和 target 张量的维度不匹配导致的,因此可以通过调整它们的维度来解决。
325 0
|
异构计算
Resource exhausted: OOM when allocating tensor with shape[2304,384] Traceback (most recent call last
Resource exhausted: OOM when allocating tensor with shape[2304,384] Traceback (most recent call last
239 0
|
Linux PyTorch 算法框架/工具
Some weights of the model checkpoint at mypath/bert-base-chinese were not used when initializing Ber
Some weights of the model checkpoint at mypath/bert-base-chinese were not used when initializing Ber
from sklearn.cross_validation import train_test_split发生报错
from sklearn.cross_validation import train_test_split发生报错
269 0
from sklearn.cross_validation import train_test_split发生报错