本文整理汇总了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;未经允许,请勿转载。 |
请发表评论