Guest User

Untitled

a guest
Apr 20th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. GloVe = {{1, 2}, {3, 4}, {0, 0}};
  2.  
  3. net = NetChain[{
  4. EmbeddingLayer["Weights" -> GloVe],
  5. LongShortTermMemoryLayer[10],
  6. SequenceLastLayer[],
  7. 2,
  8. SoftmaxLayer[]
  9. },
  10. "Input" -> NetEncoder[{"Tokens", {"a", "b"}}],
  11. "Output" -> NetDecoder[{"Class", {0, 1}}]
  12. ]
  13.  
  14. data = {"a a" -> 0, "b b" -> 1, "a b" -> 0, "b a" -> 1, "a b c" -> 0};
  15.  
  16. netT = NetTrain[net, data]
  17.  
  18. NetExtract[netT, {1, "Weights"}]
  19.  
  20. netT = NetTrain[net, data, LearningRateMultipliers -> {1 -> 0, _ -> 1}]
  21.  
  22. NetExtract[netT, {1, "Weights"}]
Add Comment
Please, Sign In to add comment