當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。