1
有沒有一種方法從Tensorflow的tf.contrib.learn.DNNClassifier中提取權重矩陣?我試着查找Tensorflow網站的答案,但我相當新,所以我沒有發現任何有用的東西。如果在這裏我已經找不到明確的解釋,請提前抱歉。使用張量流的提取神經網絡權重tf.contrib.learn.DNNClassifier
我的代碼:
# read the csv file to numpy array
df = tf.contrib.learn.datasets.base.load_csv_with_header(
filename="data.csv",
target_dtype=np.int,
features_dtype=np.float64)
X = df.data
Y = df.target
dimension = len(X)
feature_columns = [tf.contrib.layers.real_valued_column("", dimension=dimension)]
classifier = tf.contrib.learn.DNNClassifier(feature_columns=feature_columns,
hidden_units=[10,10],
n_classes=2,
activation_fn=tf.nn.sigmoid,
optimizer=tf.train.ProximalAdagradOptimizer(
learning_rate=0.1,
l2_regularization_strength=0.001))
#Fit model
classifier.fit(x=X, y=Y, steps=2000)