You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Switched all models that did print some
sort of logging to using any io.Writer.
This gives the user control over whether
to log to stdout (which is default), log
to some file or API or something, or not
log at all. Every model that did print
has a public struct field such as below
(only the comment might differ slightly. The
name is always `Output io.Writer`
```go
// Output is the io.Writer used for logging
// and printing. Defaults to os.Stdout.
Output io.Writer
```
err:=fmt.Errorf("ERROR: Attempting to learn with no training examples!\n")
232
-
fmt.Printf(err.Error())
239
+
fmt.Fprintf(l.Output, err.Error())
233
240
returnerr
234
241
}
235
242
236
243
examples:=len(l.trainingSet)
237
244
ifexamples==0||len(l.trainingSet[0]) ==0 {
238
245
err:=fmt.Errorf("ERROR: Attempting to learn with no training examples!\n")
239
-
fmt.Printf(err.Error())
246
+
fmt.Fprintf(l.Output, err.Error())
240
247
returnerr
241
248
}
242
249
iflen(l.expectedResults) ==0 {
243
250
err:=fmt.Errorf("ERROR: Attempting to learn with no expected results! This isn't an unsupervised model!! You'll need to include data before you learn :)\n")
0 commit comments