-
-
Save amankharwal/eec01dbe9fad1aa5dfd727da414957a1 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
def PredictionsWithConstantFollowers(model, followerCount, scaller, maxVal): | |
followers = followerCount * np.ones(24) | |
hours = np.arange(1, 25) | |
# defining vector | |
featureVector = np.zeros((24, 2)) | |
featureVector[:, 0] = followers | |
featureVector [:, 1] = hours | |
# doing scalling | |
featureVector = scaller.transform(featureVector) | |
predictions = model.predict(featureVector) | |
predictions = (maxValLikes * predictions).astype('int') | |
plt.figure(figsize= (10, 10)) | |
plt.plot(hours, predictions) | |
plt.style.use('seaborn-whitegrid') | |
plt.scatter(hours, predictions, color = 'g') | |
plt.grid(True) | |
plt.xlabel('hours since posted') | |
plt.ylabel('Likes') | |
plt.title('Likes progression with ' + str(followerCount) +' followers') | |
plt.show() | |
PredictionsWithConstantFollowers(gbr, 100, stdSc, maxValLikes) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment