Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue of using DBN #51

Open
skx300 opened this issue May 20, 2017 · 0 comments
Open

Issue of using DBN #51

skx300 opened this issue May 20, 2017 · 0 comments

Comments

@skx300
Copy link

skx300 commented May 20, 2017

I am trying to use your module in the scripts instead of the command line. Here I want to use the DBN.

When I run

import tensorflow as tf
from yadlt.models.boltzmann import dbn

from tensorflow.examples.tutorials.mnist import input_data

# load the data
mnist = input_data.read_data_sets("tensorflow_learning/MNIST_data/", one_hot = True)
x_train = mnist.train.images
y_train = mnist.train.labels
x_val = mnist.validation.images
y_val = mnist.validation.labels

# create a DBN
my_DBN = dbn.DeepBeliefNetwork(rbm_layers = [50, 30, 20],
                               finetune_loss_func = 'softmax_cross_entropy',
                               finetune_dropout = 1,
                               finetune_learning_rate = 0.001,
                               finetune_act_func = tf.nn.sigmoid,
                               finetune_num_epochs = 20,
                               finetune_batch_size = 20,
                               do_pretrain = True)

my_DBN.pretrain(x_train, x_val)

my_DBN.build_model(784, 10)

my_DBN._train_model(x_train, y_train, x_val, y_val)

The last line my_DBN._train_model(x_train, y_train, x_val, y_val) gives the following error:

File "D:\Program Files\Anaconda3\lib\site-packages\yadlt\models\boltzmann\dbn.py", line 147, in _train_model

AttributeError: 'NoneType' object has no attribute 'run'

When I go back to the line 147 of dbn.py, that is
self.tf_session.run

By the way, I am not quite sure the scheme I used above is correct or not. Could you write a kind of script usage in the documentation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant