1
TensorFlowを使用したロジスティック回帰モデルを構築するには、これはtutorialに従います。私は簡単な質問を持っています:.coef_
のようなモデルの係数をどのようにしてsklearn
に印刷できますか?前処理後のモデルを訓練する前に、コードのテンソルフローのロジスティック回帰モデルの係数
ワンピース:
model_dir = tempfile.mkdtemp()
m = tf.contrib.learn.LinearClassifier(feature_columns=[
gender, native_country, education, occupation, workclass, marital_status, race,
age_buckets, education_x_occupation, age_buckets_x_education_x_occupation],
model_dir=model_dir)
m.fit(input_fn=train_input_fn, steps=200)
results = m.evaluate(input_fn=eval_input_fn, steps=1)
for key in sorted(results):
print("%s: %s" % (key, results[key]))
、ここではls -l
model_dir
上の結果である:取得するget_variable_names()
:
-rw-r--r-- 1 builder staff 305 Jul 17 13:29 checkpoint
drwxr-xr-x 3 builder staff 102 Jul 17 13:29 eval
-rw-r--r-- 1 builder staff 39038807 Jul 17 13:29 events.out.tfevents.1500323287.builder-MBP.ikuni.com
-rw-r--r-- 1 builder staff 32604586 Jul 17 13:28 graph.pbtxt
-rw-r--r-- 1 builder staff 12567520 Jul 17 13:28 model.ckpt-1.data-00000-of-00001
-rw-r--r-- 1 builder staff 3240 Jul 17 13:28 model.ckpt-1.index
-rw-r--r-- 1 builder staff 9830014 Jul 17 13:28 model.ckpt-1.meta
-rw-r--r-- 1 builder staff 12567520 Jul 17 13:29 model.ckpt-200.data-00000-of-00001
-rw-r--r-- 1 builder staff 3240 Jul 17 13:29 model.ckpt-200.index
-rw-r--r-- 1 builder staff 9830014 Jul 17 13:29 model.ckpt-200.meta