I'm new to deep learning, and especially to reinforcement learning. I would like to know if it's possible to predict which combination of hashtags (from a subset of chosen hashtags) would produce the most likes for a certain image.

Is it possible to have a convolutional neural network with each hashtag as a label, and take something like reward = likes / followers as a reward in a reinforcement learning like scenario?

In what other way could I face this problem? My goal isn't to predict the amount of likes, but to maximize the probability to get the most likes.

I chose this title because I think the answer could actually be question agnostic: I could use the same knowledge to define which combination of stocks would maximize my investment.

Thanks in advance.

  • 1
    $\begingroup$ Please if you think the question is missing information or not well asked, tell me how, so I can improve it. $\endgroup$ Commented Mar 8, 2019 at 1:46

1 Answer 1


This honestly sounds more like a supervised learning problem. For reinforcement learning to work, you would need a model that can constantly return values for a given input.

With social media, that would mean

  • a) posting the same image with all kinds of different hashtags and expecting people to give the most appropiate hashtags likes in a short amount of time. This will not happen.

  • b) searching for all occurrences of an image with different hashtags. This is basically supervised learning.

I recommend finding a social media dataset first. Try to group all occurrences of an image and find the median of likes for each hashtag. Don't forget to compensate for follower count, as more popular posters will get more likes on average regardless of hashtag. Store the best hashtag as label for the given image.

You now have Y different hashtags for X different images.

From now, you can treat it as classification problem. X is your sample count, Y is the amount of possible outputs. If you don't want to write your own loss function and only want to predict the single best hashtag, use cross entropy as loss function.

Of course you still have to choose your social media dataset, appropriate images for training and NN structure, but I hope this helps as a general approach.

  • $\begingroup$ Thank you for your answer @1b15 I think I'm more inclined towards creating my own loss function. Otherwise, if I just take the mean likes per hashtag, I'll be assuming that only hashtags are associated with likes, despite of which image I'll be posting. Additionally, if the input was an image, the outputs were the hashtags, and the loss function is some relation of likes and followers, I wouldn't have to look for same occurrences of an image. Am I on the right path? Thank you $\endgroup$ Commented Mar 8, 2019 at 13:11
  • $\begingroup$ As far as I understand, you are trying to let the NN output a combination of hashtags for an image and then use your custom loss function on that. However, there will not always be a social media post with that combination of hashtags. I think your best shot at predicting multiple hashtags is assigning a score to each available hashtag for an image (0 for hashtags that aren't being used for that image but occur at other images) before training and then using a custom loss function on that. $\endgroup$
    – tYAt1YBWFY
    Commented Mar 8, 2019 at 14:04
  • $\begingroup$ "Otherwise, if I just take the mean likes per hashtag, I'll be assuming that only hashtags are associated with likes, despite of which image I'll be posting" To prevent this, you calculate your 'hashtag scores' for each image seperately. A challenge of this project will be to group same images despite differences in resolution, compression etc. Unfortunately, I don't see a way around this. $\endgroup$
    – tYAt1YBWFY
    Commented Mar 8, 2019 at 14:24
  • $\begingroup$ what about the following loss: score = likes / followers mse = mean squared error loss = -score / mse This would minimize to the highest score. I could also have this: loss = mse / score, however, the network could overfit to try to perfectly predict the hashtags and overlook the likes. If I put the score above, even if the network perfectly predicts the hashtags, the score would still have an impact. $\endgroup$ Commented Mar 8, 2019 at 15:10
  • $\begingroup$ Don't forget that your NN will predict multiple hashtags. I would model this as a probability distribution for all possible hashtags. You then take hashtags over a specific limit (probability > 0.2 or something like that). You then compare sum(predicted_hashtag_scores) with sum(best_hashtag_scores). Both of your loss functions will not work if the NN chooses hashtags without any occurrences and a score of 0. First function will return a 0 loss and second function will divide by 0 $\endgroup$
    – tYAt1YBWFY
    Commented Mar 8, 2019 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.