Skip to content

Instantly share code, notes, and snippets.

@amankharwal

amankharwal/instagram.py Secret

Created Jan 26, 2021
Embed
What would you like to do?
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