python - 我正在 juypter 上的 python 中使用 Keras 包
问题描述
这是我尝试执行以重新缩放矩阵的代码,或者我们可以说训练示例:
scaler=MinMaxScaler(feature_range=(0,1))
scaled_trained_samples=scaler.fit_transform((train_samples).train_reshape(-1,+1))
错误是:
AttributeError Traceback (most recent call last)
<ipython-input-18-983807c433d9> in <module>
1 scaler=MinMaxScaler(feature_range=(0,1))
----> 2 scaled_trained_samples=scaler.fit_transform((train_samples).train_reshape(-1,+1))
AttributeError: 'numpy.ndarray' object has no attribute 'train_reshape'
解决方案
它接缝train_samples
是一个 numpy 数组。train_reshape
是缩放器的一种方法。例如,您可以这样做scaler.train_reshape()
,但不能train_samples.train_reshape()
。
为此,请尝试:
scaled_trained_samples=scaler.fit_transform(train_samples.reshape(-1,+1))
推荐阅读
- powershell - 查询扩展属性 1 失败空变量
- sql - 如何删除这种类型的表名 [someprefix].table
- r - 更改 ggplot2 中的顺序
- php - CakePHP 未更新数据库中的完整数组
- c# - 如何从 C# 中的 API 创建的 IList 中检索数据
- javascript - 未捕获的类型错误:与 html 一起使用时无法读取 null 的属性“querySelector”
- html - Microsoft Edge 日期输入显示两次值
- javafx - 尝试在 JavaFX 中设置 PieChart 图例垂直的问题
- flutter - 如何将小部件分配给 FadeInImage 中的占位符?
- elasticsearch - 弹性搜索聚合查询抛出异常