text: user9830: I am new in this field and I am having some problems regarding a new project.
  I built a graph using Drugbank Data connected to SIDER Adverse Reactions.
  I used Organ- level Terms to classify the ADRs in 25 different groups.
  I aim to use the algorithm Metapath2vec in order to cluster drugs based on the group of ADRs they lead to.
  I am currently using the python package for Machine Learning on graphs Stellargraph and the related implementation of Metapath2vec.
  I chose Clustering as downstream task with the resulting node embeddings, e.g. DBSCAN but the results are not promising.
  I would like to have some clusters of drugs related to different adverse drug reaction.
  Since I am new in this field everything I am trying is based on scientific literature but I don't know if this is the right approach for my objective.
  This is the code related to the metapath2vec algorithm:
  walk_length = 100  # maximum length of a random walk to use throughout this notebook
  
  # specify the metapath schemas as a list of lists of node types.
  metapaths = [
      ["drug", "adr", "drug"],
      ["drug", "adr", "drug", "drug"],
      ["drug", "drug"],
      ["drug", "adr", "group_adr", "adr", "drug"],
      ]
  
  # Create the random walker
  rw = UniformRandomMetaPathWalk(graph)
  
  walks = rw.run(
      nodes=list(graph.nodes()),  # root nodes
      length=walk_length,  # maximum length of a random walk
      n=1,  # number of random walks per root node
      metapaths=metapaths,  # the metapaths
  )
  
  
  from gensim.models import Word2Vec
  
  model = Word2Vec(walks, size=128, window=5, min_count=0, sg=1, workers=2, iter=1)
  
  
  Should I change approach?
  what other algorithm for representation learning can I use in order to reach my goal?
  what can I improve in the presented approach to have better node embeddings?
  
  user3848: Clearly the additional references do put Metapath2vec into good use. Its a many to many ML relationship. Most catagorization/classification particularly in deep learning is many  to one. So thats the good thing about the technique you  are using, you've 25 catagories, which is quite large for machine learning(ML) and large for deep learning. The technique appears to be half way between supervised and unsupervised learning. The random walk establishes a zone (circle) of catagorisation.
  NLP Background
  The situation where it would work in NLP (natural language processing) is for example a spell checker, where you have one correct word and loads of possible typos, some of which you not observed in training. So what will happen is the random walk will pick up the local vacinity around the 'correct spelling' by the vectorization (converting a word into numbers) of the incorrect spelling will land it close to 'true spelling' in a 2D vectorization plot. The training following the random walk says  'yep you belong with me'.
  The papers given talk about being able to identify the context of a word within a sentence which is a very NLP thing, one vectorisation being 'bags of words'. So here the sentence represents one of many categories of information, i.e. each is the central node within the graph, the vectorisation of the sentence places of meaning closer to one 'hub' than another and again the local vacinity is identified by the random walk. In training this 'random walk vacinity' is identified, so it will algorithmically recreate the 'random walk locality' so that sentences that have not been trained can have their meaning identified.
  The central theory of deep learning, which not quite true of other ML, is any algorithm can be recreated through training. So like it will sort of recreate a 'random walk zone'
  Difference with drug discovery
  The papers you have map drugs to genes, but it means you have to have a "true drug to gene" relationship. The problem I see here is what is 'true' for a drug-protein interaction? With a spell-checker there is one 'true spelling', with a sentence there is pretty much one 'type of meaning', like a movie was great, average, terrible based on a ratings score and stuff like gender classification. If its not 'true' the random walk will get it wrong. So its a big assumption. If you have a circle and pick a point on the edge of the circle then try and draw a circle around the original circle, you can't unless the circle is so large it risks including stuff that is not part of the original circle. The problem the papers is how do they know what is the 'centre' of the circle? Its an a priori assumption and you need really good biological rationale.
  With your stuff I agree its easier because adverse drug reaction, some drugs could be fatal or toxic (traditional cancer drugs or parasite drugs), so you'd pick the worst case adverse reaction. That then centres the definition around which everything else is relative. If however your 'true catagory' turned out to be an outlier its not going to work, because the random walk only works if its starts bang in the centre of the 'catagory'. Random walks form spheres, in case you are not aware. I can see this working as an advanced 'unsupervised learning' technique.
  One very real advantage is if a drug doesn't have an adverse reaction it MIGHT (I'm guessing) not give a result, in which case you are good to go - that a good drug. If that is what happened that would be amazing because its not how ML, or particularly DL works. Traditional ML/DL will force a classification even if it doesn't fit. There are methods to accept some sort of "half-classification" but I don't know how to do it. This is one of the reaons you need lots of things to train.
  I am assuming that vectorisation of your drug is fine because there is a huge history of this in drug-discovery going right back to the origins of the field.
  Summary
  So yeah I get the idea, I see the flaws and the advantages. The final issue is that most ML requires pretty large data sets and DL require huge data sets and when you've got 25 catagories. For DL approaches the data set size might need to be huge unless you can do 'transfer learning' (backing your training onto a pre-trained model). If your method resulted in a zero classification i.e. "doesn't fit anything I've got" - that would be cool and that is the key advantage I can see in the 'random walk' approach which is not available using traditional methods.
  As long as you are aware, you do not have to use this algorithm to get a classification. This final point what appears missing in the papers is using a 'traditional' method by comparison. The ML before deep learning, stuff like random forests, routinely takes loads of catagories. If you are using a non-deep learning ML you would traditional use several different approaches to justify your result.
  
  My answer is a bit rambly but I think you'll get the gist. Peronally I would complement with a standard ML, but all methods have their flaws. Deep learning (DL) has a big history in drug discovery (alot of work was done via Tensorflow), but I'm not sure you've data set size for this.
  
