Last active
November 14, 2017 06:22
-
-
Save Joshuaek/7c0e1188601ebb63b8f3f554eaae2856 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inputs = [] | |
outputs = [] | |
for tweet in tweets: | |
sentence = prepareSentence(tweet["text"]) | |
# create our bag of words array | |
bag = toBOW(sentence, final_words) | |
inputs.append(bag) | |
#Calculate a score, 1 if any engagement, 0 if none | |
score = min(tweet["likes"] + tweet["retweets"],1) | |
outputs.append(score) | |
#Define and train the network | |
nnet = MLPRegressor(activation='relu', alpha=0.0001, hidden_layer_sizes=(int(len(final_words)*0.5),int(len(final_words)*0.25)),solver='adam', max_iter=400) | |
nnet.fit(inputs, outputs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment