text:
# Christian Lievrouw
  - Charles City, IA
    - 26 Years old
      - [Github profile](https://github.com/ChristianLievrouw)

  I was born in Mason City, IA and grew up in Charles City, IA. I graduated from Charles City High School in 2011. I currently  work as a beer delievery driver for Kabrick Dist. My goal for Deltav is to have the growth mindset to go from just a delivery driver to a software developer with a growing and successful career.

## Growth Mindset

  The growth mindset to me is being open to *failing*, then **learning** from your failures. Always keep your head up and do not become discoraged. Learn from doing something wrong and be open to help from others and their opinions. When you set yourself up for a growth mindset you can accomplish anything.
### Three reminders to stay in a growth mindset
  1. Each failure is a oppurtunity to learn.
  2. Be open to help from others and their ideas.
  3. Never give up when obstacles present themselves.

## Class assignments
[Read01 2/10/2020](read01.md)

[Read02 2/10/2020](read02.md)

[Read03 2/11/2020](read03.md)

[Read04 2/11/2020](read04.md)

[Read 05 2/12/2020](read05.md)

[Read06a 2/12/2020](read06a.md)

[Read06b 2/12/2020](read06b.md)

[Read07 2/13/2020](read07.md)

repository: ChristianLievrouw/LearningJournal

repo_name: ChristianLievrouw/LearningJournal


text:
---
title: About
# We can even add meta tags to the page! This sets the keywords meta tag.
# <meta name="keywords" content="my SEO keywords"/>
description: About the Visual Studio Code and the Peacock Extension
meta:
  - name: keywords
  - content: vscode "visual studio code" peacock theme extension
---

# About Peacock

Subtly change the color of your Visual Studio (VS) Code workspace. Ideal when you have multiple VS Code instances, use Visual Studio Live Share, or use VS Code's Remote features, and you want to quickly identify your editor.

## Why Peacock

Have you ever found yourself switching between multiple instances of VS Code, while trying to find which one you were looking for? I often have multiple instances open for coding, writing, and pretty much everything I do with text. Being able to quickly identify each instance is super helpful.

I used to switch the colors of a few key aspects of VS Code manually so I could differentiate them. I was using this technique at conferences where I presented and found it helpful for the audience so they could identify my code too. I finally decided to automate this. That's where [Peacock](https://marketplace.visualstudio.com/items?itemName=johnpapa.vscode-peacock&wt.mc_id=vscodepeacock-github-jopapa) came from.

## History of Peacock

A while back I created a theme for [Visual Studio Code](https://code.visualstudio.com?wt.mc_id=vscodepeacock-github-jopapa) called [Winter is Coming](https://marketplace.visualstudio.com/items?itemName=johnpapa.winteriscoming&wt.mc_id=vscodepeacock-github-jopapa). I learned how to do this by reading this [great guide on theming](https://code.visualstudio.com/api/extension-capabilities/theming?wt.mc_id=vscodepeacock-github-jopapa) in the VS Code docs. I still use it today (I love the dark versions). It taught me a lot about how to customize colors in VS Code.

I then started using this to help solve another problem I had - quickly and visually differentiating between VS Code instances

I'm often working on multiple code projects an articles I am writing in markdown. My workflow is to open different separate VS Code instances for each, as they are often unrelated to each other. As my mind shifts between the work, I find myself cycling through the instances and it takes me a bit of time to identify which instance I want to in focus.

I decided to automate this. Once I had a working extension completed, I created a simple animated gif and shared it on twitter to see if anyone else was interested. Then I went to bed. I woke up he next morning to a lot of positive reactions than from the community (thank you). I also received many great contributions already (thank you again!).

If you are interested in trying out Peacock, you can [find it here in the marketplace](https://marketplace.visualstudio.com/items?itemName=johnpapa.vscode-peacock&wt.mc_id=vscodepeacock-github-jopapa).

license: MIT

repository: johnpapa/vscode-peacock

branch_name: refs/heads/main

extension: md

gha_language: TypeScript

gha_license_id: MIT

license_type: permissive

repo_name: johnpapa/vscode-peacock


text:
# EssAI

EssAI is a Google Docs extension that provides exercises for high school and college writing instruction. We've designed two machine-learning enabled exercises that are intended to be:

* Scalable: EssAI provides easy-to-use and repeatable writing training that can be customized by instructors across fields and domains.

* Systematic: EssAI uses machine learning to enable a rigorous form of training called deliberate practice, both by automating away tedious aspects of the exercises and by providing tight feedback loops.

Our current beta version is framed around the writing styles of Jane Austen and Mark Twain.

For more information, please visit EssAI's homepage: http://essai-writing.site/

## Credits:

For our readability and lexical diversity scores, we modified the code from this repo by Hassaan Elahi to compose with our existing pipeline:
https://github.com/Hassaan-Elahi/Writing-Styles-Classification-Using-Stylometric-Analysis

While we did not wind up using this code in the final product, we wanted to credit him for aiding our exploration. The modified portions from the repo are marked as such in the relevant files.

For the front end, there are small JavaScript / CSS snippets from Stack Overflow that solve some niche issues. They've been credited where they appear in the code.

repository: Stanley-Ye/EssAI

repo_name: Stanley-Ye/EssAI


text:
# MLP: FiM Episode Transcript Search

What it says on the tin. Search MLP episode transcripts with ease. Supports RegEx! Transcript data acquired from [here](https://www.kaggle.com/jwiens/my-little-pony-friendship-is-magic-episode-data/version/1).

## Search Help

To search by character speaking, use `{character:character name}`:

```
{character:Sweetie Bell}
```

To search by episode title, use `{episode:episode name}`:

```
{episode:Fall Weather Friends}
```

For example:
```
{episode:Fall Weather Friends} {character:Rainbow Dash} Applejack
```
This will return any line in Fall Weather Friends spoken by Rainbow Dash containing the word 'Applejack'.

All search fields support Regular Expressions. Regular Expressions are a powerful way to search through text. You can learn more about them [here](https://www.regular-expressions.info/).

As an example, if you wanted to search for 'Tom' and only 'Tom', you could use the following:
```
\bTom\b
```
This will match only the word 'Tom', while ignoring words like 'Tomorrow'.

### What's in here

- Every episode of My Little Pony: Friendship is Magic
- My Little Pony: The Movie
- My Little Pony: Rainbow Roadtrip
- My Little Pony: Best Gift Ever
- Animated Shorts

### What isn't in here

- All My Little Pony: Equestria Girls content
- My Little Pony: Pony Life

gha_language: JavaScript


text:
# match-token [![build status](https://secure.travis-ci.org/thlorenz/match-token.png)](http://next.travis-ci.org/thlorenz/match-token)

Given a string and a position, it finds the position of the token matching the one at the given position.

```js
var matchToken = require('match-token');

matchToken('{1}', 0) // -> 2
matchToken('{1}', 2) // -> 0

//<PHONE_NUMBER>01234
matchToken('var foo = "bar"', 10) // -> 14 (quotes)

matchToken('{{1}}', 0) // -> 4 (outer brace)
matchToken('{{1}}', 1) // -> 3 (inner brace)
```

## Installation

    npm i match-token

## Features

Matches the following tokens in a given string.

- `{` with `}` and vice versa
- `(` with `)` and vice versa
- `[` with `]` and vice versa
- quotes `'` and `"`

Returns position of match in the string or `-1` if it was either not found or the the inputs were invalid (i.e. the
string was `null` or `undefined` or the index was out of range).

## Caveats

Not meant to be perfect, i.e. does no code parsing in order to be able to handle incomplete code.

Simply counts opening vs. closing tokens and therefore does nothing special if a token appears in a string for instance.

```js
//<PHONE_NUMBER>
matchToken('{ a: "}" }', 0) // -> 6 (although it is in a string)
```

In order to disambiguate between quotes, i.e., when not sure if given quote is the opener or close, it uses the match
that puts the least distance between opening an closing quotes.

repository: TomWittmann/bug-clinic

branch_name: refs/heads/master

repo_name: TomWittmann/bug-clinic


text:
---
layout: default
title: project
---

 List of projects

Datalog-based Scalable Semantic Diffing of Concurrent Programs

CANAL: A Cache Timing Analysis Framework via LLVM Transformation

Modular Verification of Interrupt-driven software

Extension of a Scope query optimiztion tool

Optimization of testing web applications

Interactive Visualization

Development of Boot loader sequence

Datalog-based Scalable Semantic Diffing of Concurrent Programs

When an evolving program is modified to address issues related
to thread synchronization, there is a need to confirm the change
is correct, i.e., it does not introduce unexpected behavior. However,
manually comparing two programs to identify the semantic
difference is labor intensive and error prone, whereas techniques
based on model checking are computationally expensive. To fill the
gap, we develop a fast and approximate static analysis for computing
synchronization differences of two programs. The method is
fast because, instead of relying on heavy-weight model checking
techniques, it leverages a polynomial-time Datalog-based program
analysis framework to compute differentiating data-flow edges, i.e.,
edges allowed by one program but not the other. Although approximation
is used our method is sufficiently accurate due to careful
design of the Datalog inference rules and iterative increase of the
required data-flow edges for representing a difference. We have
implemented our method and evaluated it on a large number of
multithreaded C programs to confirm its ability to produce, often
within seconds, the same differences obtained by human; in contrast,
prior techniques based on model checking take minutes or
even hours and thus can be 10x to 1000x slower.

   Project link: https://github.com/ChunghaSung/EC-Diff

CANAL: A Cache Timing Analysis Framework via LLVM Transformation

A unified modeling framework for non-functional properties of a
program is essential for research in software analysis and verification,
since it reduces burdens on individual researchers to implement
new approaches and compare existing approaches. We
present CANAL, a framework that models the cache behaviors of
a program by transforming its intermediate representation in the
LLVM compiler. CANAL inserts auxiliary variables and instructions
over these variables, to allow standard verification tools to handle
a new class of cache related properties, e.g., for computing the
worst-case execution time and detecting side-channel leaks. We
demonstrate the effectiveness of CANAL using three verification
tools: KLEE, SMACK and Crab-llvm. We confirm the accuracy of
our cache model by comparing with CPU cycle-accurate simulation
results of GEM5.

   Project link: https://github.com/canalcache/canal

Modular Verification of Interrupt-driven software

    Since there has been relatively lack of verification
methods for interrupt-driven programs even the behavior of interrupts is similar with that of threads, we introduced a more accurate verification
method for interrupt-driven programs by leveraging a thread-modular
analysis for concurrent programs. By modeling interrupt behavior such
as priority information and preemption information with Z3 SMT solver,
I combined this information with a thread-modular abstract interpretation
analysis. Therefore, I could remove infeasible interference for interrupt-driven programs and could achieve a more accurate analysis without losing
 computation overhead.

I compared our analysis to state-of-the-art techniques one of which is a thread-modular analysis for concurrent programs, and another is a model checking based interrupt-driven analysis tool, with about 35 C-base interrupt-driven programs. Finally, my tool showed its higher accuracy than other two tools with getting a little overhead.

   Project link: https://github.com/chunghasung/intabs

Extension of a Scope query optimization tool

During the internship at MSR, I extended a scope query optimization tool.
The tool consists of two parts: one part is parser and another part is template generation.
Basically, it parses a query file and then prints a C-style code template,
and the template is fed into a programming synthesis tool to optimize it.
Then, the optimized C-style program is translated into an optimized query.
However, the tool only supported a small set of queries because many queries
use many combinations of columns and uninterpreted functions. So, I have
changed both parser and template generation parts. To achieve this, I got used to F#, C# and Scope query.

Optimization of testing web applications

Even though there were many approaches to analyze web applications, it was hard to analyze them accurately due to its inherent characteristic of user-driven events using the DOM (Document Object Model). This project tries to model the DOMs to find out dependencies between two events which are attached to the DOMs. To achieve this, I made a JavaScript parser from the scratch using JavaScript and nodejs, and modified JS_WALA to build a CFG (Control Flow Graph). Based on the CFG, translated datalog facts are printed. My analysis is inter-procedural and flow-insensitive pointer analysis. Finally, from the facts I got and the rules I made, I can figure out the dependencies among all events over-approximately.

To show the usefulness of my work, I hooked up the automated testing tool named Artemis to shrink the searching space of it using POR (Partial Order Reduction) with the dependency information. I tested with about 20 real world JavaScript games which are highly user-driven events demanded programs, and the result shows that the overhead of this analysis is really negligible and we got about 16% improvement of code coverage in average.

Project link: https://github.com/chunghasung/jsdep

Interactive Visualization

Our team developed an interactive visualization graphic package as an open source in R project during the Google summer of Code 2013 period to help people easily deal with various aspects of data by inserting new data or deleting outliers while watching the graphs. To support these features easily our team used the browser to show the graph using HTML and JavaScript. The advantage of using the browser to support the graphic package is people can easily use this package on the various platforms such as mobile devices. Furthermore, we try to support server-side offload using the package named Shiny with the large number of data which are hard to compute at the client-side platform.

Project link: https://righthelp.github.io/tutorial/overview

Development of Boot loader sequence

When I was at AhnLab, I worked on prototyping new boot loader for an appliance that should be compatible with x86/MIPS architecture and Linux-based operating systems and simplified customer support and troubleshooting, ensuring that the boot loader would provide multi-level booting, securing the system to protect not only back side information, but customers’ information as well.

gha_language: HTML


text:
---

title: "CellProfiler 3.0: Next-generation image processing for biology"

date: "2018-07-03"

authors: ['admin']

tags:  ['Research Article', 'None', 'PLOS Biology']

layout: "post"

---

Publishing date: 2018-07-03

Published on: PLOS Biology

summary: CellProfiler is a free software that has enabled researchers, without training in computer vision or programming community to create flexible, modular image analysis pipelines since its release in 2005.  In this article the authors introduce CellProfiler 3.0 which now enables analysis of three-dimensional (3D) image stacks, provides a protocol for cloud-based, large-scale image processing and enables running pre trained deep learning models on images.

CellProfiler is an exceptional open source package which follows best practices and has created a large active community. Their GitHub repository has currently more than 2,000 closed issues, 1,045 closed pull requests and 41 contributors.

authors: Claire McQuin, Allen Goodman, Vasiliy Chernyshev, Lee Kamentsky, Beth A. Cimini, Kyle W. Karhohs, Minh Doan, Liya Ding, Susanne M. Rafelski, Derek Thirstrup, Winfried Wiegraebe, Shantanu Singh, Tim Becker, Juan C. Caicedo, Anne E. Carpenter

link to paper: https://journals.plos.org/plosbiology/article?id=10.1371/journal.pbio.2005970

Icons made by catkuro from  www.flaticon.com

repository: amchagas/open-source-toolkit

repo_name: amchagas/open-source-toolkit


text:
# bash-common-environment
[![Build Status](https://travis-ci.org/vinsonchuong/bash-common-environment.svg?branch=master)](https://travis-ci.org/vinsonchuong/bash-common-environment)

Sets common environment variables for a Bash library on Linux

* [docs](doc/environment.md)
* [code](bin/environment)

## Installing
If the target machine is running [Arch Linux](https://www.archlinux.org/),
an [AUR package](https://aur.archlinux.org/packages/bash-common-environment/)
is available.

Otherwise, the script in the `bin` directory can be executed directly.

repository: vinsonchuong/bash-common-environment

repo_name: vinsonchuong/bash-common-environment


text:
### HINT: \*ngFor directive
ngFor is case sensitive and the syntax is exactly like ES6/TypeScripts for loop: `let obj of list`.  Note the "of", not "in" like in C#!

Example:

Component:
```typescript
@Component({...})
export class AppComponent {
	employees: Employee[] = [{FirstName: "Spencer", LastName: "S."},
							  {FirstName: "George", LastName: "G."}];
}
```

Template:
```html
<div *ngFor="let employee of employees">
	{{ employee.FirstName }} {{ employee.LastName }}
</div>
```


text:
![High-fidelity performance metrics for generative models in PyTorch](doc/img/header.png)

[![TestStatus](https://circleci.com/gh/toshas/torch-fidelity.svg?style=shield)](https://circleci.com/gh/toshas/torch-fidelity)
[![PyPiVersion](https://badge.fury.io/py/torch-fidelity.svg)](https://pypi.org/project/torch-fidelity/)
![PythonVersion](https://img.shields.io/badge/python-%3E%3D3.6-yellowgreen)
[![PyPiDownloads](https://pepy.tech/badge/torch-fidelity)](https://pepy.tech/project/torch-fidelity)
[![DOI](https://img.shields.io/badge/DOI-zenodo-blue)](https://zenodo.org/record/3786540)
![License](https://img.shields.io/pypi/l/torch-fidelity)

Evaluation of generative models such as GANs is an important part of the deep learning research.
In the domain of 2D image generation, three approaches became widely spread:
**Inception Score** (aka IS) [[1]](https://arxiv.org/pdf/1606.03498.pdf), **Fréchet Inception Distance** (aka FID)
[[2]](https://arxiv.org/pdf/1706.08500.pdf), and **Kernel Inception Distance** (aka KID)
[[3]](https://arxiv.org/pdf/1801.01401.pdf).

These metrics, despite having a clear mathematical and algorithmic description, were initially implemented in
TensorFlow, and inherited a few properties of the framework itself (see Interpolation) and the code they relied upon
(see Model).
These design decisions were effectively baked into the evaluation protocol and became an inherent part of the
metrics specification.
As a result, researchers wishing to compare against state of the art in generative modeling are forced to perform
evaluation using codebases of the original metric authors.
Reimplementations of metrics in PyTorch and other frameworks exist, but they do not provide a proper level of fidelity,
thus making them unsuitable for reporting results and comparing them to other methods.

This software aims to provide epsilon-exact implementations of the said metrics in PyTorch, and thus remove
inconveniences associated with generative models evaluation and development. All steps of the evaluation pipeline are
correctly tested, with relative errors and sources of remaining non-determinism summarized in sections below.

**TLDR; fast and reliable GAN evaluation in PyTorch**

## Installation

```shell script
pip install torch-fidelity
```

## Quick Start Usage with Command Line

Inception Score of CIFAR-10 training split:
```shell script
> fidelity --gpu 0 --isc cifar10-train

inception_score_mean: 11.23678
inception_score_std: 0.09514061
```

Inception Score of a directory of images:
```shell script
> fidelity --gpu 0 --isc <path>
```

Fréchet Inception Distance between a directory of images and CIFAR-10 training split:
```shell script
> fidelity --gpu 0 --fid <path> cifar10-train
```

Kernel Inception Distance between two directories with images:
```shell script
> fidelity --gpu 0 --kid <path1> <path2>
```

Efficient computation of all three metrics with feature caching (Inception Score computed only for the first positional
argument):
```shell script
> fidelity --gpu 0 --isc --fid --kid <path> cifar10-train
```

## Quick Start Usage with Python API

When it comes to tracking the performance of generative models as they train, evaluating metrics after every epoch becomes
prohibitively expensive due to long computation times. `torch_fidelity` tackles this problem by making full use of
caching to avoid recomputing common features and per-metric statistics whenever possible.
Computing all metrics for 50000 32x32 generated images and `cifar10-train` takes only 2 min 26 seconds on NVIDIA P100
GPU, compared to >10 min if using original codebases. Thus, computing metrics 20 times over the whole training cycle
makes overall training time just one hour longer.

```python
from torch_fidelity import calculate_metrics

# Each input can be either a string (path to images, registered input), or a Dataset instance
metrics_dict = calculate_metrics(input1, input2, cuda=True, isc=True, fid=True, kid=True, verbose=False)

print(metrics_dict)
# Output:
# {
#     'inception_score_mean': 11.23678,
#     'inception_score_std': 0.09514061,
#     'frechet_inception_distance': 18.12198,
#     'kernel_inception_distance_mean': 0.01369556,
#     'kernel_inception_distance_std': 0.001310059
# }
```

## Advanced Usage and Extensibility

The `fidelity` command takes two positional arguments and a few optional keys (run `fidelity --help` to see reference).
Most of the keys directly correspond to keyword arguments accepted by the `calculate_metrics` function (see
[API](torch_fidelity/metrics.py)).
Each positional argument can be either a path to a directory containing samples, or a _registered input_.
Registered inputs are commonly used datasets, which can be resolved by name, and are subject to caching.
Currently, there are just two registered inputs - `cifar10-train` and `cifar10-val`, however extending them with
other torchvision datasets is straightforward (see [API](torch_fidelity/registry.py), Extensibility).

### Storage, Cache, Datasets

The cached items can occupy quite a lot of space. The default cache root is created under `$ENV_TORCH_HOME/fidelity_cache`,
which is usually under the `$HOME`. Users with limited home partition should use `--cache_root` key to change cache
location, or specify `--no-cache` to disable it (not recommended).

Likewise, torchvision datasets may not be suitable for storage under the home directory (default location is
`$ENV_TORCH_HOME/fidelity_datasets`). It can be changed with the key `--datasets-root`.
If torchvision datasets do not need to be downloaded, it is possible to disable download check using the key
`--datasets-downloaded`.

To save time on recomputations of features and statistics of inputs that do not change often, caching is enabled
on all registered inputs. In addition to that, one can force caching on a path input by assigning a new cache slot name
to such input via `cache_input1_name` or `cache_input2_name` keys, for the first and second positional arguments
respectively.

### Extensibility

#### Add your own feature extractor instead of Inception in three easy steps

1. Subclass a new Feature Extractor (e.g. `NewFeatureExtractor`) from `FeatureExtractorBase` class, implement all
methods,
2. Register it using `register_feature_extractor` method: `register_feature_extractor('new-fe', NewFeatureExtractor)`
3. Pass `feature_extractor='new-fe'` as a keyword argument to `calculate_metrics`.

#### Add a new dataset to the pool of registered inputs in three easy steps

1. Prepare a new `Dataset` subclass (as well as the `Transforms` pipeline) returning items which can be directly fed
into the feature extractor (refer to `Cifar10_RGB` for example),
2. Register it under some new name (`new-ds`):
`register_dataset('new-ds', lambda root, download: NewDataset(root, download))`,
3. Pass the registered input name (`new-ds`) as a positional argument to `calculate_metrics`.

#### Working with Files

If a positional argument is not a Dataset instance or a registered input, it is treated as a directory with images (jpg, png).
To collect files recursively under the provided path, add `--samples-find-deep` command line key, or set
the `samples_find_deep` keyword argument to True.
To change file extensions picked up when traversing the path, specify `--samples-find-ext` command line key or
the `samples_find_ext` keyword argument.
After the files list is collected, it is sorted alpha-numerically, and then shuffled. If shuffling is not desired, it
can be disabled by setting the `--samples-alphanumeric` key or using the `samples_shuffle` keyword argument.

#### Other Options

Both the `fidelity` command and the API provide several options to tweak the default behavior of the evaluation
procedure.
Below is a summary of use cases when changing the defaults is required:

- *Reducing GPU RAM usage*: by default, evaluating `cifar10-train` images with all metrics takes about 2.5 GB of RAM.
If it is desired to reduce memory footprint, use `--batch-size` key to reduce batch size.
It is not possible to go below a certain threshold required to store the feature extractor model (Inception).

- *Changing device placement*: by default, `fidelity` app decides whether to use GPU judging by the `CUDA_VISIBLE_DEVICES`
environment variable of the process. It is possible to override this default behavior by specifying GPU ids with
`--gpu` command line key, or forcing computations to CPU with `--cpu` flag.

- *Verifying reproducibility*: For the sake of reproducibility, all pseudo-random numbers generators are pre-seeded with
the default value of `--rng_seed` command line key.
This affects choosing subsets and splits in metrics and the order of shuffled files from positional arguments.
One may want to change this flag to see the effect of seed on the metrics outputs. However, seeds should be kept fixed
and reported as a part of the evaluation protocol.

- *Changing verbosity*: verbose mode is enabled by default, so both command line and programmatic interfaces report
progress to `stderr`. It can be disabled using the `--silent` command line flag, or `verbose` keyword argument.
However, it is useful to keep it enabled when extending the code with custom input sources or feature extractors,
as it allows to prevent unintended usage of the cache.

## Level of Fidelity

The path from inputs to metrics contains the following steps:
1. Image interpolation (resizing) and normalization (bringing RGB values to the range acceptable by the pre-trained
model),
2. Using the pre-trained model to extract features from properly sized and normalized images,
3. Compute metrics values from the extracted features.

Let's consider how close each of these steps can be implemented in a different framework:

### Interpolation

Bilinear interpolation is a known source of problems with determinism and reproducibility, as there are quite a few ways
to align corners of an image, each giving a different result [[5]](https://machinethink.net/blog/coreml-upsampling/).
The effect of the issue is amplified when going from small to large image sizes, as is the case with evaluating CIFAR10:
32x32 is upsampled to 299x299. `torch_fidelity` provides a custom implementation of bilinear resize function, implemented
exactly as in TensorFlow. The tests show that on CPU this function produces bit-exact results consistent with
TF implementation. However, on GPU the output is epsilon-exact, presumably due to fused-multiply-add floating-point
optimizations employed in gridpoint coordinates computation on the GPU hardware side.

### Pre-trained Model

All three metrics were introduced to evaluate 2D images with Inception V3 as a feature extractor. The architecture
of Inception V3 used in TensorFlow is slightly different from both the paper and what is implemented in
torchvision.
The author of [[4]](https://github.com/mseitzer/pytorch-fid) did the heavy lifting of porting the original architecture
to PyTorch, as well as exporting all learnable parameters into a PyTorch checkpoint. `torch_fidelity` attempts to
download the checkpoint from github. However, it is also possible to perform model conversion locally and load the
checkpoint from a file (see `util_convert_inception_weights.py` and `--feature-extractor-weights-path` command line key).

As indicated by the tests (`test_convolution.py`, `test_inception.py`), the output of the pre-trained TensorFlow model
varies from time to time given the same inputs, which can be fixed using NVIDIA's `tensorflow-determinism` package.
PyTorch uses CuDNN as a backend, and its outputs do not vary even when determinism is disabled. Slight differences
between outputs of TF and PT convolutions exist even with maximum determinism, which does not allow us to claim
bit-exactness. Further troubleshooting reasons for inexact outputs of convolution is complicated by varying behavior
between CPU and GPU, and also between different CPUs.

### Computing metrics from features
This step is usually performed on CPU using a math library like scipy. It is neither the bottleneck of computations,
nor the source of precision loss or non-determinism; `torch_fidelity` uses the original features-to-metric code for this
step in most cases.

### Relative Errors Summary

The tests are performed using fixed pseudo-random subsets of 5000 CIFAR10 images (see [tests/precision](tests/precision)).
Below is a list of pixel-, feature-, or metric-wise relative errors of different steps of the computational
pipeline, between reference implementations and `torch_fidelity`:
- Interpolation: 1e-5
- Convolution: 1e-7
- InceptionV3 RGB 8bpp to pool3 features: 1e-4
- Inception Score: 1e-3
- Fréchet Inception Distance: 1e-6
- Kernel Inception Distance: 1e-6

The badge 'CircleCI: passing' means that the declared tolerances were met during the last test run, involving all the
latest versions of the dependencies.

## Feedback and Citation

* Feedback in the form of comments, tickets, and stars is welcome!
* Citation might be a good idea to reinforce the evaluation protocol, which is necessary for reproducibility. To cite this repository, use the BibTex below:

```
@software{obukhov2020torchfidelity,
    author = {
        Anton Obukhov and
        Maximilian Seitzer and
        Po-Wei Wu and
        Semen Zhydenko and
        Jonathan Kyl and
        Elvis Yu-Jing Lin
    },
    title = {toshas/torch-fidelity: Version 0.2.0},
    month = may,
    year = 2020,
    publisher = {Zenodo},
    version = {v0.2.0},
    doi = {10.5281/zenodo.3786540},
    url = {https://doi.org/10.5281/zenodo.3786540}
}
```

## References and Acknowledgements

Original implementations:
* Inception Score:
  * https://github.com/openai/improved-gan/blob/master/inception_score/model.py
  * https://github.com/bioinf-jku/TTUR/fid.py
  * https://github.com/bioinf-jku/TTUR/blob/master/FIDvsINC/fidutils.py
* Fréchet Inception Distance: https://github.com/bioinf-jku/TTUR/fid.py
* Kernel Inception Distance: https://github.com/mbinkowski/MMD-GAN/blob/master/gan/compute_scores.py

[1] Tim Salimans et al., Improved Techniques for Training GANs, https://arxiv.org/pdf/1606.03498.pdf

[2] Martin Heusel et al., GANs Trained by a Two Time-Scale Update Rule
Converge to a Local Nash Equilibrium, https://arxiv.org/pdf/1706.08500.pdf

[3] Mikołaj Binkowski et al., Demystifying MMD GANs, https://arxiv.org/pdf/1801.01401.pdf

[4] https://github.com/mseitzer/pytorch-fid

[5] https://machinethink.net/blog/coreml-upsampling/

repository: devavratTomar/torch-fidelity

repo_name: devavratTomar/torch-fidelity


text:
# Git Switch (DEPRECATED)

Git Switch is now [Git Swap](https://github.com/randallreedjr/git_swap). Due to git releasing a native switch command, the gem has been renamed.

Git Switch is a command line utility to easily switch between multiple git profiles. It uses a `.gitswitch` YAML file to configure each profile (name, username, and email) and ssh key.

## Prerequisites

This gem has been developed for, and only tested on, Mac OS.

Additionally, it requires git version 2.10+. Run `git --version` to check your currently install version. If you are using homebrew, you can install a newer version of git with `brew upgrade git`.

## Installation

This gem is not intended to be installed via a Gemfile. Instead, install it yourself:

```
$ gem install git_switch
```

If you use rvm, you can save yourself from some headaches by installing git_switch for all gemsets.

```
$ rvm @global do gem install git_switch
```

## Configuration

To run the guided setup, use `git switch --config`.

You may also manually create or edit your configuration at `~/.gitswitch`. The config file is in YAML format. Here is an example.

```
personal:
  username: johnnyfive
  email<EMAIL_ADDRESS>  name: Johnny Smith
  ssh: ~/.ssh/id_rsa
work:
  username: johnsmith
  email<EMAIL_ADDRESS>  name: John Smith
  ssh: ~/.ssh/defmethod_rsa
```

Note that the ssh key must already exist. See these instructions to [generate a new SSH key](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/).

The root keys can be any nickname you want. It should be memorable to make it easy to switch between profiles.

## Usage

Git Switch follows the convention to create a custom git command. It can be invoked as follows, to either set your git profile locally (no flag) or globally (`-g`):

```
$ git switch personal
$ git switch personal -g
```

Note that currently, invoking `git switch` will remove all identities from `ssh-add`, except the one specified. You can always readd them using `ssh-add path/to/ssh`.

### Flags

* Use `-l` or `--list` to list configured profiles
```
git switch -l
```

* Use `-v` or `--verbose` to print more detailed output
```
git switch personal -v
```

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

branch_name: refs/heads/develop

gha_language: Ruby


text:
# AmzSpApi::ShippingApiModel::Address

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | The name of the person, business or institution at that address. |
**address_line1** | **String** | First line of that address. |
**address_line2** | **String** | Additional address information, if required. | [optional]
**address_line3** | **String** | Additional address information, if required. | [optional]
**state_or_region** | [**StateOrRegion**](StateOrRegion.md) |  |
**city** | [**City**](City.md) |  |
**country_code** | [**CountryCode**](CountryCode.md) |  |
**postal_code** | [**PostalCode**](PostalCode.md) |  |
**email** | **String** | The email address of the contact associated with the address. | [optional]
**copy_emails** | **Array<String>** | The email cc addresses of the contact associated with the address. | [optional]
**phone_number** | **String** | The phone number of the person, business or institution located at that address. | [optional]


text:
---
layout: default
title: Questions & answers
---

<style>
  h2 { font-size: 1em; opacity: 0.6; margin-bottom: 0.3em; }
  h2 + p { margin-top: 0em; }
</style>

## How do you preferred to be called?

**M**u-**A**n, or muan (only as a username, _never_ capitalized).

## How is your name pronounced?

<audio src="/assets/name.m4a" controls></audio>

## What are your pronouns?

She/her/她/妳.

## Where are you from?

I am from Taipei, Taiwan.

repository: muan/site

repo_name: muan/site


text:
# makeTheBotOnline  !

Launch a minimal python script to take your Discord Bot always online. The idea came with the extension [Discord-Sync](https://hanashi.dev/filebase/file/1-discord-sync/) for the [Woltlab Suite](https://www.woltlab.com/) by [Hanashi](https://github.com/Hanashi). With this extension you can synchronize your Woltlab Suite user groups with the user groups of Discord. But it should also work with any other bot.

## ❗ Requirements

 - [Docker](https://docs.docker.com/get-docker/) installed
 - You need a Bot Token ([Create a Bot](https://discord.com/developers/applications))

## 📦 What's inside

 - Modified Script from [@TitusKirch](https://github.com/TitusKirch)

## 🚀 How to use

Create a Discord bot and obtain a BOT-TOKEN! Not the Client Secret!

Then create the Container with:

    docker create \
      --name=discordbotonline \
      --env 'GAMENAME=Visit KeinNerd.net' \
      --env 'DISCORDTOKEN=YOURDISCORDBOTTOKEN' \
      --restart unless-stopped \
    keinnerd/makethebotonline:latest

## 🔧 Envs

`GAMENAME` = It show what the Bot "plays" - e.g. your Website

`DISCORDTOKEN` = The Bot-Token for your Bot

## 🚨 Support

Create a Github Issue or visit our Website!

## 🙏 Contribution

This are my first steps with creating dockerimages so any contribution to expand my knowledge is welcome !

## 📖 License
This project is under the [MIT License](https://choosealicense.com/licenses/mit/).

repository: fistwho/makeTheBotOnline

repo_name: fistwho/makeTheBotOnline


text:
---
layout: post
title: "A Provable Defense for Deep Residual Networks"
date: 2019-03-29 13:35:31
categories: arXiv_AI
tags: arXiv_AI
author: Matthew Mirman, Gagandeep Singh, Martin Vechev
mathjax: true
---

* content
{:toc}

##### Abstract
We present a training system, which can provably defend significantly larger neural networks than previously possible, including ResNet-34 and DenseNet-100. Our approach is based on differentiable abstract interpretation and introduces two novel concepts: (i) abstract layers for fine-tuning the precision and scalability of the abstraction, (ii) a flexible domain specific language (DSL) for describing training objectives that combine abstract and concrete losses with arbitrary specifications. Our training method is implemented in the DiffAI system.

##### Abstract (translated by Google)

##### URL
[http://arxiv.org/abs/1903.12519](http://arxiv.org/abs/1903.12519)

##### PDF
[http://arxiv.org/pdf/1903.12519](http://arxiv.org/pdf/1903.12519)


text:
---
title: "Mould Rush"
abstract: "Game Based on Real-Time Microbial Growth"
student: "r-s-kim"
year: "2018"
image: "./mould-rush.png"
---
Mould Rush a slow, online multiplayer game, played over several days. As the microbes grow and propagate, their growth patterns are live-streamed onto Mould Rush Game Channel on Twitch.tv, where the gameplay takes place. Every game, or ‘campaign’, is played in a completely unique landscape, formed by a seemingly-random nature in which microbial communities form and interact with each other. They help us to immerse ourselves in an alternative or parallel world, not shaped by computer simulations, but by real microbial jungles, grown by the tangible biological processes.


text:
# Buy-Fi: buy headphones at the best price!

## Install

Prerequisites:

1. Install or gain access to a **MongoDB** instance

2. Install or gain access to a **ElasticSearch** instance
3. Register at https://1forge.com/forex-data-api for a free account that has an API key to access their currency exchange service

Note: Set up firewall rules so only your application can access them.

Then download the source code, and run the following:
```sh
$ cd backend
$ npm install
$ cd ../frontend
$ npm install
```

## Basic usage

Change settings in **backend/config.ts** and **frontend/src/config.ts** so that service ports, endpoints, password and API key are populated according to your server environment.

For frontend, copy the folder inside **vendor-fix/** into **node-modules/** to apply fix for ngx-charts **before building the application**.

 Then run

```sh
$ cd backend
$ npm run build
$ cd ../frontend
$ npm run build --prod
```
to compile the backend and frontend.
### Backend
To index entire Head-Fi for the first time, run:
```sh
$ npm run crawl
```
After which run a crawl service that will keep updating the data at 1 minute intervals by pulling the front-page.
```sh
$ npm run crawl-service
```
And run a data service that supports the frontend queries
```sh
$ npm run data-service
```
### Frontend
Upload and serve the static files generated under **/dist**

repository: VolatileBit/buy-fi

repo_name: VolatileBit/buy-fi


text:
# Concourse - Pipelines

These pipelines depends on the following secrets defined in a Concourse integrated CredHub or Vault:
 - /concourse/`team name`/s3-access-key
 - /concourse/`team name`/s3-secret-key
 - /concourse/`team name`/s3-endpoint
 - /concourse/`team name`/github-access-token
 - /concourse/`team name`/harbor-host
 - /concourse/`team name`/harbor-user.username
 - /concourse/`team name`/harbor-user.password
 - /concourse/`team name`/vro-deploy-hosts
 - /concourse/`team name`/vro-deploy-user.username
 - /concourse/`team name`/vro-deploy-user.password
`team name` is typically main

Most of these pipelines depend on a docker container that is ready to execute maven for creating orchestrator .package files.  See https://github.com/dlinsley/docker-o11n-maven for details on creating one.

## Build packages

This concourse pipeline:
 - Tracks a build version in an S3 compatible object store
 - Tracks changes on master branch of this repo
 - Builds .package files
 - Creates a github release with the compiled .package files.
 - Tags the release as pre-release with a version number

The pipeline is defined by [build_pipeline.yml](build_pipeline.yml)

 Add or update it on your concourse using:
 ``` bash
 ./00_set-build-pipeline.sh
 ```

## Push Packages

This concourse pipeline:
 - Watches for any new `released` github release at (https://github.com/dlinsley/o11n-package-vrocontrolcenter/releases)
 - Pushes the .package files from the github release to one or more vRO instances

The pipeline is defined by [push_pipeline.yml](push_pipeline.yml)

 Add or update it on your concourse using:
 ``` bash
 ./00_set-push-pipeline.sh
 ```

## Build and Push Packages

This pipeline is useful if your team is not able to use github releases for artifact management.

This concourse pipeline:
 - Tracks a build version in an S3 compatible object store
 - Tracks changes on master branch of this repo
 - Builds .package files
 - Pushes the .package files to one or more vRO instances.

The pipeline is defined by [build_and_push_pipeline.yml](build_and_push_pipeline.yml)

 Add or update it on your concourse using:
 ``` bash
 ./00_set-build-push-pipeline.sh
 ```


text:
### [CVE-2019-13275](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-13275)
![](https://img.shields.io/static/v1?label=Product&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Vulnerability&message=n%2Fa&color=brighgreen)

### Description

An issue was discovered in the VeronaLabs wp-statistics plugin before 12.6.7 for WordPress. The v1/hit endpoint of the API, when the non-default "use cache plugin" setting is enabled, is vulnerable to unauthenticated blind SQL Injection.

### POC

#### Reference
- https://wpvulndb.com/vulnerabilities/9412

#### Github
- https://github.com/ARPSyndicate/cvemon
- https://github.com/superlink996/chunqiuyunjingbachang

repository: trickest/cve

repo_name: trickest/cve


text:
---
title: What is venture capital?
author: admin
type: post
date: 2018-07-20T17:46:32+00:00
thumbnail: /wp-content/uploads/2018/07/venture-capital.jpeg
timeline_notification:
  -<PHONE_NUMBER>
publicize_twitter_user:
  - Sandhyasthought
categories:
  - My rantings

---

Hello, Everyone, it has been a long time since my last post, and it is the usual excuse of the same old story aka the kids, husband and other familial responsibilities. So lets jump right into the topic and I am writing about Venture Capital.

Venture Capital is a funding process for Start-ups and the small businesses to spearhead their projects without any financial obstacles. Venture capital is the funding provided by a private person also known as Venture Capitalists. Private institutional firms can also provide Venture Capital. The Venture capital comes with high risk as well as the high chance of earning significant returns.

Venture Capital can also be termed as the financial helpline for the companies or start-ups who have a brilliant product but, not enough resources. Venture capital cases are more commonly found in the field of software and intellectual properties.

The financing can happen in these three stages of a business cycle:

  1. Early stage financing
  2. Expansion financing
  3. Acquisition financing

Early stage financing occurs when the during the conception of the product’s conception or idea generation. It usually needs a low budget. This stage also doubles up as a seeding phase.

The Expansion financing involves operational stage viz the production process, marketing, and development of Research and Design(R&D).

The Acquisition financing is for businesses who are short of funds for buying another company.

**What are the features of Venture Capital?**

  * It comes with high risk as there is the option of flunking out.
  * There is no liquidity until the business takes off
  * It has a long-time horizon for realizing the true potential of the idea.
  * The Venture Capitalist will require equity participation and capital gains.
  * Innovative and out of the box products attract Venture capitalists.
  * Venture capitalists are part of the management.

**The steps of Venture Capital:**

It usually involves four stages:

  1. **Idea generation:**

A well-detailed business plan has to be presented by the owner or the entrepreneur to Venture Capitalist. The business plan should include the summary of the proposal, the opportunities of product, the size of the market, financial projections and the details of management.

    Introductory phase:

Just two people are getting to know each other, but it is purely business.

    Due Diligence:

This is Frequently Asked Question stage where the VC’s clear their doubts.

    The Agreement:

Basically, an agreement that says the VC’s are ready to fund the project by abiding the conditions that both parties agree on.

**Types of Venture Capital funding:**

  1. Seed money: Funding for idea generation and proving its credibility.
  2. Start-ups: Marketing and product development expenses
  3. First –Stage: Manufacturing and early sales support
  4. Second-Round: Operational capital to generate profits
  5. Third-Round: Funds for the expanding the new beneficial company. It is also known as the “Mezzanine financing.”
  6. Fourth-Round: It is the “ Going Public” process and known as “ Calledbridge financing.”

The Venture Capitalist also have an “Exit Route.” where they can cash in their investment from the following methods:

  1. Initial Public Offering
  2. Buyback of the shares
  3. Merging and Acquisition
  4. Selling off the company to another investor.

So, this is a general markup of the Venture capital and its process. Feel free to add any points I might have missed. Bye till my next post.

repository: Sandhya-byte/the-content-startup

gha_language: CSS

repo_name: Sandhya-byte/the-content-startup


text:
# Gissues

Use [Mac OSX User Notifications](https://support.apple.com/en-gb/HT204079) to display banners for GitHub issues.

![notification](/GitHub/docs/images/github-notification.png?raw=true)

This was a feature of the [GitHub app](https://mac.github.com/) but it was removed due to it [being "kind of half-backed"][1].

Installation
------------

1. Copy script to ~/bin or /usr/local/bin
2. Install [terminal-notifier](https://github.com/alloy/terminal-notifier) using `brew install terminal-notifier`
3. Install the [GitHub app](https://mac.github.com/) to make issues appear in the GitHub app group
4. Create a [GitHub Personal access token](https://github.com/settings/tokens)
5. Add an entry to crontab to run the script on a schedule using `crontab -e`

```
0 10,11,12,14,15,16 * * 1-5 GITHUB_API_KEY=45bd2f509e7e25d806011a5b3503bafb7example /usr/local/bin/gissues.py

```

[1]: https://github.com/blog/1287-github-for-mac-notifications

repository: satterly/tools

gha_language: Python

repo_name: satterly/tools


text:
# RecyclerViewScrollRestorationDemo
This demo demonstrates the behaviour of saving the scroll position of recyclerview when rotated..etc

Here's the companion blog post which goes over this in more detail

https://anirudhuppunda.in/2020/05/Restoring-recyclerview-scroll-position

`ALLOW` on sync operation  |  `ALLOW` on async operation | `PREVENT_WHEN_EMPTY`
:-------------------------:|:-------------------------:|:----------------------
![](https://github.com/AnirudhBhat/RecyclerViewScrollRestorationDemo/blob/master/gifs/allow_demo.gif)  |  ![](https://github.com/AnirudhBhat/RecyclerViewScrollRestorationDemo/blob/master/gifs/prevent_async_demo.gif) | ![](https://github.com/AnirudhBhat/RecyclerViewScrollRestorationDemo/blob/master/gifs/prevent_when_empty_demo.gif)


text:
# Disallow files with a path matching a specific regexp (`square/no-restricted-files`)

<!-- end auto-generated rule header -->

This rule can be used to disallow files at certain file paths.

## Examples

Example `.eslintrc.js` using the rule's `paths` option for matching files based on a regexp pattern:

```js
module.exports = {
  rules: {
    'square/no-restricted-files': [
      'error',
      {
        paths: ['app/components/[^/]+$'],
        message: 'Use a nested scope instead of adding new components to the top-level components folder.',
      },
    ]
  }
};
```

Example `.eslintrc.js` using ESLint's built-in [overrides feature](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#configuration-based-on-glob-patterns) for matching files based on a glob pattern:

```js
module.exports = {
  overrides: [
    {
      files: ['bad/place/to/add/js/files/**/*.js'],
      rules: {
        'square/no-restricted-files': ['error', [{ message: 'Do not add JS files here for x reason.' }]],
      },
    },
  ],
};
```

## Configuration

- object[] -- containing the following properties:
  - string[] -- `paths` -- optional list of regexp file paths to disallow (if you want to use glob patterns, use ESLint's built-in [glob pattern overrides feature](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#configuration-based-on-glob-patterns) instead of this)
  - string -- `message` -- optional custom error message to display for these disallowed file paths

## Migration

There's an autofixer in the rule implementation that can be uncommented as desired.

repository: square/eslint-plugin-square

repo_name: square/eslint-plugin-square


text:
# lambda
Testing AWS Lambda
* You need Ubuntu 16.04 64 bit, better to create from EC2.
```bash
git clone https://github.com/wasit7/lambda.git
cd lambda
source init.sh
```
* get the lambda.zip and uplaod to AWS Lambda
- set configuration>>Handler>>main.myfunction

# demo
https://a5jbw0mcc3.execute-api.us-east-1.amazonaws.com/prod/hello

# note
pscp -i key.ppk ubuntu@<IP_ADDRESS>:/home/ubuntu/lambda.zip lambda.zip

# references
https://www.youtube.com/watch?v=fSUEk6iMW88
http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example-deployment-pkg.html#with-s3-example-deployment-pkg-python


text:
```
##################################################
#    .___      __    _____.__.__                 #
#  __| _/_____/  |__/ ____\__|  |   ____   ______#
# / __ |/  _ \   __\   __\|  |  | _/ __ \ /  ___/#
#/ /_/ (  <_> )  |  |  |  |  |  |_\  ___/ \___ \ #
#\____ |\____/|__|  |__|  |__|____/\___  >____  >#
#     \/                               \/     \/ #
#                                                #
# about: custom . files                          #
# author: Josh Price                             #
#                                                #
##################################################
```

Dotfiles
========
Based off [Dotphiles][1] see that repo for more info. I soon plan to switch to using Ansible to manage them. Maybe.

Installation
------------
Run dotsync `./.dotfiles/dotsync/bin/dotsync -L`

Configuration
-------------

See the documentation for [dotsync][2] for more information.

Backups
-------------
Any existing ~/.dotfiles will be backed up into `~/.backup/dotfiles/` if found

Oh-My-ZSH Theme Fix
-------------
This is only required if you use the trapd00r theme. Otherwise skip.

The theme I use requires some extra steps in order to work. Just follow the following:

```
cd ~/bin # assume that your ~/bin exists and is in your $PATH
wget https://raw.githubusercontent.com/trapd00r/utils/master/zsh_path
chmod +x zsh_path

cd /tmp
wget http://search.cpan.org/CPAN/authors/id/W/WO/WOLDRICH/Term-ExtendedColor-0.224.tar.gz
tar xvzf Term-ExtendedColor*.tar.gz
cd Term-ExtendedColor*
perl Makefile.PL  # assuming you have perl-Makefile-Parser installed on your box
make
sudo make install
```

Credits
-------------

*[Conky](https://github.com/alexbel/conky)
*If I "stole" something from you and left you out please open an issue.

Contribute
------------
Feel free to fork and send Pull Requests.

[License](http://jprice.mit-license.org/)
-------

Copyright (c) 2016
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

[1]: https://github.com/dotphiles/dotphiles
[2]: https://github.com/dotphiles/dotsync

repository: jprice/dotfiles

repo_name: jprice/dotfiles


text:
---
layout: engineering-education
status: publish
published: true
url: /engineering-education/understanding-differential-privacy/
title: Understanding Differential Privacy
description: Introduction to differential privacy and methods used to preserve privacy in databases and how it is used with machine learning, and deep learning.
author: srishilesh-p-s
date: 2020-10-15T00:00:00-08:00
topics: [Security]
excerpt_separator: <!--more-->
images:
  - url: /engineering-education/understanding-differential-privacy/hero.png
    alt: Understanding Differential Privacy
---
In this article, we will get an overview on resolving the privacy issue using differential privacy. You will understand the basics on how privacy is preserved in databases, used with machine learning, and deep learning. Although understanding differential privacy requires a mathematical background, this article will cover a very basic overview of the concepts. We will also be coding a sample database and check if it is differentially private or not.
<!--more-->

### Table of contents
- [Introduction](#introduction)
- [Differential Privacy](#differential-privacy)
- [Differencing attacks](#differencing-attacks)
- [Implementing differential privacy](#implementing-differential-privacy)
- [Types of Differential privacy](#types-of-differential-privacy)
- [Conclusion](#conclusion)
- [Further reading](#further-reading)

### Introduction
In this digital era, most companies are data-driven. Our data is harvested to help keep growing their economic incentives, in exchange for services provided to us. Research institutions often use and share data containing confidential information about individuals. Improper disclosure of such data can have adverse consequences for a data subject’s private information, or even lead to civil liability or [bodily harm](https://tinyurl.com/y37fnb94) related to [physical or mental health](https://fas.org/sgp/crs/misc/R45631.pdf).

In the late 2000s, Netflix ran a competition for building a recommendation system. To build it, they released a large dataset by anonymizing the data which didn’t leak the movie names or users' ratings. Two professors from the University of Texas [de-anonymized](https://www.cs.utexas.edu/~shmat/shmat_oak08netflix.pdf) them completely by comparing them with IMDB ratings, thus revealing the personal information about the dataset. This a great example of how data privacy has been compromised! Similarly, one such [data breach of health records happened in 1997](https://onlinelibrary.wiley.com/doi/abs/10.1111/j.1748-720X.1997.tb01885.x), where medical records of the governor of Massachusetts were identified by matching anonymized medical encounter data with voter registration records.

This sort of data leakage is very alarming to both the users as well as organizations. To resolve this, we can either completely randomize the way the data is sent, using keys that are only decipherable at either end (Differential Learning). An alternative, being [federated learning](https://en.wikipedia.org/wiki/Federated_learning), where we bring the model to the data instead of or vice-versa. For the scope of this article, we will mainly focus on the concept of differential privacy to check for leakage in data.

### Differential Privacy

#### Former definition
*Anything that can be learned from a statistical database can be learned without accessing the database*

This definition does not hold. We need to consider two things, the first is people and the second is data. We need to protect people's rights while (correctly predicting) using their data. In certain cases, the whole database must be kept private, to protect the information, because there are chances of data leaks.

#### Modern definition
*It’s a promise made by a data holder to a data subject, that “You will not be affected, adversely or otherwise, by allowing your data to be used for study analysis, no matter what other studies, datasets or information is available” - Cynthia Dwork (Godfather of Differential Privacy)*

A simpler way to understand this modern definition is to go over an example:

Assume, we have a small database of 5000 entries with 0 or 1 as a value for each row, specifying certain property like 'people with cancer' as 1, and 'people without cancer' as 0. So, here our goal would be "Even if we removed detail of 1 person, the query of the database must not change” then the privacy of the information is protected. We will see its implementation very shortly.

![Differential Privacy working](/engineering-education/understanding-differential-privacy/differential_privacy.png)

[Image source](https://www.winton.com/research/using-differential-privacy-to-protect-personal-data)

### Differencing attacks
To continue with the previous explanation, let's say we want to check if privacy has been preserved for every individual in the database, what we can do is:

- Find the sum of all the values before removal of 1 persons' data (the original values)
- Then find the sum of all values after removing that person (a new database with 1 missing value)
- On finding the difference between both the summations, we get the exact detail of that person
thus we will know if he/she has cancer or not. This shows that the privacy of that individual has been leaked. This is one of the simplest differencing attacks, using a summation query.

Similarly, there are other types of differencing attacks using various other functions like `mean()`, `median()`, and so on. This measure of how much data is leaked through a query can be measured with **sensitivity** (evaluation of privacy leakage is measured in terms of `sensitivity`). In simple terms, it can be said as the largest possible difference for that one row, for any dataset. For our example, the sensitivity is 1, which means that adding or removing a single row from the dataset will change the count by at most 1.

### Implementing differential privacy
Now, we are going to implement differential privacy for a simple database query using a summation differencing attack. The database has only 1 column with Boolean types. The Boolean type denotes if a person possesses some private attribute or not (for example, if a person has a particular disease or not). And, we are going to learn, if the database is differentially private or not.

#### Creating a database
Create a simple database containing 5000 entries consisting of values 0s and 1s. Here, we randomly generate binary values using `random.choice()`

```python
  import random

  # the number of entries in our database
  num_entries = 5000

  original_database = [] # The original database containing 0s and 1s

  for i in range(num_entries):
    original_database.append(random.choice([0,1])) # Generate random number from choice of 0 and 1

  print(original_database)
```

**Output:**

```bash
Out[0]: [1, 1, 0, 0, 1, .., 0, 1, 1]
```

To demonstrate differential privacy, we try to manually omit certain values from the database, and check if privacy is still preserved or not. So, we create a method to accept `remove_index` as an argument and remove it from the database.

```python
  def create_database_with_missing_value(database,remove_index):
    database_before = database[0:remove_index] # List slicing till remove_index (0, remove_index)
    database_after = database[remove_index+1:] # List slicing after remove_index (remove_index + 1, len(original_database))
    return database_before + database_after # Concatenating both the lists

  create_database_with_missing_value(original_database, 3) # A sample output on removal of 3rd index
```

**Output:**

```bash
Out[1]: [ 1, 1, 0, 1, 0..., 0, 0, 0]
```

Now, we create a set of such databases (parallel databases), where index `i` is removed from each of the databases.

```python
  def create_set_of_databases(database):
    databases = list() # Contains lists of list - A set of databases

    for i in range(len(database)):
      new_database = create_database_with_missing_value(database,i) # Create a database after removing index i from it
      databases.append(new_database) # Append the new database to the list of databases

    return databases

  print(create_set_of_databases(original_database))
```

**Output:**

```bash
Out[2]: [[ 1, 1, 1, 0, 1, 1, 1, 1, 1, ...., 0, 0, 1, 0, 0, 1, 1, 0, 0, 0],
        [ 1, 1, 1, 0, 1, 1, 1, 1, 1, ...., 0, 0, 1, 0, 0, 1, 1, 0, 0, 0],
        [ 1, 1, 1, 0, 1, 1, 1, 1, 1, ...., 0, 0, 1, 0, 0, 1, 1, 0, 0, 0],
        .................
        [ 1, 1, 1, 0, 1, 1, 1, 1, 1, ...., 0, 0, 1, 0, 0, 1, 1, 0, 0, 0]]
```

Next, we create a set of databases based on the users' input. Modularizing the previous snippets as `create_database(num_entries)`

```python
  def create_databases(num_entries):

    original_database = [] # A list containing binary values
    for i in range(num_entries):
      original_database.append(random.choice([0,1])) # Generate random choices and append to the list

    databases = get_set_of_databases(original_database) # Create a set of databases, having 1 missing value in each

    return original_database, databases

  original_database, databases = create_set_of_databases(5000) # Create 5000 different set of databases with each database having 1 missing value
```

#### Evaluating differential privacy of a function
Seeing as we have created a sample database for demonstration of differential privacy. We should now be able to query the information and check if the query leaks private information or not.

As we mentioned before, the evaluation of privacy leakage is measured in terms of `sensitivity`. On iterating through each row of the database, we measure the difference in the output of the query.

Finding the mean and sum of all values in the original database (without removing values)

```python
  # A query to find the mean of values in each of the databases
  def query_mean(db):
      return sum(db)/len(db)

  # A query to find the sum of values in each of the databases
  def query_sum(db):
    return sum(db)

  full_db_result = query_mean(db) # Store the mean
  print(full_db_result)
```

**Output:**

```bash
Out[3]: 0.5130
```

Performing the query for all values in the new database (each containing 1 missing value)

```python
  def sensitivity(query,num_entries):
    original_db,dbs = create_db_and_parallels(num_entries)
    sensitive = 0 # Assume there is no leakage

    full_db_result = query_mean(original_db) # Query each new database

    for db in dbs:
      db_distance = abs(query_mean(db) - full_db_result) # Compare the new database with original database

    if(db_distance > sensitive):
      sensitive = db_distance # Measure if privacy has been leaked

    return sensitive
```

Now, let us compare how sensitivity varies for different differential attacks queries.

```python
  print('Sensitivity using Sum query:', sensitivity(query_sum, 5000))
  print('Sensitivity using Mean query: ', sensitivity(query_mean, 5000))
```

**Output:**

```bash
Out[4]: Sensitivity using Sum query: 1
Sensitivity using Mean query: 0.00010106021204242532
```

This demonstrates that the new set of databases containing 1 missing value in each of the databases has leaked information about the missing value. Thus, we can conclude that the privacy of that person has been leaked. The lower the value of sensitivity shows less privacy leakage.

Now, let's look at how the leakage can be resolved.

### Types of differential privacy
Database administrators have all the rights to query anything from the database, but what if we don't give our valid data in the database. Even if the administrators run a query to find any leakage, they won't be able to find out if the data is valid or not. That leads us to the next idea of adding noise to the inputs.

#### 1) Local differential privacy
- With this method, users share their data and add it to the database. It is more secure, but in case the database administrators, not as trustworthy.
- Adding noise before appending to the database.

#### 2) Global differential privacy
- With this method, the database administrator adds noise to the information that he/she has in the database. If the database administrator is not trustworthy, there are chances of privacy leakage.
- Adding noise before extracting the information from the database

- A *trusted curator* is the owner of the database upon which the global differential privacy is applied. They are trusted to apply differential privacy correctly.

![Local & Global differential privacy](/engineering-education/understanding-differential-privacy/local_global_privacy.png)

[Image source](https://www.accessnow.org/understanding-differential-privacy-matters-digital-rights/)

#### 3) Randomized response
This is a technique used in social sciences when trying to learn about the high-level trends for taboo behavior.

Let's understand this by performing a social(thought) experiment.

Imagine, we are conducting research in our neighborhood, to find out how many people have jaywalked before. So, we decide to ask every person in our neighborhood, if they had jaywalked before, and they must reply with a binary answer (yes/no). Since they may not tell us the truth, we can follow the steps below.

- Flip a coin two times
- If the first coin flips heads, we assume they answered honestly to the yes/no question
- If the first coin flips tails, we record the answer according to the second flip

Some people do not wish to disclose their private information to the public, therefore the questions posted by the social scientist must be formatted as such that the people are forced to answer the question honestly.

This is known as [**plausible deniability,**](https://en.wikipedia.org/wiki/Plausible_deniability#:~:text=Plausible%20deniability%20is%20the%20ability,confirm%20their%20participation%2C%20even%20if) it is a condition in which a subject can safely and believably deny knowledge of any particular truth that may exist because the subject is deliberately made unaware of said truth to benefit or shield the subject from any responsibility associated with the knowledge of such truth.

Below we have a code snippet that shows the implementation of plausible deniability:

```python
import torch # For installation, refer to this https://anaconda.org/pytorch/pytorch

# Number of entries in the sample database
num_entries = 5000
# Generating random numbers
db = torch.rand(num_entries) > 0.5

def query(db):
  true_result = torch.mean(db.float())
  # Mean on the original database
  first_flip_coin = (torch.rand(0,len(db)) > 0.5).float()
  # Finding the first coin flip
  second_flip_coin = (torch.rand(0,len(db)) > 0.5).float()
  # Finding the second coin flip
  augmented_database = db.float() * first_flip_coin + (1 - first_flip_coin) * second_flip_coin
  # Removing the skew in the second coin flip
  db_result = torch.mean(augmented_database.float()) * 2 -0.5
  return db_result,true_result

db,_ = create_databases(5000)
db = torch.Tensor(db)
private_result,true_result = query(db)
print("With Noise: ",private_result)
print("Without Noise: ",true_result)
```

**Output:**

```bash
Out[5]: With Noise:  tensor(0.4880)
Without Noise:  tensor(0.4892)
```

The code above shows a demonstration of how randomized response noise can be added to perform plausible deniability. On adding noise, we can reduce the sensitivity of the query (reducing the data leakage).

> Differential privacy always requires some noise added to the queries to protect from differential attacks

### Differential privacy in real life
#### 1) Google and Apple
Tech giants like Google and Apple use it in every one of their services. For example, they collect your web searches or purchase history to improve the recommendations they give.

#### 2) Hospitals
Hospitals collect personal data from several patients. Now, let's say we decide to predict if a person has diabetes based on symptoms that other patients had. We must ensure that we must never leak information about any patient while working on our prediction models.

There are several such use-cases, where differential privacy is used. In the near future, we will find  more use case like these everywhere.

### Conclusion
We had an overview of what differential privacy is, and its importance in helping us preserve privacy. This blog serves only as an introduction to differential privacy, more about it can be found in the referenced articles below. To best understand the concepts, we must try implementing them, [this link](https://github.com/udacity/private-ai/blob/master/completed) would be a good starting point.

To summarize:
- We learned the importance of privacy.
- We learned what differential privacy is.
- We implemented privacy leakage in databases, to prove the need for differential privacy.
- We studied various methods to resolve data leakages.
- We went over a few use-cases of differential privacy.

### Further reading
- [https://arxiv.org/abs/1910.02578](https://arxiv.org/abs/1910.02578)
- [https://arxiv.org/abs/1911.00222](https://arxiv.org/abs/1911.00222)
- [https://medium.com/sap-machine-learning-research/client-sided-differential-privacy-preserving-federated-learning-1fab5242d31b](https://medium.com/sap-machine-learning-research/client-sided-differential-privacy-preserving-federated-learning-1fab5242d31b)
- [https://www.comparitech.com/blog/information-security/federated-learning/](https://www.comparitech.com/blog/information-security/federated-learning/)
- [https://towardsdatascience.com/ai-differential-privacy-and-federated-learning-523146d46b85](https://towardsdatascience.com/ai-differential-privacy-and-federated-learning-523146d46b85)
- [https://blog.cryptographyengineering.com/2016/06/15/what-is-differential-privacy/](https://blog.cryptographyengineering.com/2016/06/15/what-is-differential-privacy/)

---
Peer Review Contributions by [Saiharsha Balasubramaniam](/engineering-education/authors/saiharsha-balasubramaniam/)

repository: mwanikialex/engineering-education

repo_name: mwanikialex/engineering-education


text:
---
layout: post
author: Ajay M
title: Basics of Statistics for machine learning
date: 2020-07-23T11:48:30.197Z
thumbnail: /assets/img/posts/code.jpg
category: Statistics
summary: Basics of Statistics
---
STATISTICS

Statistics plays a very crucial part in understanding the data. It was developed in the 17th to 19th centuries. Challenges in the areas of data analysis and organisation have been given a scope due to the statistical influence in data science. Vast amounts of data is being generated and it is the job of the researcher to make sense of the data. It helps us understand the main question “What does the data tell?”

Statistics can be divided into three categories:
1.	Descriptive statistics: The statistical measures that help describe the data. Often used to present the results.
2.	Inferential Statistics: The statistics that uses the descriptive measures to infer the data and patterns related.
3.	Predictive Statistics: The statists that help predict the event based on the inferences from the inferential and the descriptive statistics.

Main terminologies in statistics:
1.	Population: The complete set of observations that belong in the study based on the criteria chosen.
e.g. People who smoke in Hyderabad of age 20
It includes all people with age 20 and from Hyderabad and they smoke.

2.	Sample: The part of a population which has been extracted or selected such that it represents the population that is it follows the same criteria as the population. It is usually selected through different means as selecting the entire population is computationally impossible.
e.g. From the same example from population where criteria are people of age 20 from Hyderabad who smoke.
In this we select a part of population of about let’s say 20000 people who are of age 20, from Hyderabad and smoke.

3.	Parameter:  The characteristics of a population are called parameter.
e.g. mean of population is denoted as “μ “
     standard deviation is denoted as “σ “

4.	Statistic: The characteristics of a sample are called statistic.
e.g. mean of a sample is denoted as “x̄”
     standard deviation is denoted as “s”

5.	Variable: A temporary storage where we can store the values.
e.g. x = 5 here, x is called the variable.

6.	Experiment: The activity which has a result is called an experiment or survey.
e.g. tossing a coin has a result of head or tail.
The tossing is called the experiment.

7.	Outcome: The result of an experiment is called as an outcome.
e.g. When a coin is tossed, and we get a head.
The head is the outcome of the experiment.

8.	Frequency:  The count of the number of observations in that category or the interval.

9.	Outliers: The values that are inconsistent with data are called outliers.
e.g. if manual labour earns between 10 and 50 maxima but can never earn more than it, but a data shows a person with 1000 as the income that is said to be an outlier.

10.	Extreme Values: The value that are very low or very high are called extreme values. They are not actually outliers as they stay consistent with the remaining part of the data.
e.g.  if any manual labour earns anywhere between 10 to 50 in general. But a person earns 55 then it would be an extreme value.

Sampling Methods

The methods used to select the data from the population.
A sample frame is the elements belonging to a population from which we are extracting the sample.
A sample design is the procedure we use to select the elements from the sample frame.
The selection methods can be of two different types in general:
1.	Probabilistic sampling
The sampling where each observation has an equal probability of selection.
2.	Non-probabilistic sampling
The sampling where observations do not share an equal probability of being a part of the sample.

Probabilistic Sampling
The sampling methods can be further classified into
1.	Simple Random Sampling
In this method of sampling, we randomly select the sample without any procedure associated to the selection.
Advantages: very easy, highly random.
Disadvantages: might not be a right representation of population.

2.	Systematic Sampling
In this method of sampling, we select the sample using a system. Like selection at regular intervals.
e.g. selecting every 10th element in the data.
Advantages: easy, efficient
Disadvantages: if any underlying pattern (cycle or repetitive) exists, it will not be a good method as it will be biased.
For instance, if every 10th observation has diabetes then all the sample will be of diabetic people.

3.	Stratified Sampling
This method first groups the data into strata based on similar characteristics. From each stratum randomly data is selected.
Advantages: reduction in bias.
Disadvantages: prior knowledge in creating the strata.

4.	Quota Sampling
An extension of stratified sampling. It divides the data into strata. Then from each stratum it selects the data in such a proportion as the strata is to the population.
Also called Proportional sampling
e.g. Maths, Science, Social have 30%, 45% and 25% in the population.
From the 3 strata created, of maths 30% is selected, of science 45% and of social 25%.

5.	Cluster Sampling
This method is also an extension of stratified sampling. After the strata is created, it selects samples from only few strata but not all of them.
Advantages: efficiency,
Disadvantages: Sampling and bias errors

TYPES OF DATA
The data can be numerical or categorical in general.

Quantitative (Numerical): The data which is numerical in nature is called as quantitative data. It can be again categorised into discrete and continuous.
Discrete: When the data can take only integer forms. For instance, the count of people born on a day. It cannot be decimal and is finite.
Continuous: The data which can take any value between the interval. For instance, height of a person can lie anywhere in an interval.

Qualitative (Categorical): The data which is in the form of levels is called as qualitative data.
Nominal: The data which do not have an order associated to them. It can be binomial or multinomial.
Binomial is when there are only two categories in the data.
e.g. True/False, 0/1, male/female
Multinomial is when there are more than two categories in the data.
e.g. petrol/ diesel/ gas
Ordinal: The data with categories where the categories have an order associated with them.
e.g. small/ medium/ large

DESCRIPTIVE STATISTICS

The data can be described using different measures to understand the data.
They can further classify as
6.	Measures of central tendency
7.	Measures of dispersion

Measures of Central Tendency
The measures of central tendency describe where the central part of the data lies.

8.	Mean
The mean is also called the average. It tells us the division point for the data.
It is given as the sum of observations divided by the number of observations.

Mean = sum of observations / number of observations

It is a calculated field.
Mean is very sensitive to the extreme values and is not considered a best metric to understand the data.

13, 18, 13, 14, 13, 16, 14, 21, 13
Mean = 13+18+13+14+13+16+14+21+13 / 9   = 15

9.	Median
The median is the middle most value in the distribution of the data.

Sort the data in ascending order
If number of observations is odd,
Median = n+1/2 th observation
If number of observations is even.
Median = average of n/2 th observation and n/2 +1 th observation

13, 18, 13, 14, 13, 16, 14, 21, 13
13, 13, 13, 13, 14, 14, 16, 18, 21
N = 9
Median = 9+1/2 = 5th observation = 14

It is a positional field.
Median is also subject to outliers or extreme values. It is affected by extreme values but not as much as the mean. Hence is a better metric than the mean in situations where mean is not a good metric.

10.	Mode
The most frequent value in the data is called as mode. It is a metric used for categorical features. It is not usually considered in case of numerical features.
Unimodal: The data with only one mode
Bimodal: The data with two modes
Multimodal: The data with more than two modes

13, 18, 13, 14, 13, 16, 14, 21, 13
13 – 4
14 – 2
16 – 1
18 – 1
21 – 1
Mode = 13

It is neither calculated nor a positional field.
Mode is not subject to outliers or extreme values. It is not affected by extreme values like mean or median.

Measures of dispersion
The measures of dispersion describe the spread of data that is it helps understand how the data is distributed

11.	Range
The range is the difference between minimum and the maximum values in the data.

Range = Maximum – Minimum

13, 18, 13, 14, 13, 16, 14, 21, 13
Range = 21-13 = 7

It is affected by outliers in the data. Hence is not considered a good measure for understanding the data.

12.	Deviation
The difference between the observed value and the estimate of the location usually the mean. They are also called as Errors or Residuals.

Deviation = Observed value – Estimate

13, 18, 13, 14, 13, 16, 14, 21, 13
Mean = 15
13 - 15 = -2
14 – 15 = -1
16 – 15 =1
18 – 15 =3
21 – 15 =6

13.	Standard deviation
This measure how deviated the observations are from the mean and from each other.

Standard deviation of population:

Statistical deviation of sample:

Standard deviation is also affected by the outliers. Since it calculated the deviations which are also affected by the outliers.

We use n-1 to calculate for sample measures rather than n to account for the degrees of freedom. Using n with undercalculate the statistic but with n-1 will be a better explanation. The degrees of freedom are the number of observations which can be varied that is which can be moved freely. N-1 accounts to the observations that can move freely as one observation is kept constant.

1.	Variance:
The variance is also a spread of the data. It tells us on an average how deviated are the data points from the mean.

Variance = standard deviation ^ 2

2.	Quartile:
The data when divided into 4 equal parts gives us the quartiles. It is one of the measures of calculating the extreme values in the data. Ever quartile has equal number of observations. They contain 25% of the observations.

1st quartile = n+1/4 th observation
2nd quartile = Median = n+1/2 th observation
3rd quartile = 3(n+1)/4 th observation.

3.	Inter quartile range
The interquartile range is the difference between the third and the first quartiles. It tells us where the 50% of the data lies.

IQR = 3rd quartile – 1st quartile

It is considered as one of the methods to remove the extreme values in the data.
It is given as

Lower limit = 1st quartile – 1.5*IQR
Upper limit = 3rd quantile + 1.5*IQR

Any value lower than lower limits or any value greater than the upper limit is considered as outliers.

4.	Skewness
The skewness is the measure of the asymmetry of the data.
Any data can have different kinds of distributions like normal, binomial etc.
In case of normal distribution, the skewness = 0 since there symmetry around the mean.

Skewness = 3(Mean-Median) / standard deviation

Skewness can be of two types:
Right skewness / Positive skewness:
skewness>0
Mean > Median >Mode
It happens when there are few extreme values on the right tail of the data.
Left skewness / Negative skewness:
Skewness<0
Mean< Median< Mode
It happens when there are few extreme values on the left side of the data

No skewness:
Skewness =0
Mean = Median = Mode
It happens when data is normally distributed

14.	Kurtosis
It is a measure of tailedness or the peakedness in the data. It tells us what kind of distribution the data has.

Positive kurt: Leptokurtic:
Kurt >3
Excess kurt >0
Excess kurt =kurt -3
When the data is leptokurtic then the data lies very near to the mean or in other words, the standard deviation is low.
Lepto means skinny and the distribution looks like a long peak.
It indicates that the extreme values or outliers are large.

Mesokurtic: No kurt:
Kurt = 3
Excess kurt =0
When the data is mesokurtic then the data lies symmetric around the mean, in other words it is normally distributed.
It indicates that there are no outliers or extreme values in the data

	Platykurtic: Negative kurt:
	Kurt <3
	Excess kurt <0
When the data is platykurtic then the data lies far from the mean, in other words the standard deviation is high.
Platy means broad and hence distribution looks like a broad distribution.
It indicates that the extreme values or outliers are small.

15.	Covariance
The covariance is a measure of direction of movement of the variable in respect to each other.

It only tells us the direction of movement of the variables with each other
It is not interpretable.
It can be positive or negative.
When covariance >0 then with an increase in one variable there will be an increase in the other variable
When covariance <0 then with increase in one variable there will be a decrease in the other variable

16.	Correlation
Also called the coefficient of covariance
This is a measure of both the direction and the magnitude of the movement of the variables in respect of each other.

Correlation is preferred to covariance as it is interpretable.
It always lies between -1 and 1
If correlation =0 then there is no relation between the variables
If correlation =1 then with a unit increase in one variable there is a unit increase in another variable.
If correlation =-1 then with a unit increase in one variable there is a unit decrease in another variable.

Correlation does not mean causation.
Causation means an evet that happens because another event happens that is it is a pre-established relationship.
Correlation only implies statistically they move but not as a cause is involved.

DATA VSUALISATION
The visualisation of any data will help uncover better patterns in the data. And for any person visualisation is a better technique to understand the data.

11.	Histogram
The plot shows the distribution of the data which is numerical in nature.
It plots the intervals against their distributions.
The bins are of equal width.
Number of bins is dependent on the user.
The height of the bin is the frequency.
x-axis = interval
y-axis = frequency

2
14
14
14
16	18
20
20
21
23	27
27
27
29
31	31
32
32
34
36	40
40
40
40
40	42
51
56
60
65

	Step1: calculate range
	Range = 65-12=53

	Step2: Divide range into number of groups and round up
	n=6

	53/6 = 8.8 ~9

	Step3: Use class width to create the groups

Classes	Frequency
12-21	8
21-30	6
30-39	6
39-48	6
48-57	2
57-66	2

5.	Bar plots
The plots that show the distribution of a categorical variable. It plots the frequency against the category.
X – axis = category
Y – axis = frequency

Category	Frequency
G1	1
G2	2
G3	3
G4	4
G5	5

6.	Pie charts
The pie charts are circular graphs that show the distribution of the categories in the variable based on their percentages.
It plots the percentage of total observations for each category.
	There are no axes to the chart
	100% = 360 degrees in a pie chart
	Sum of all the observation frequency percentages is 100%.

Fruit	Percentage
Peach	10
Orange	13
Pineapple	20
Grapes	27
Banana	30

7.	Box plots
One of the plots used to view the numerical data. It is called the box and whiskers plot.
It is called as 5-summary plot
It includes:
Lower limit
1st quartile
Median
3rd quartile
Upper limit

If the minimum and maximum values lie below the limits of the IQR range, then we cannot see the points after the whiskers (lines) in the plot.
But if the values lie above and below the limits, we can use this to see how they are distributed. In such case minimum value = least value point and maximum value = highest point in the graph.
8.	Scatter plots
The graph shows the relationship between the two continuous features. It helps us understand how two features are related to each other.

X – axis = one variable
Y – axis = another variable

gha_language: SCSS


text:
# Office Simulator Slackbot
Office slack messages are the passive agressive post-its of the modern world. Do you miss the office life? You won't any more with this realistic office slack simulator.

## In action
We have spared no expense, simulating the most realistic office messages, so you are never really at ease!

**This is serious stuff**
- Complete Realism
- 100% vetted passive agression!
- And of course, it REMEMBERS!

*... 5 days later:*

**Lets see that again!**

*... 8 days later:*

## Installation

1. Firstly, you will need to create a new "bot" integration, in your slack [settings](http://my.slack.com/services/new/bot). Type a username `Office Simulator` and click "Add Bot Integration".

2. Once the bot is created, you will be shown an `API token` ... copy this, we'll need it later.

3. Next, clone this project, or download it as a [ZIP](https://github.com/tholman/office-simulator/archive/master.zip) and extract it.

4. Open up `index.js` in the root directory, and add replace `SLACK_API_TOKEN` with your slack token. You can also change the channel from `general` to one of your other channels, if you wish.

5. Finally, run `npm install` and `npm start` in the project, and you should see the initial team building message.

## Something to add?

Please, add new messages for the slackbot, etc, to the `/data/actions.js` file... you can use the `%modifier%` to add custom random alterations, as well as the `reaction` key, to add custom reactions.

Submit a PR, and I'll check it out!

## Note

Office simulator only posts once or twice a day, so if it doesn't seem to be constantly going, its due to painstakingly accurate realism.

## License

The MIT License

Copyright (c) 2020 Tim Holman - http://tholman.com

repository: tholman/office-simulator

repo_name: tholman/office-simulator


text:
# mod_security_add_ids_to_rules
A small python script that adds ISs to rules of previous version of mod_security that do not have ids yet.

mod_security decided to make IDs mandatory for each role at a certain version. To avoid to add an ID to each role manuall you can use this script. Therefore execuite it with

```python addModSecurityIDs.py <pathToRuleFile> <firstIDToAssign>```

The script considers ```SecRules```. Only an ID is added if there is no ID is present. Furthermore the chains are considered, meaning only the first rule of a chain gets an ID.

## Example

I want to add IDs to each rules in ```testFile.conf```. The IDs should start with 10000, 10001, ...:
```python addModSecurityIDs.py testFile.conf 10000```

**Input:**
```
SecRule &ARGS "@eq 5" pass,chain,nolog,skipAfter:BLOCK_REQUESTS
        SecRule ARGS_NAMES "^fetch$" chain
        SecRule ARGS_NAMES "^itemType$" chain

SecRule &ARGS "@eq 1" pass,nolog,skipAfter:BLOCK_REQUESTS
```

**Result:**
```
SecRule &ARGS "@eq 5" pass,chain,nolog,skipAfter:BLOCK_REQUESTS,id:10000
        SecRule ARGS_NAMES "^fetch$" chain
        SecRule ARGS_NAMES "^itemType$" chain

SecRule &ARGS "@eq 1" pass,nolog,skipAfter:BLOCK_REQUESTS,id:10001
```


text:
# jump-ionic2
Dockerfile (maybe more to come) for creating images used for developing Ionic 2 Portable Web Apps and Angular 2 apps.

See https://blog.saddey.net/2016/07/03/using-docker-to-create-ionic-2-pwa-developer-environment/

Note: This image is targeted towards development, i.e. all-and-everything runs as root.


text:
---
module: "@wq/react"
---

# useSiteTitle()

Returns the site title for use in e.g. [`Header`][Header].  Defaults to [useContextTitle()][useContextTitle] if `config.site_title` is undefined.

```js
const siteTitle = useSiteTitle();
```

[Header]: ../components/Header.md
[useContextTitle]: ./useContextTitle.md

repository: wq/wq

repo_name: wq/wq


text:
---
metaTitle: "Git - Merging"
description: "Merge one branch into another, Automatic Merging, Aborting a merge, Keep changes from only one side of a merge, Merge with a commit, Finding all branches with no merged changes"
---

# Merging

## Merge one branch into another

```git
git merge incomingBranch

```

This merges the branch `incomingBranch` into the branch you are currently in. For example, if you are currently in `master`, then `incomingBranch` will be merged into `master`.

Merging can create conflicts in some cases. If this happens, you will see the message `Automatic merge failed; fix conflicts and then commit the result.` You will need to manually edit the conflicted files, or to undo your merge attempt, run:

```git
git merge --abort

```

## Automatic Merging

When the commits on two branches don't conflict, Git can automatically merge them:

```git
~/Stack Overflow(branch:master) » git merge another_branch
Auto-merging file_a
Merge made by the 'recursive' strategy.
 file_a | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

```

## Aborting a merge

After starting a merge, you might want to stop the merge and return everything to its pre-merge state. Use `--abort`:

```git
git merge --abort

```

## Keep changes from only one side of a merge

During a merge, you can pass `--ours` or `--theirs` to `git checkout` to take all changes for a file from one side or the other of a merge.

```git
$ git checkout --ours   -- file1.txt # Use our version of file1, delete all their changes
$ git checkout --theirs -- file2.txt # Use their version of file2, delete all our changes

```

## Merge with a commit

Default behaviour is when the merge resolves as a fast-forward, only update the branch pointer, without creating a merge commit. Use `--no-ff` to resolve.

`git merge <branch_name> --no-ff -m "<commit message>"`

## Finding all branches with no merged changes

Sometimes you might have branches lying around that have already had their changes merged into master. This finds all branches that are not `master` that have no unique commits as compared to `master`. This is very useful for finding branches that were not deleted after the PR was merged into master.

```

for branch in $(git branch -r) ; do
   [ "${branch}" != "origin/master" ] && [ $(git diff master...${branch} | wc -l) -eq 0 ] && echo -e `git show --pretty=format:"%ci %cr" $branch | head -n 1`\\t$branch
 done | sort -r

```

#### Syntax

- git merge **another_branch** [options]
- git merge **--abort**

#### Parameters

| Parameter        | Details                                                                  |
| ---------------- | ------------------------------------------------------------------------ |
| `-m`             | Message to be included in the merge commit                               |
| `-v`             | Show verbose output                                                      |
| `--abort`        | Attempt to revert all files back to their state                          |
| `--ff-only`      | Aborts instantly when a merge-commit would be required                   |
| `--no-ff`        | Forces creation of a merge-commit, even if it wasn't mandatory           |
| `--no-commit`    | Pretends the merge failed to allow inspection and tweaking of the result |
| `--stat`         | Show a diffstat after merge completion                                   |
| `-n`/`--no-stat` | Don't show the diffstat                                                  |
| `--squash`       | Allows for a single commit on the current branch with the merged changes |

repository: haifenghuang/generate

repo_name: haifenghuang/generate