本文整理汇总了Python中layer.Layer.predict方法的典型用法代码示例。如果您正苦于以下问题:Python Layer.predict方法的具体用法?Python Layer.predict怎么用?Python Layer.predict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类layer.Layer
的用法示例。
在下文中一共展示了Layer.predict方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: train
# 需要导入模块: from layer import Layer [as 别名]
# 或者: from layer.Layer import predict [as 别名]
def train(self, X, y):
"""
Iteratively construct the multi-layer chain. Datapoints for which
a trusted prediction could not be found fall through to next layer.
"""
data = X.copy()
labels = y.copy()
count = 0
while count < 5:
try:
layer = Layer(data, labels)
except ValueError:
""" The number of classes has to be greater than one. """
break
else:
self.layers.append(layer)
results = [layer.predict(x) for x in data]
to_next_layer = [i for (i, r) in enumerate(results) if r is None]
data = np.array(data[to_next_layer])
labels = np.array(labels[to_next_layer])
count += 1