Ng机器学习 Week9 Anomaly Detection

Anomaly Detection

Ng机器学习 Week9 Anomaly Detection_第1张图片
Ng机器学习 Week9 Anomaly Detection_第2张图片
Ng机器学习 Week9 Anomaly Detection_第3张图片
Ng机器学习 Week9 Anomaly Detection_第4张图片
Q4错误
Ng机器学习 Week9 Anomaly Detection_第5张图片
-3,4

Recommender Systems

Ng机器学习 Week9 Anomaly Detection_第6张图片
额是1,2,后来忘记截图了
Ng机器学习 Week9 Anomaly Detection_第7张图片
Ng机器学习 Week9 Anomaly Detection_第8张图片

Ex

estimateGaussian.m

mu = mean(X);
sigma2 = var(X,opt=1);

selectThreshold.m

predictions = (pval < epsilon);

tPos = sum((predictions == 1) & (yval == 1));
fPos = sum((predictions == 1) & (yval == 0));
fNeg = sum((predictions == 0) & (yval == 1));

precision = tPos / (tPos + fPos);
recall = tPos / (tPos + fNeg);

F1 = (2 * precision * recall) / (precision + recall);

cofiCostFunc.m

errors = (X*Theta' - Y) .* R;
J = 1/2 * sum(sum(errors .^2)) + lambda/2 * sum(sum(Theta.^2)) + lambda/2 * sum(sum(X.^2));
X_grad = errors * Theta + lambda * X;
Theta_grad = errors' * X + lambda * Theta;

你可能感兴趣的:(机器学习)