当前位置: 首页>>代码示例>>Golang>>正文


Golang Sample.ToMapBasedSample方法代码示例

本文整理汇总了Golang中github.com/xlvector/hector/core.Sample.ToMapBasedSample方法的典型用法代码示例。如果您正苦于以下问题:Golang Sample.ToMapBasedSample方法的具体用法?Golang Sample.ToMapBasedSample怎么用?Golang Sample.ToMapBasedSample使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/xlvector/hector/core.Sample的用法示例。


在下文中一共展示了Sample.ToMapBasedSample方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Predict

func (rdt *RandomDecisionTree) Predict(sample *core.Sample) float64 {
	ret := 0.0
	total := 0.0
	msample := sample.ToMapBasedSample()
	for _, tree := range rdt.trees {
		node, _ := PredictBySingleTree(tree, msample)
		ret += node.prediction.GetValue(1)
		total += 1.0
	}
	return ret / total
}
开发者ID:jamesbjackson,项目名称:hector,代码行数:11,代码来源:random_decision_tree.go

示例2: Predict

func (dt *RandomForest) Predict(sample *core.Sample) float64 {
	msample := sample.ToMapBasedSample()
	predictions := 0.0
	total := 0.0
	for _, tree := range dt.trees {
		node, _ := PredictBySingleTree(tree, msample)
		predictions += node.prediction.GetValue(1)
		total += 1.0
	}
	return predictions / total
}
开发者ID:irwenqiang,项目名称:hector,代码行数:11,代码来源:random_forest.go

示例3: PredictMultiClass

func (rdt *RandomDecisionTree) PredictMultiClass(sample *core.Sample) *core.ArrayVector {
	msample := sample.ToMapBasedSample()
	predictions := core.NewArrayVector()
	total := 0.0
	for _, tree := range rdt.trees {
		node, _ := PredictBySingleTree(tree, msample)
		predictions.AddVector(node.prediction, 1.0)
		total += 1.0
	}
	predictions.Scale(1.0 / total)
	return predictions
}
开发者ID:jamesbjackson,项目名称:hector,代码行数:12,代码来源:random_decision_tree.go

示例4: PredictMultiClass

func (dt *CART) PredictMultiClass(sample *core.Sample) *core.ArrayVector {
	msample := sample.ToMapBasedSample()
	node, _ := PredictBySingleTree(&dt.tree, msample)
	return node.prediction
}
开发者ID:jamesbjackson,项目名称:hector,代码行数:5,代码来源:cart.go

示例5: Predict

func (dt *CART) Predict(sample *core.Sample) float64 {
	msample := sample.ToMapBasedSample()
	node, _ := PredictBySingleTree(&dt.tree, msample)
	return node.prediction.GetValue(1)
}
开发者ID:jamesbjackson,项目名称:hector,代码行数:5,代码来源:cart.go

示例6: Predict

func (dt *RegressionTree) Predict(sample *core.Sample) float64 {
	msample := sample.ToMapBasedSample()
	node, _ := dt.PredictBySingleTree(&dt.tree, msample)
	return node.prediction.GetValue(0)
}
开发者ID:jamesbjackson,项目名称:hector,代码行数:5,代码来源:regression_tree.go


注:本文中的github.com/xlvector/hector/core.Sample.ToMapBasedSample方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。