Created
November 19, 2015 00:59
-
-
Save brh55/66a22ed02fdc3b80bf33 to your computer and use it in GitHub Desktop.
reddit analytics
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
// TODO: Will like to get back to this if I have time. | |
// Goal would be to iterate through with a instance set containing different days and MostComments and Score. Then suggest the day with greatest probability based on model. | |
// if (model.postList.length > 0) { | |
// var forest = new forestjs.RandomForest(); | |
// var options = {} | |
// options.numTrees = 100; | |
// options.maxDepth = 5; | |
// options.numTries = 10; | |
// TODO: COME BACK TO And figure out why it's not working. | |
// options.trainFun = function(data, labels, ix, options) { | |
// // save parameters that describe your model | |
// model.parameter1 = 40; | |
// model.parameter2 = 10; | |
// return model; | |
// }; | |
// options.testFun = function(inst, model) { | |
// console.log(a); | |
// // use model.parameter1 and model.parameter2 to return a 1 or -1 for | |
// // example instance inst. This determines if it will be passed down | |
// // left or right in the tree. | |
// return inst[0] > model.parameter1 ? 1 : -1; // silly example | |
// }; | |
// forest.train(model.postList, ["score", "commentsCount", "weekDay"], options); | |
// var predictionList = []; | |
// for (var days = 0; days <= 7; days++) { | |
// predictionList.push([model.bestScore, model.mostComments]); | |
// } | |
// var testInstance = [10000]; | |
// var labelProbability = forest.predict(predictionList); | |
// console.log(labelProbability); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment