Probablity Theory in Summary
Maximum Likelihood Estimation
Python Numpy Cheat Sheet
numpy.array()
array initialization
array initialization using list
>>> arr = np.array([1,2,3,4,5])
>>> arr
array([1, 2, 3, 4, 5])
>>> print(arr)
[1 2 3 4 5]
>>> print(type(arr))
<class 'numpy.ndarray'>
Naive Bayes Classifer
Definition
Naive Bayes classifiers are based on naive bayes classifier algorithms. Let’s say we have m input values
- Assume all these input variables/features are conditionally independent given Y and equally contributed to the outcome.
In reality it is not quitepossiblethat all features are conditionally independent
- Simply chose the class label that is the most likely given the data, predict Y using
Bootstrap and Random Forest
Bootstrap
What is Bootstrap Sampling?
In statistics, Bootstrap Sampling is a method that involves drawing of sample data repreatedly with replacement from a data source to estimate a population parameter.
- Sampling: with respect to statistics, sampling is the process of selectign a subset of items from a vast collection of items to estimate a certain characteristic of the entire population.
Stack
Stack
String and Math Operation
if when looping through string/array, current variable has direct influence to previous variable and both variable could be removed or modified after operation, then considering using stack as data structure.
keep in mind data structure: stack::top() -> sign -> tmp -> s[i]
Tree Advanced Topics
Segment Tree
https://www.geeksforgeeks.org/lazy-propagation-in-segment-tree/ https://www.geeksforgeeks.org/segment-tree-set-1-sum-of-given-range/ https://cp-algorithms.com/data_structures/segment_tree.html
AVL Tree
Black and Red Tree
Trie Tree
Binary Indexed Trees
Threas&Concurrency
Definition
-
Instance of a program An instance of a program is a copy of an executable version of the program that has been written to the computer’s memory.
-
Process When we run a program, those instructions are copied into memory and space is allocated for variables and other stuff required to manage its execution. This running instance of a program is called a process and it’s processes which we manage.
Top
Pthreads
Compiling Pthreads
#include <pthread.h>
gcc -o main main.c -lpthread
gcc -o main main.c -pthread
cc -o thread -pthread thread_creation.c
-o outfile