Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/chiphuyen/tf-oreilly
/ functions
Functions
36 in github.com/chiphuyen/tf-oreilly
⨍
Functions
36
◇
Types & classes
1
↓ 3 callers
Function
process_data
(vocab_size, batch_size, skip_window)
process_data.py:86
↓ 2 callers
Function
_bytes_feature
(value)
02_tfrecord_example.py:18
↓ 2 callers
Function
build_vocab
Build vocabulary of VOCAB_SIZE most frequent words
process_data.py:46
↓ 2 callers
Function
download
Download the dataset text8 if it's not already downloaded
process_data.py:22
↓ 2 callers
Function
read_data
Read data into a list of tokens There should be 17,005,207 tokens
process_data.py:37
↓ 1 callers
Method
_create_embedding
Step 2: define weights. In word2vec, it's actually the weights that we care about
02_word2vec_visualize.py:45
↓ 1 callers
Method
_create_loss
Step 3 + 4: define the model + the loss function
02_word2vec_visualize.py:54
↓ 1 callers
Method
_create_optimizer
Step 5: define optimizer
02_word2vec_visualize.py:75
↓ 1 callers
Method
_create_placeholders
Step 1: define the placeholders for input and output
02_word2vec_visualize.py:39
↓ 1 callers
Method
_create_summaries
(self)
02_word2vec_visualize.py:81
↓ 1 callers
Function
_int64_feature
(value)
02_tfrecord_example.py:15
↓ 1 callers
Function
batch_generator
filenames is the list of files you want to read from. In this case, it contains only heart.csv
02_csv_reader.py:18
↓ 1 callers
Method
build_graph
Build the graph for our model
02_word2vec_visualize.py:89
↓ 1 callers
Function
convert_words_to_index
Replace each word in the dataset with its index in the dictionary
process_data.py:62
↓ 1 callers
Function
generate_batches
(data_batch, label_batch)
02_csv_reader.py:63
↓ 1 callers
Function
generate_sample
Form training pairs according to the skip-gram model.
process_data.py:66
↓ 1 callers
Function
get_batch
Group a numerical stream into batches and yield them as Numpy arrays.
process_data.py:77
↓ 1 callers
Function
get_image_binary
You can read in the image using tensorflow too, but it's a drag since you have to create graphs. It's much easier using Pillow and NumPy
02_tfrecord_example.py:21
↓ 1 callers
Function
main
()
02_word2vec_no_frills.py:71
↓ 1 callers
Function
main
()
02_tfrecord_example.py:83
↓ 1 callers
Function
main
()
02_word2vec_visualize.py:148
↓ 1 callers
Function
main
()
02_csv_reader.py:73
↓ 1 callers
Function
main
()
02_word2vec_starter.py:99
↓ 1 callers
Function
read_from_tfrecord
(filenames)
02_tfrecord_example.py:48
↓ 1 callers
Function
read_tfrecord
(tfrecord_file)
02_tfrecord_example.py:69
↓ 1 callers
Function
train_model
(model, batch_gen, num_train_steps, weights_fld)
02_word2vec_visualize.py:97
↓ 1 callers
Function
word2vec
Build the graph for word2vec model and train it
02_word2vec_no_frills.py:25
↓ 1 callers
Function
word2vec
Build the graph for word2vec model and train it
02_word2vec_starter.py:23
↓ 1 callers
Function
write_tfrecord
(label, image_file, tfrecord_file)
02_tfrecord_example.py:44
↓ 1 callers
Function
write_to_tfrecord
This example is to write a sample to TFRecord file. If you want to write more samples, just use a loop.
02_tfrecord_example.py:30
Method
__init__
(self, vocab_size, embed_size, batch_size, num_sampled, learning_rate)
02_word2vec_visualize.py:31
Function
f1
()
utils.py:7
Function
f2
()
utils.py:8
Function
get_index_vocab
(vocab_size)
process_data.py:95
Function
huber_loss
(labels, predictions, delta=1.0)
utils.py:5
Function
make_dir
Create a directory if there isn't one already.
utils.py:11