Sourcery refactored master branch#1
Conversation
| This program tries to predict the number of thefts from | ||
| the number of fire in the city of Chicago | ||
| """ | ||
|
|
There was a problem hiding this comment.
Lines 41-53 refactored with the following changes:
- Convert for loop into call to sum() (
sum-comprehension)
This removes the following comments ( why? ):
# TO DO: write sess.run()
# Session runs optimizer to minimize loss and fetch the value of loss
| MNIST dataset: yann.lecun.com/exdb/mnist/ | ||
|
|
||
| """ | ||
|
|
There was a problem hiding this comment.
Lines 29-84 refactored with the following changes:
- Replace unused for index with underscore (
for-index-underscore)
| MNIST dataset: yann.lecun.com/exdb/mnist/ | ||
|
|
||
| """ | ||
|
|
There was a problem hiding this comment.
Lines 57-84 refactored with the following changes:
- Replace unused for index with underscore (
for-index-underscore)
| Author: Chip Huyen | ||
| Prepared for O'Reilly "A short course in TensorFlow" | ||
| """ | ||
|
|
There was a problem hiding this comment.
Lines 17-35 refactored with the following changes:
- Replace unused for index with underscore (
for-index-underscore)
This removes the following comments ( why? ):
# do to 100 iterations
| # assume the image has the label Chihuahua, which corresponds to class number 1 | ||
| label = 1 | ||
| image_file = IMAGE_PATH + 'friday.jpg' | ||
| tfrecord_file = IMAGE_PATH + 'friday.tfrecord' | ||
| write_tfrecord(label, image_file, tfrecord_file) | ||
| read_tfrecord(tfrecord_file) | ||
| # assume the image has the label Chihuahua, which corresponds to class number 1 | ||
| label = 1 | ||
| image_file = f'{IMAGE_PATH}friday.jpg' | ||
| tfrecord_file = f'{IMAGE_PATH}friday.tfrecord' | ||
| write_tfrecord(label, image_file, tfrecord_file) | ||
| read_tfrecord(tfrecord_file) |
There was a problem hiding this comment.
Function main refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation)
| writer = tf.summary.FileWriter('improved_graph/lr' + str(LEARNING_RATE), sess.graph) | ||
| writer = tf.summary.FileWriter( | ||
| f'improved_graph/lr{str(LEARNING_RATE)}', sess.graph | ||
| ) |
There was a problem hiding this comment.
Function train_model refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation)
| raise Exception('File ' + file_name + | ||
| ' might be corrupted. You should try downloading it with a browser.') | ||
| raise Exception( | ||
| f'File {file_name} might be corrupted. You should try downloading it with a browser.' | ||
| ) |
There was a problem hiding this comment.
Function download refactored with the following changes:
- Use f-string instead of string concatenation [×2] (
use-fstring-for-concatenation)
| dictionary = dict() | ||
| dictionary = {} |
There was a problem hiding this comment.
Function build_vocab refactored with the following changes:
- Replace
dict()with{}(dict-literal)
Branch
masterrefactored by Sourcery.If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
masterbranch, then run:Help us improve this pull request!