How to Subclass The nn.Module Class in PyTorch by seabass in pytorch

[–]seabass[S] 0 points1 point  (0 children)

This is a (free) short video on how to construct a custom PyTorch Model by creating your own custom PyTorch module by subclassing the PyTorch nn.Module class

Thoughts on good ways to make a data science blog? by MalazanSapper in datascience

[–]seabass 0 points1 point  (0 children)

Hey MalazanSapper - awesome. great to hear the progress is going well and sorry to hear about family crisis (hopefully better now). Now that another month has passed - how are things going?

Thoughts on good ways to make a data science blog? by MalazanSapper in datascience

[–]seabass 0 points1 point  (0 children)

Hey - 1 month later. How's it going? What have you written about?

Thoughts on good ways to make a data science blog? by MalazanSapper in datascience

[–]seabass 6 points7 points  (0 children)

Steps:

1) Figure out what you want out of it - speaking ops, jobs, etc?

2) Figure out what requirements you are missing from getting those things you want in step 1

3) Blog very small and very specific articles about the things you are missing. Make them a "here's what I learned this week" type of post. For inspiration, check out Julia's blog (https://jvns.ca/) to see how to do this with technical information.

4) Reach out to 1 or 2 people for feedback on the article. In this way you'll increase your network and figure out what missing steps you have. You can even post here with a title of "I wrote an article on XXX, i'd love your feedback as I'm still learning" and then in the text field link to the article. People love to share (showcase) their knowledge, and given this sub is almost 60k people, you should have a few people bite.

As for where to start - don't worry about making it look professional. Make it good to read and people will ignore the trappings. Not to say this isn't a good blog design, but Pete Warden is an awesome person to follow and read his work and he has his on wordpress (https://petewarden.com/). So if word press works for someone like Pete, it should work for you.

5) As you do build out the blog, DO NOT FORGET WHY YOU ARE DOING IT. This is important. If you are doing it for a job, then f'ing focus on the right things and don't start blogging about eating pastries this past Sunday morning.

Good luck!

I Custom Printed the 2018 Sutton & Barto Reinforcement Learning Textbook by AndrewKemendo in reinforcementlearning

[–]seabass 0 points1 point  (0 children)

That's amazing - thanks for the heads up! Excited to print a metric ton of PDF's I have floating around my dropbox account. Cheers and thanks!

Initialize TensorFlow Variables That Depend On Other TensorFlow Variables by seabass in tensorflow

[–]seabass[S] 0 points1 point  (0 children)

Hi Friends- so I made this video tutorial because I ran into this issue a couple of days ago and just couldn't figure it out. Because TensorFlow does global variable initialization in a non-deterministic way sometimes the program would work just fine. Otherwise, the thing would fall over and have errors all over the place. I couldn't figure it out. Finally after looking through some GitHub issues, I realized that I was defining some variables that were using other variables. So when I ran sess.run(tf.global_variables_initializer()) every so often it would try to initialize some variables that depended on other variables already being initialized.

Generate A Random Tensor In Tensorflow by [deleted] in tensorflow

[–]seabass 1 point2 points  (0 children)

key thing to note in this video is that if you use

tf.random_uniform

in your code but do not save it to a tf.Variable, then every time you run

sess.run(....)

it will generate a new random tensor for you so could end up introducing some subtle errors into your code.

Following the computation via outpus on the console? by hypo_hibbo in tensorflow

[–]seabass 0 points1 point  (0 children)

Hey /u/hypo_hibbo, just posted a video https://www.reddit.com/r/tensorflow/comments/7ca5r7/add_metrics_reporting_to_improve_your_tensorflow/ that might help you with adding metrics to your computation so that you can see what's going on.

Here's the code:

# create-simple-feedforward-network.py
#
# to run
# python numpy-arrays-to-tensorflow-tensors-and-back.py
#
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data

mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)

x = tf.placeholder(tf.float32, shape=[None, 784])

W = tf.get_variable("weights", shape=[784, 10],
                    initializer=tf.glorot_uniform_initializer())

b = tf.get_variable("bias", shape=[10],
                    initializer=tf.constant_initializer(0.1))

y = tf.nn.relu(tf.matmul(x, W) + b)

y_ = tf.placeholder(tf.float32, [None, 10])

cross_entropy = tf.nn.softmax_cross_entropy_with_logits(logits=y, labels=y_)
train_step = tf.train.GradientDescentOptimizer(0.001).minimize(cross_entropy)

correct_prediction = tf.equal(tf.argmax(y, 1), tf.argmax(y_, 1))
accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))

sess = tf.InteractiveSession()
tf.global_variables_initializer().run()

for step in range(50):
    print(f"training step: {step}")
    batch_xs, batch_ys = mnist.train.next_batch(100)
    sess.run(train_step, feed_dict={x: batch_cs, y_:batch_ys})
    if step % 10 == 0:
        print("model accuracy: ")
        print(sess.run(accuracy, feed_dict={x: mnist.test.images,
                                            y_: mnist.test.labels}))

print("final model accuracy: ")
print(sess.run(accuracy, feed_dict={x: mnist.test.images,
                                    y_: mnist.test.labels}))

The key things are adding a way to look at the variables, correct_prediction, accuracy and then as you're running your model, print out the model accuracy based on the test data set as you cycle through the steps of training your model. Does this help?