original_text: 9830: <p>I am new in this field and I am having some problems regarding a new project.</p>
  <p>I built a graph using Drugbank Data connected to SIDER Adverse Reactions.
  I used Organ- level Terms to classify the ADRs in 25 different groups.
  I aim to use the algorithm Metapath2vec in order to cluster drugs based on the group of ADRs they lead to.
  I am currently using the python package for Machine Learning on graphs Stellargraph and the related implementation of Metapath2vec.</p>
  <p>I chose Clustering as downstream task with the resulting node embeddings, e.g. DBSCAN but the results are not promising.
  I would like to have some clusters of drugs related to different adverse drug reaction.
  Since I am new in this field everything I am trying is based on scientific literature but I don't know if this is the right approach for my objective.</p>
  <p>This is the code related to the metapath2vec algorithm:</p>
  <pre><code>walk_length = 100  # maximum length of a random walk to use throughout this notebook
  
  # specify the metapath schemas as a list of lists of node types.
  metapaths = [
      [&quot;drug&quot;, &quot;adr&quot;, &quot;drug&quot;],
      [&quot;drug&quot;, &quot;adr&quot;, &quot;drug&quot;, &quot;drug&quot;],
      [&quot;drug&quot;, &quot;drug&quot;],
      [&quot;drug&quot;, &quot;adr&quot;, &quot;group_adr&quot;, &quot;adr&quot;, &quot;drug&quot;],
      ]
  
  # Create the random walker
  rw = UniformRandomMetaPathWalk(graph)
  
  walks = rw.run(
      nodes=list(graph.nodes()),  # root nodes
      length=walk_length,  # maximum length of a random walk
      n=1,  # number of random walks per root node
      metapaths=metapaths,  # the metapaths
  )
  
  
  from gensim.models import Word2Vec
  
  model = Word2Vec(walks, size=128, window=5, min_count=0, sg=1, workers=2, iter=1)
  
  </code></pre>
  <p>Should I change approach?
  what other algorithm for representation learning can I use in order to reach my goal?
  what can I improve in the presented approach to have better node embeddings?</p>
   3848: <p>Clearly the additional references do put Metapath2vec into good use. Its a many to many ML relationship. Most catagorization/classification particularly in deep learning is many  to one. So thats the good thing about the technique you  are using, you've 25 catagories, which is quite large for machine learning(ML) and large for deep learning. The technique appears to be half way between supervised and unsupervised learning. The random walk establishes a zone (circle) of catagorisation.</p>
  <p><strong>NLP Background</strong></p>
  <p>The situation where it would work in NLP (natural language processing) is for example a spell checker, where you have one correct word and loads of possible typos, some of which you not observed in training. So what will happen is the random walk will pick up the local vacinity around the 'correct spelling' by the vectorization (converting a word into numbers) of the incorrect spelling will land it close to 'true spelling' in a 2D vectorization plot. The training following the random walk says  'yep you belong with me'.</p>
  <p>The papers given talk about being able to identify the context of a word within a sentence which is a very NLP thing, one vectorisation being 'bags of words'. So here the sentence represents one of many categories of information, i.e. each is the central node within the graph, the vectorisation of the sentence places of meaning closer to one 'hub' than another and again the local vacinity is identified by the random walk. In training this 'random walk vacinity' is identified, so it will algorithmically recreate the 'random walk locality' so that sentences that have not been trained can have their meaning identified.</p>
  <p>The central theory of deep learning, which not quite true of other ML, is any algorithm can be recreated through training. So like it will sort of recreate a 'random walk zone'</p>
  <p><strong>Difference with drug discovery</strong></p>
  <p>The papers you have map drugs to genes, but it means you have to have a &quot;true drug to gene&quot; relationship. The problem I see here is what is 'true' for a drug-protein interaction? With a spell-checker there is one 'true spelling', with a sentence there is pretty much one 'type of meaning', like a movie was great, average, terrible based on a ratings score and stuff like gender classification. If its not 'true' the random walk will get it wrong. So its a big assumption. If you have a circle and pick a point on the edge of the circle then try and draw a circle around the original circle, you can't unless the circle is so large it risks including stuff that is not part of the original circle. The problem the papers is how do they know what is the 'centre' of the circle? Its an a priori assumption and you need really good biological rationale.</p>
  <p>With your stuff I agree its easier because adverse drug reaction, some drugs could be fatal or toxic (traditional cancer drugs or parasite drugs), so you'd pick the worst case adverse reaction. That then centres the definition around which everything else is relative. If however your 'true catagory' turned out to be an outlier its not going to work, because the random walk only works if its starts bang in the centre of the 'catagory'. Random walks form spheres, in case you are not aware. I can see this working as an advanced 'unsupervised learning' technique.</p>
  <p>One very real advantage is if a drug doesn't have an adverse reaction it MIGHT (I'm guessing) not give a result, in which case you are good to go - that a good drug. If that is what happened that would be amazing because its not how ML, or particularly DL works. Traditional ML/DL will force a classification even if it doesn't fit. There are methods to accept some sort of &quot;half-classification&quot; but I don't know how to do it. This is one of the reaons you need lots of things to train.</p>
  <p>I am assuming that vectorisation of your drug is fine because there is a huge history of this in drug-discovery going right back to the origins of the field.</p>
  <p><strong>Summary</strong></p>
  <p>So yeah I get the idea, I see the flaws and the advantages. The final issue is that most ML requires pretty large data sets and DL require huge data sets and when you've got 25 catagories. For DL approaches the data set size might need to be huge unless you can do 'transfer learning' (backing your training onto a pre-trained model). If your method resulted in a zero classification i.e. &quot;doesn't fit anything I've got&quot; - that would be cool and that is the key advantage I can see in the 'random walk' approach which is not available using traditional methods.</p>
  <p>As long as you are aware, you do not have to use this algorithm to get a classification. This final point what appears missing in the papers is using a 'traditional' method by comparison. The ML before deep learning, stuff like random forests, routinely takes loads of catagories. If you are using a non-deep learning ML you would traditional use several different approaches to justify your result.</p>
  <hr />
  <p>My answer is a bit rambly but I think you'll get the gist. Peronally I would complement with a standard ML, but all methods have their flaws. Deep learning (DL) has a big history in drug discovery (alot of work was done via Tensorflow), but I'm not sure you've data set size for this.</p>
  