2

I use a TensorFlow canned estimator (LinearClassifier) to predict game actions from situations favourizing best scores. Scores are included in train_data and used as weight and passed as weight column in the estimator.

I know weight values are multiplicated with loss (MSE in this case) but I want to know if loss minimization is done or if I have to define optimizer as:

optimizer=tf.train.AdamOptimizer(learning_rate=0.001, beta1= 0.9,beta2=0.99, epsilon = 1e-08,use_locking=False).minimize(loss),
model = tf.estimator.LinearClassifier(feature_columns=feature_columns,
                                    optimizer=tf.train.AdamOptimizer(learning_rate=0.001, beta1= 0.9,beta2=0.99, epsilon = 1e-08,use_locking=False),
                                    weight_column=weights,
#                                    dropout=0.1,
#                                    activation_fn=tf.nn.softmax,
                                    n_classes=10,
                                    label_vocabulary=Action_vocab,
                                    model_dir='./Models/ActionPlayerModel20/',
                                    loss_reduction=tf.losses.Reduction.SUM_OVER_BATCH_SIZE,
                                    config=tf.estimator.RunConfig().replace(save_summary_steps=10))
double-beep
  • 5,031
  • 17
  • 33
  • 41
GerardL
  • 81
  • 7
  • @Stewart_R : "Not at all sure what you mean by". Described here [link](https://stackoverflow.com/questions/48098951/upweight-a-category). What about minimize operation ? Is loss reduction operation implemented in canned estimators ? – GerardL Aug 08 '19 at 16:54
  • Yes, that's correct: The canned estimator just takes the optimiser object and handles the minimise operation internally. – Stewart_R Aug 10 '19 at 07:34
  • Updated answer to clarify this - I'd intended to convey that first time round but on rereading I could have been clearer. :-) – Stewart_R Aug 10 '19 at 07:36

1 Answers1

0

Not at all sure what you mean by:

I know weight values are multiplicated with loss

but the classifier line is correct as you have it. You should pass the Optimizer object into the classifier and not the .minimize() operation. The estimator will generate & handle the minimize operation internally.

Stewart_R
  • 13,764
  • 11
  • 60
  • 106