Created
September 14, 2015 21:18
-
-
Save zenna/3d7472af266af89989c9 to your computer and use it in GitHub Desktop.
NMF
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
var V_data = [ | |
[Math.random(), Math.random()], | |
[Math.random(), Math.random()], | |
[Math.random(), Math.random()]] | |
var H_data = [ | |
[Math.random(), Math.random(), Math.random()], | |
[Math.random(), Math.random(), Math.random()]] | |
var W_data = numeric.dot(V_data, H_data) | |
var model = function() { | |
var V = [ | |
[uniform(0,1), uniform(0,1)], | |
[uniform(0,1), uniform(0,1)], | |
[uniform(0,1), uniform(0,1)]] | |
var H = [ | |
[uniform(0,1), uniform(0,1), uniform(0,1)], | |
[uniform(0,1), uniform(0,1), uniform(0,1)]] | |
var W = numeric.dot(V, H) | |
var absdiff = numeric.sum(numeric.abs(numeric.sub(W, W_data))) | |
// print(absdiff) | |
factor( -absdiff ) | |
return absdiff; | |
} | |
MH(model, 100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment