y33-j3t / coursera-deep-learning Goto Github PK
View Code? Open in Web Editor NEWMy notes / works on deep learning from Coursera
License: MIT License
My notes / works on deep learning from Coursera
License: MIT License
Can you share me the step - by - step process of the programming assigment of courseera
I am unable complete the assignment
all the validation results are passed but the grading score shows an error
can you help me
Shall I use the siamese network for a sequence-to-sequence generation problem in machine learning?
Eg: Input 1: Sentence 1 (sequence) Input 2: Sentence 2 (sequence) Output: Newly Generated sentence (Generated sequence)
And is the siamese network accepting only fixed/same length sequences as inputs?
Please feel free to share your thoughts.
Hi, everyone!
I am new in NLP and it's the first time I use sklearn vectorizer, following a tutorial with another corpus for sentiment analysis. For some reason the arrays are almost only zeros (a 1 here and there, but very few of them).
The following code is what I used to preprocess the corpus.
def get_part_of_speech(word):
probable_part_of_speech = wordnet.synsets(word)
pos_counts = Counter()
pos_counts["n"] = len( [ item for item in probable_part_of_speech if item.pos()=="n"] )
pos_counts["v"] = len( [ item for item in probable_part_of_speech if item.pos()=="v"] )
pos_counts["a"] = len( [ item for item in probable_part_of_speech if item.pos()=="a"] )
pos_counts["r"] = len( [ item for item in probable_part_of_speech if item.pos()=="r"] )
most_likely_part_of_speech = pos_counts.most_common(1)[0][0]
return most_likely_part_of_speech
def preprocess_text(text):
cleaned = re.sub(r'\W+', ' ', text).lower()
tokenized = word_tokenize(cleaned)
lemmatized = [normalizer.lemmatize(token, get_part_of_speech(token)) for token in tokenized if token not in stopwords.words('english')]
normalized = ' '.join(lemmatized)
return normalized
And here is the code with the vectorizer (the vocab with the full vocabulary is one of the solutions I found in the threads, but still not working).
pos = open('NLTK/short_reviews/positive.txt', 'r', encoding='latin-1').read()
neg = open('NLTK/short_reviews/negative.txt', 'r', encoding='latin-1').read()
pos_clean = [preprocess_text(sen) for sen in pos.split('\n') if sen != '']
neg_clean = [preprocess_text(sen) for sen in neg.split('\n') if sen != '']
x_clean = pos_clean + neg_clean
labels = [1] * len(pos_clean) + [0] * len(neg_clean)
vocab = []
for sentence in x_clean:
for word in sentence.split(' '):
if word not in vocab:
vocab.append(word)
x_train, x_test, y_train, y_test = train_test_split(
x_clean, labels, test_size=0.2, random_state=42
)
vectorizer = CountVectorizer(vocabulary=vocab)
x_vec = vectorizer.fit_transform(x_train).toarray()
# xt_vec = vectorizer.transform(x_test).toarray()
with numpy.printoptions(threshold=numpy.inf):
print(x_vec[0])
Thanks a lot in advance, and please do not hesitate if there is some lack of information!
I hope I can understand what is going on...
Exercise 07:
Replace line
pred[m - 1] = states[k]
with
pred[m - 1] = states[z[m - 1]]
and line
for i in range(len(corpus) - 1, -1, -1):
with
for i in range(len(corpus) - 1, 0, -1):
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.