Skip to content

Instantly share code, notes, and snippets.

@jamiees2
jamiees2 / astar.py
Created May 7, 2013 11:20
A* Algorithm implementation in python.
# Enter your code here. Read input from STDIN. Print output to STDOUT
class Node:
def __init__(self,value,point):
self.value = value
self.point = point
self.parent = None
self.H = 0
self.G = 0
def move_cost(self,other):
return 0 if self.value == '.' else 1
@Laurae2
Laurae2 / aic_bic.R
Created February 24, 2017 19:55
Akaike Information Criterion and Bayesian Information Criterion
lm_model <- lm(preds ~ ., data = data)
my_AIC <- AIC(lm_model)
my_AIC <- nrow(data) * (log(2 * pi) + 1 + log((sum(lm_model$residuals ^ 2) / nrow(data)))) + ((length(lm_model$coefficients) + 1) * 2)
my_BIC <- AIC(lm_model, k = log(nrow(data)))
my_BIC <- nrow(data) * (log(2 * pi) + 1 + log((sum(lm_model$residuals ^ 2) / nrow(data)))) + ((length(lm_model$coefficients) + 1) * log(nrow(data)))