Tensorflow 1.0をかじる
プリセットを利用する
tf.estimator
抽象度の高いAPI。 高位の機械学習APIともいう。 データの入力には下記のfeature-columnsを用いる。
このクラスは以下を内包している。
- BaselineClassifier: A classifier that can establish a simple baseline.
- BaselineRegressor: A regressor that can establish a simple baseline.
- BestExporter: This class exports the serving graph and checkpoints of the best models.
- BoostedTreesClassifier: A Classifier for Tensorflow Boosted Trees models.
- BoostedTreesRegressor: A Regressor for Tensorflow Boosted Trees models.
- DNNClassifier: A classifier for TensorFlow DNN models.
- DNNLinearCombinedClassifier: An estimator for TensorFlow Linear and DNN joined classification models
- DNNLinearCombinedRegressor: An estimator for TensorFlow Linear and DNN joined models for regression.
- DNNRegressor: A regressor for TensorFlow DNN models.
- Estimator: Estimator class to train and evaluate TensorFlow models.
- EstimatorSpec: Ops and objects returned from a model_fn and passed to an Estimator.
- EvalSpec: Configuration for the “eval” part for the train_and_evaluate call.
- Exporter: A class representing a type of model export.
- FinalExporter: This class exports the serving graph and checkpoints in the end.
- LatestExporter: This class regularly exports the serving graph and checkpoints.
- LinearClassifier: Linear classifier model.
- LinearRegressor: An estimator for TensorFlow Linear regression problems.
- ModeKeys: Standard names for model modes.
- RunConfig: This class specifies the configurations for an Estimator run.
- TrainSpec: Configuration for the “train” part for the train_and_evaluate call.
- VocabInfo: Vocabulary information for warm-starting.
- WarmStartSettings: Settings for warm-starting in Estimators.
tf.feature-columns
estimatorへ入力する特徴列(データ)の定義。特徴列の型、サイズ、構造を定義し、生成する。
オリジナルモデルを構築する
tf.Variable
重みやバイアスといった学習対象の変数を格納する。
- Weight (W)
- Bias (B)
tf.placeholder
学習に必要なデータを供給する。テストデータの入力の際はnumpy行列をそのまま渡す。
- train_x
- train_Y
参考:
・https://towardsdatascience.com/deploy-tensorflow-models-9813b5a705d5
・https://www.kaggle.com/liampetti/deep-neural-network-using-tensorflow
・https://www.kaggle.com/fuzzyfroghunter/getting-started-with-tensorflow
・https://stackoverflow.com/questions/41116782/tensorflow-how-to-get-prediction
・https://stackoverflow.com/questions/36693740/whats-the-difference-between-tf-placeholder-and-tf-variable