Skip to content

Instantly share code, notes, and snippets.

@hereismari
Last active December 26, 2017 15:41
Show Gist options
  • Save hereismari/b4acb22e11892d38820a8282c69bc70d to your computer and use it in GitHub Desktop.
Save hereismari/b4acb22e11892d38820a8282c69bc70d to your computer and use it in GitHub Desktop.
import tensorflow as tf
# Cria-se uma model function para implementar nosso modelo
def model_fn():
pass
# Cria-se uma input function que deve ser passada para o Estimator na maior parte
# de suas operacoes
# input function de treino
def train_input_fn():
return dados
# input function de avaliacao
def eval_input_fn():
return dados
# input function para predicao
def predict_input_fn():
return dados
# cria-se um Estimator a partir da model function
estimator = tf.Estimator(model_fn=model_fn())
# Podemos entao chamar os metodos disponiveis no estimator!
# treinar modelo
estimator.train(input_fn=train_input_fn())
# avaliar modelo
estimator.eval(input_fn=eval_input_fn())
# predizer novos valores
estimator.predict(input_fn=predict_input_fn())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment