UCIHousing¶
该类是对 UCI housing 测试数据集的实现。
参数¶
返回值¶
Dataset
,UCI housing 数据集实例。
代码示例¶
>>> import paddle
>>> from paddle.text.datasets import UCIHousing
>>> class SimpleNet(paddle.nn.Layer):
... def __init__(self):
... super().__init__()
...
... def forward(self, feature, target):
... return paddle.sum(feature), target
>>> paddle.disable_static()
>>> uci_housing = UCIHousing(mode='train')
>>> for i in range(10):
... feature, target = uci_housing[i]
... feature = paddle.to_tensor(feature)
... target = paddle.to_tensor(target)
...
... model = SimpleNet()
... feature, target = model(feature, target)
... print(feature.shape, target.numpy())
[] [24.]
[] [21.6]
[] [34.7]
[] [33.4]
[] [36.2]
[] [28.7]
[] [22.9]
[] [27.1]
[] [16.5]
[] [18.9]