MCPcopy Create free account
hub / github.com/sql-machine-learning/sqlflow / CategorizeAttributes

Function CategorizeAttributes

go/codegen/tensorflow/codegen.go:210–227  ·  view source on GitHub ↗

CategorizeAttributes returns attributes like train.*, validation.* and model.* to separated maps.

(trainStmt *ir.TrainStmt)

Source from the content-addressed store, hash-verified

208
209// CategorizeAttributes returns attributes like train.*, validation.* and model.* to separated maps.
210func CategorizeAttributes(trainStmt *ir.TrainStmt) (trainParams, validateParams, modelParams map[string]interface{}) {
211 trainParams = make(map[string]interface{})
212 validateParams = make(map[string]interface{})
213 modelParams = make(map[string]interface{})
214
215 for attrKey, attr := range trainStmt.Attributes {
216 if strings.HasPrefix(attrKey, "train.") {
217 trainParams[strings.Replace(attrKey, "train.", "", 1)] = attr
218 }
219 if strings.HasPrefix(attrKey, "model.") {
220 modelParams[strings.Replace(attrKey, "model.", "", 1)] = attr
221 }
222 if strings.HasPrefix(attrKey, "validation.") {
223 validateParams[strings.Replace(attrKey, "validation.", "", 1)] = attr
224 }
225 }
226 return trainParams, validateParams, modelParams
227}
228
229// DeriveFeatureColumnCodeAndFieldDescs generates tensorflow feature column code and field descs from IR.
230func DeriveFeatureColumnCodeAndFieldDescs(trainStmt *ir.TrainStmt) (featureColumnsCode []string, fieldDescs map[string][]*ir.FieldDesc, err error) {

Callers 2

TrainFunction · 0.92
TrainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected