Skip to content

Instantly share code, notes, and snippets.

View evilying's full-sized avatar
🎯
Focusing

Jack evilying

🎯
Focusing
View GitHub Profile
@evilying
evilying / Lemon.MinCostFlow.NS.Sample.cpp
Created November 11, 2020 02:36 — forked from Zhouxing-Su/Lemon.MinCostFlow.NS.Sample.cpp
Sample code of using Network Simplex in Lemon for Min Cost Flow problem.
#include <iostream>
#include <lemon/smart_graph.h>
#include <lemon/network_simplex.h>
using namespace lemon;
using namespace std;
@evilying
evilying / pca_animation.m
Created May 27, 2020 15:49 — forked from anonymous/pca_animation.m
Matlab code to produce PCA animations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Matlab code to produce PCA animations shown here:
% http://stats.stackexchange.com/questions/2691
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Static image
clear all
rng(42)
@evilying
evilying / README.md
Created May 11, 2020 15:52 — forked from marmakoide/LICENSE.md
Compute and display a Laguerre-Voronoi diagram (aka power diagram), only relying on a 3d convex hull routine. The Voronoi cells are guaranted to be consistently oriented.

2d Laguerre-Voronoi diagrams

This code sample demonstrates how to compute a Laguerre-Voronoi diagram (also known as power diagram) in 2d.

thumbnail

Power diagrams have a wonderful property : they decompose the union of (overlapping) circles into clipped circles that don't overlap. The cells have

Precision-Recall

Precision-Recall is a useful measure of success of prediction when the classes are very imbalanced. In information retrieval, precision is a measure of result relevancy, while recall is a measure of how many truly relevant results are returned.

The precision-recall curve shows the tradeoff between precision and recall for different threshold. A high area under the curve represents both high recall and high precision, where high precision relates to a low false positive rate, and high recall relates to a low false negative rate. High scores for both show that the classifier is returning accurate results (high precision), as well as returning a majority of all positive results (high recall).

A system with high recall but low precision returns many results, but most of its predicted labels are incorrect when compared to the training labels. A system with high precision but low recall is just the opposite, returning very few results, but most of its predicted labels are correct when compared t

Local outlier factor

The LOF is an anomaly score that you can generate using the scikit-learn class sklearn.neighbors.LocalOutlierFactor. Similar to the aforementioned k-NN and k-means anomaly detection methods, LOF classifies anomalies using local density around a sample. The local density of a data point refers to the concentration of other points in the immediate surrounding region, where the size of this region can be defined either by a fixed distance threshold or by the closest n neighboring points. LOF measures the isolation of a single data point with respect to its closest n neighbors. Data points with a significantly lower local density than that of their closest n neighbors are considered to be anomalies.

Grubbs’ outlier test

Grubbs’ test is an algorithm that finds a single outlier in a normally distributed dataset by considering the current minimum or maximum value in the series. The algorithm is applied iteratively, removing the previously detected outlier between each iteration. Although we do not go into the details here, a common way to use Grubbs’ outlier test to detect anomalies is to calculate the Grubbs’ test statistic and Grubbs’ critical value, and mark the point as an outlier if the test statistic is greater than the critical value. This approach is only suitable for normal distributions, and can be inefficient because it only detects one anomaly in each iteration.

Typically, we’ll set the pd.get_dummies() argument drop_first to True to avoid the so-called “dummy variable trap,” in which independent variables being closely correlated violates assumptions of independence in regression.

@evilying
evilying / card0.md
Last active June 25, 2018 20:12
Apache Lucene

Apache Lucene

Lucene is one Java API library. It is not an application or product.

It includes three parts:

  • analyze document
  • build index,
  • run query
@evilying
evilying / card.md
Last active June 25, 2018 18:19
罗马共和国前三巨头

罗马共和国前三巨头:庞培,克拉苏,Caesar

后三巨头:安东尼,屋大维,雷必达