ats's People
Forkers
stevenlol mzhang001 yagwar bfsujason jilu1111 namrata96 daishu7 unipus-ai sailendramishra megatazmats's Issues
What is correct_sequences taking?
I have looked at the data type of correct_sequences
and I don't understand what are we feeding really into this train function. Please explain what correct_sequences
is.
def train(self, correct_sequences, y_score):
for i in range(correct_sequences.shape[0]):
#print(self.embeddings[correct_sequences[i]])
self.correct_matrix[i] = self.embeddings[
correct_sequences[i]].flatten()
corrupt_matrix = np.copy(self.correct_matrix)
noise_sequences = np.copy(correct_sequences)
avg_loss = []
for i in range(self.negative_examples):
negs = np.random.choice(self.vocab_size, self.batch_size,
replace=True)
corrupt_matrix[:, self.ts:self.te] = self.embeddings[negs]
noise_sequences[:, self.half_window] = negs
(dcorrect_inputss,
dnoise_inputss,
total_loss,
losses,
correct_scores,
noise_scores) = self.train_function(
self.correct_matrix,
corrupt_matrix,
y_score,
self.learning_rate)
avg_loss.append(total_loss)
self.train_loss += total_loss
self.train_err += (correct_scores <= noise_scores).sum()
self.train_lossnonzero += (losses > 0).sum()
self.reset()
for index in range(len(correct_sequences)):
correct_sequence = correct_sequences[index].flatten()
noise_sequence = noise_sequences[index].flatten()
dcorrect_inputs = dcorrect_inputss[index].reshape((
self.window_size, self.embedding_size))
dnoise_inputs = dnoise_inputss[index].reshape((
self.window_size, self.embedding_size))
for (i, di) in zip(correct_sequence, dcorrect_inputs):
self.embeddings[i] -= self.embedding_learning_rate * di
for (i, di) in zip(noise_sequence, dnoise_inputs):
self.embeddings[i] -= self.embedding_learning_rate * di
self.train_cnt += len(correct_sequences)
return sum(avg_loss) / float(len(avg_loss))
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.