Code for Anomaly Detection
来源:互联网 发布:ubuntu邮件服务器 编辑:程序博客网 时间:2024/05/23 02:01
Estimating parameters for a Gaussian
function [mu sigma2] = estimateGaussian(X)%ESTIMATEGAUSSIAN This function estimates the parameters of a %Gaussian distribution using the data in X% [mu sigma2] = estimateGaussian(X), % The input X is the dataset with each n-dimensional data point in one row% The output is an n-dimensional vector mu, the mean of the data set% and the variances sigma^2, an n x 1 vector% Useful variables[m, n] = size(X);% You should return these values correctlymu = zeros(n, 1);sigma2 = zeros(n, 1);% Instructions: Compute the mean of the data and the variances% In particular, mu(i) should contain the mean of% the data for the i-th feature and sigma2(i)% should contain variance of the i-th feature.%mu=mean(X);sigma2=var(X);end
Selecting the threshold, ε
function [bestEpsilon bestF1] = selectThreshold(yval, pval)%SELECTTHRESHOLD Find the best threshold (epsilon) to use for selecting%outliers% [bestEpsilon bestF1] = SELECTTHRESHOLD(yval, pval) finds the best% threshold to use for selecting outliers based on the results from a% validation set (pval) and the ground truth (yval).bestEpsilon = 0;bestF1 = 0;F1 = 0;stepsize = (max(pval) - min(pval)) / 1000;for epsilon = min(pval):stepsize:max(pval) % Instructions: Compute the F1 score of choosing epsilon as the % threshold and place the value in F1. The code at the % end of the loop will compare the F1 score for this % choice of epsilon and set it to be the best epsilon if % it is better than the current choice of epsilon. % % Note: You can use predictions = (pval < epsilon) to get a binary vector % of 0's and 1's of the outlier predictions % you can find out how many values in this vector are 0 by using: sum(v == 0). predictions=(pval<epsilon); tp=sum((yval==1)&(predictions==1)); fp=sum((yval==0)&(predictions==1)); fn=sum((yval==1)&(predictions==0)); prec=tp/(tp+fp);rec=tp/(tp+fn); F1=2*prec*rec/(prec+rec); if F1 > bestF1 bestF1 = F1; bestEpsilon = epsilon; endendend
0 0
- Code for Anomaly Detection
- Study notes for Anomaly Detection
- Anomaly Detection
- A new open source data set for anomaly detection
- USING DEEP LEARNING FOR ANOMALY DETECTION IN RADIOLOGICAL IMAGES
- 13-Anomaly Detection
- 异常点监测:Anomaly Detection
- anomaly detection ng recommender system
- Stanford 机器学习 Anomaly Detection
- 异常检测(anomaly detection)
- 【Machine Learning】笔记:anomaly detection
- 论文笔记:Chaotic Invariants of Lagrangian Particle Trajectories for Anomaly Detection in Crowded Scenes
- 论文阅读——Generic and Scalable Framework for Automated Time-series Anomaly Detection
- ourmon - network monitoring and anomaly detection system
- Andrew Ng Machine Learning 专题【Anomaly Detection】
- Machine Learning week 9 quiz: Anomaly Detection
- Week 9:Anomaly Detection课后习题解答
- Stanford 机器学习笔记 Week9 Anomaly Detection
- Ajax的基本理解
- 字符串算式计算简化--python学习eval()
- Java中For-Each循环的使用
- Spring发展过程中的主要阶段
- 继承与多态,动态绑定,final,abstract
- Code for Anomaly Detection
- 常用汇编寄存器
- android studio install windows
- 蚂蚁金服11.11:支付宝和蚂蚁花呗的技术架构及实践
- ubuntu 更新时出现校验和不符 的一种解决办法
- 我的第一个WordPress
- jquery事件总结
- 微服务实战(一):微服务架构的优势与不足
- ssh学习笔记