成功解决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)

 

相关文章
|
IDE PyTorch 网络安全
|
2月前
|
TensorFlow 算法框架/工具
【Tensorflow】解决A `Concatenate` layer should be called on a list of at least 2 inputs
在TensorFlow 2.0中,使用Concatenate函数时出现错误,可以通过替换为tf.concat 来解决。
24 4
|
2月前
|
TensorFlow API 算法框架/工具
【Tensorflow】解决Inputs to eager execution function cannot be Keras symbolic tensors, but found [<tf.Te
文章讨论了在使用Tensorflow 2.3时遇到的一个错误:"Inputs to eager execution function cannot be Keras symbolic tensors...",这个问题通常与Tensorflow的eager execution(急切执行)模式有关,提供了三种解决这个问题的方法。
28 1
|
2月前
|
算法框架/工具
【Tensorflow+keras】解决Exception has occurred: ValueError Shape mismatch: The shape of labels (received
在使用Keras构建的图像分类模型训练过程中,因使用了sparse_categorical_crossentropy损失函数而导致标签形状与模型输出形状不匹配的错误,解决方法是更换损失函数为categorical_crossentropy。
38 0
|
4月前
|
并行计算 监控 Java
函数计算操作报错合集之遇到报错:RuntimeError: Expected all tensors to be on the same device,是什么原因
在使用函数计算服务(如阿里云函数计算)时,用户可能会遇到多种错误场景。以下是一些常见的操作报错及其可能的原因和解决方法,包括但不限于:1. 函数部署失败、2. 函数执行超时、3. 资源不足错误、4. 权限与访问错误、5. 依赖问题、6. 网络配置错误、7. 触发器配置错误、8. 日志与监控问题。
110 1
|
5月前
解决Error:All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com
解决Error:All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com
72 5
|
数据库
解决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
1009 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()调用。
163 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
1540 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
619 0
解决ValueError: `validation_split` is only supported for Tensors or NumPy arrays, found following