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
Add custom class weighting Add configurable losses and binary crossentropy loss Remove batch size from model compile method Move metrics to >= for positive Add binary metrics Fix training=True for evaluation bug
Copy file name to clipboardExpand all lines: examples/class_weights/main.go
+3-4Lines changed: 3 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ import (
10
10
"github.com/codingbeard/tfkg/layer"
11
11
"github.com/codingbeard/tfkg/metric"
12
12
"github.com/codingbeard/tfkg/model"
13
+
"github.com/codingbeard/tfkg/optimizer"
13
14
"github.com/codingbeard/tfkg/preprocessor"
14
15
tf "github.com/galeone/tensorflow/tensorflow/go"
15
16
"math/rand"
@@ -107,9 +108,7 @@ func main() {
107
108
108
109
// This part is pretty nasty under the hood. Effectively it will generate some python code for our model and execute it to save the model in a format we can load and train
109
110
// A python binary must be available to use for this to work
110
-
// The batchSize MUST match the batchSize in the call to Fit or Evaluate
Copy file name to clipboardExpand all lines: examples/iris/main.go
+3-4Lines changed: 3 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ import (
10
10
"github.com/codingbeard/tfkg/layer"
11
11
"github.com/codingbeard/tfkg/metric"
12
12
"github.com/codingbeard/tfkg/model"
13
+
"github.com/codingbeard/tfkg/optimizer"
13
14
"github.com/codingbeard/tfkg/preprocessor"
14
15
tf "github.com/galeone/tensorflow/tensorflow/go"
15
16
"os"
@@ -109,9 +110,7 @@ func main() {
109
110
110
111
// This part is pretty nasty under the hood. Effectively it will generate some python code for our model and execute it to save the model in a format we can load and train
111
112
// A python binary must be available to use for this to work
112
-
// The batchSize MUST match the batchSize in the call to Fit or Evaluate
Copy file name to clipboardExpand all lines: examples/jobs/main.go
+5-7Lines changed: 5 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ import (
10
10
"github.com/codingbeard/tfkg/layer"
11
11
"github.com/codingbeard/tfkg/metric"
12
12
"github.com/codingbeard/tfkg/model"
13
+
"github.com/codingbeard/tfkg/optimizer"
13
14
"github.com/codingbeard/tfkg/preprocessor"
14
15
tf "github.com/galeone/tensorflow/tensorflow/go"
15
16
"os"
@@ -271,12 +272,11 @@ func main() {
271
272
layer.DenseWithActivation("swish"),
272
273
)(mergedDense1)
273
274
274
-
// Get the number of classes from the dataset if we don't want to count them manually, but in this case it is only 2
275
275
output:=layer.NewDense(
276
-
float64(dataset.NumCategoricalClasses()),
276
+
1,
277
277
layer.DenseWithDtype(layer.Float32),
278
278
layer.DenseWithName("output"),
279
-
layer.DenseWithActivation("softmax"),
279
+
layer.DenseWithActivation("sigmoid"),
280
280
)(mergedDense2)
281
281
282
282
// Define a keras style Functional model
@@ -289,9 +289,7 @@ func main() {
289
289
290
290
// This part is pretty nasty under the hood. Effectively it will generate some python code for our model and execute it to save the model in a format we can load and train
291
291
// A python binary must be available to use for this to work
292
-
// The batchSize MUST match the batch size in the call to Fit or Evaluate
Copy file name to clipboardExpand all lines: examples/multiple_inputs/main.go
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ import (
10
10
"github.com/codingbeard/tfkg/layer"
11
11
"github.com/codingbeard/tfkg/metric"
12
12
"github.com/codingbeard/tfkg/model"
13
+
"github.com/codingbeard/tfkg/optimizer"
13
14
"github.com/codingbeard/tfkg/preprocessor"
14
15
tf "github.com/galeone/tensorflow/tensorflow/go"
15
16
"os"
@@ -111,7 +112,7 @@ func main() {
111
112
// This part is pretty nasty under the hood. Effectively it will generate some python code for our model and execute it to save the model in a format we can load and train
112
113
// A python binary must be available to use for this to work
113
114
// The batchSize MUST match the batch size in the call to Fit or Evaluate
0 commit comments