This commit is contained in:
shoney 2023-06-25 23:50:06 +00:00
parent bc53a89c11
commit 6c18c617c3
5 changed files with 95 additions and 1 deletions

View file

@ -35,4 +35,5 @@ vGPU \footnote{https://docs.nvidia.com/grid/5.0/grid-vgpu-user-guide/index.html}
\subsection{SSH}
\section{Cloud computing}
\section{Cloud computing}

35
doc/tuitorialnotes.tex Normal file
View file

@ -0,0 +1,35 @@
notes from tuitorial
auto regresive
feed forward cannot learn from the past
recurrent neuron network can learn from the past
xt -> yt
unrolling through time
Y = activation (Wx +b)
Stored state - memory
internal state html
each neoron has two weight
basic cell, LSTM cell , GRU cell
Gradient decent
back propogation through time
Long Short Term Memory
confusion matrix
logsoftmax
https://stanford.edu/~shervine/teaching/cs-230/cheatsheet-recurrent-neural-networks

View file

@ -0,0 +1,48 @@
import torch
import torch.nn as nn
import torch.nn.functional as F
class RNN(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super(RNN, self).__init__()
self.hidden_size = hidden_size
self.i2h = nn.Linear(input_size + hidden_size, hidden_size)
self.i2o = nn.Linear(input_size + hidden_size, output_size)
self.softmax = nn.LogSoftmax(dim=1)
def forward(self, input, hidden):
combined = torch.cat((input, hidden), 1)
hidden = self.i2h(combined)
output = self.i2o(combined)
output = self.softmax(output)
return output, hidden
def initHidden(self):
return torch.zeros(1, self.hidden_size)
class Net(nn.Module):
def __init__(self,input_size,hidden_size,output_size):
super(Net, self).__init__()
self.fc1 = nn.Linear(input_size, hidden_size)
self.fc2 = nn.Linear(hidden_size, hidden_size)
self.fc3 = nn.Linear(hidden_size, output_size)
def forward(self, x):
x = F.sigmoid(self.fc1(x))
x = F.sigmoid(self.fc2(x))
x = self.fc3(x)
return F.log_softmax(x, dim=-1)

View file

@ -0,0 +1,10 @@
from sklearn.feature_extraction.text import CountVectorizer
class Vectorize():
def __init__(self,ngram_min,ngram_max):
self.n_gram_vectorizer = CountVectorizer(ngram_range=(ngram_min, ngram_max))
def ngramFit(self,doc):
self.n_gram_vectorizer.fit(doc)
def transform (self,doc):
self.n_gram_vectorizer.transform(doc)