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
def multivariate_gradient_descent(training_examples, alpha=0.01): | |
""" | |
Apply gradient descent on the training examples to learn a line that fits through the examples | |
:param examples: set of all examples in (x,y) format | |
:param alpha = learning rate | |
:return: | |
""" | |
# initialize the weight and x_vectors | |
W = [0 for index in range(0, len(training_examples[0][0]))] |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
-- Do Tree Traversals and Built a Visitation List for each | |
preorder :: BinaryTree a -> [a] | |
preorder Leaf = [] | |
preorder (Node left root right) = root : preorder left ++ preorder right | |
-- NOTE: Need to use the ++ so each list gets built separately and then concatenated | |
-- after it hits bottom | |
inorder :: BinaryTree a -> [a] | |
inorder Leaf = [] |
OlderNewer