當前位置: 首頁>>代碼示例>>Golang>>正文


Golang util.StringBuilder類代碼示例

本文整理匯總了Golang中github.com/xlvector/hector/util.StringBuilder的典型用法代碼示例。如果您正苦於以下問題:Golang StringBuilder類的具體用法?Golang StringBuilder怎麽用?Golang StringBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了StringBuilder類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: ToString

func (v *ArrayVector) ToString() []byte {
	sb := util.StringBuilder{}
	for _, value := range v.data {
		sb.Float(value)
		sb.Write("|")
	}
	return sb.Bytes()
}
開發者ID:xzturn,項目名稱:hector,代碼行數:8,代碼來源:array_vector.go

示例2: ToString

func (t *Tree) ToString() []byte {
	sb := util.StringBuilder{}
	sb.Int(len(t.nodes))
	sb.Write("\n")
	for i, node := range t.nodes {
		sb.Int(i)
		sb.Write("\t")
		sb.Int(node.left)
		sb.Write("\t")
		sb.Int(node.right)
		sb.Write("\t")
		sb.Int(node.depth)
		sb.Write("\t")
		sb.WriteBytes(node.prediction.ToString())
		sb.Write("\t")
		sb.Int(node.sample_count)
		sb.Write("\t")
		sb.Int64(node.feature_split.Id)
		sb.Write("\t")
		sb.Float(node.feature_split.Value)
		sb.Write("\n")
	}
	return sb.Bytes()
}
開發者ID:jamesbjackson,項目名稱:hector,代碼行數:24,代碼來源:random_decision_tree.go

示例3: SaveModel

func (algo *LinearRegression) SaveModel(path string) {
	sb := util.StringBuilder{}
	for f, g := range algo.Model {
		sb.Int64(f)
		sb.Write("\t")
		sb.Float(g)
		sb.Write("\n")
	}
	sb.WriteToFile(path)
}
開發者ID:jamesbjackson,項目名稱:hector,代碼行數:10,代碼來源:linear_regression.go

示例4: SaveModel

func (self *LinearSVM) SaveModel(path string) {
	sb := util.StringBuilder{}
	for f, g := range self.w.Data {
		sb.Int64(f)
		sb.Write("\t")
		sb.Float(g)
		sb.Write("\n")
	}
	sb.WriteToFile(path)
}
開發者ID:jamesbjackson,項目名稱:hector,代碼行數:10,代碼來源:linear_svm.go

示例5: SaveModel

func (lr *LROWLQN) SaveModel(path string) {
	sb := util.StringBuilder{}
	for key, val := range lr.Model.Data {
		sb.Int64(key)
		sb.Write("\t")
		sb.Float(val)
		sb.Write("\n")
	}
	sb.WriteToFile(path)
}
開發者ID:jamesbjackson,項目名稱:hector,代碼行數:10,代碼來源:lr_owlqn.go

示例6: SaveModel

func (algo *EPLogisticRegression) SaveModel(path string) {
	sb := util.StringBuilder{}
	for f, g := range algo.Model {
		sb.Int64(f)
		sb.Write("\t")
		sb.Float(g.Mean)
		sb.Write("\t")
		sb.Float(g.Vari)
		sb.Write("\n")
	}
	sb.WriteToFile(path)
}
開發者ID:xzturn,項目名稱:hector,代碼行數:12,代碼來源:ep_logistic_regression.go

示例7: ToString

func (v *Vector) ToString() []byte {
	sb := util.StringBuilder{}
	for key, value := range v.Data {
		sb.Int64(key)
		sb.Write(":")
		sb.Float(value)
		sb.Write("|")
	}
	return sb.Bytes()
}
開發者ID:jamesbjackson,項目名稱:hector,代碼行數:10,代碼來源:vector.go

示例8: ToString

func (s *Sample) ToString(includePrediction bool) []byte {
	sb := util.StringBuilder{}
	sb.Int(s.Label)
	sb.Write(" ")
	if includePrediction {
		sb.Float(s.Prediction)
		sb.Write(" ")
	}
	for _, feature := range s.Features {
		sb.Int64(feature.Id)
		sb.Write(":")
		sb.Float(feature.Value)
		sb.Write(" ")
	}
	return sb.Bytes()
}
開發者ID:xzturn,項目名稱:hector,代碼行數:16,代碼來源:sample.go


注:本文中的github.com/xlvector/hector/util.StringBuilder類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。