initial commit

This commit is contained in:
aj 2023-05-20 01:33:56 +01:00
commit 59d9dd8493
30 changed files with 603 additions and 0 deletions

6
AI/Literature.md Normal file
View File

@ -0,0 +1,6 @@
[https://web.stanford.edu/~jurafsky/slp3/A.pdf](https://web.stanford.edu/~jurafsky/slp3/A.pdf)
[Towards Data Science: 3 Things You Need To Know Before You Train-Test Split](https://towardsdatascience.com/3-things-you-need-to-know-before-you-train-test-split-869dfabb7e50)
[https://machinelearningmastery.com/train-final-machine-learning-model/](https://machinelearningmastery.com/train-final-machine-learning-model/)
[https://medium.com/@canerkilinc/hands-on-tensorflow-2-0-multi-label-classifications-with-mlp-88fc97d6a7e6](https://medium.com/@canerkilinc/hands-on-tensorflow-2-0-multi-label-classifications-with-mlp-88fc97d6a7e6)
[https://stackoverflow.com/questions/61557536/how-tensorflow-keras-go-from-one-hot-encoded-outputs-to-class-predictions-for](https://stackoverflow.com/questions/61557536/how-tensorflow-keras-go-from-one-hot-encoded-outputs-to-class-predictions-for)
[https://stackoverflow.com/questions/35226198/is-this-one-hot-encoding-in-tensorflow-fast-or-flawed-for-any-reason/35227732#35227732](https://stackoverflow.com/questions/35226198/is-this-one-hot-encoding-in-tensorflow-fast-or-flawed-for-any-reason/35227732#35227732)

View File

@ -0,0 +1,53 @@
# Linearity
- Neurons can be linear or non-linear
- Network of non-linear neurons is non-linear
- Non-linearity is distributed
- Helpful if target signals are generated non-linearly
# Input-Output Mapping
- Map input signal to desired response
- Supervised learning
- Similar to non-parametric statistical inference
- Non-parametric as in no prior assumptions
- No probabilistic model
# Adaptivity
- Synaptic weights
- Can be easily retrained
- Can operate in non-stationary environments
- Can change weights in real-time
- In general, more adaptive = more robust
- Not always though
- Short time-constant system may be thrown by short-time spurious disturbances
- Stability-plasticity dilemma
# Evidential Response
- Decisions are made with evidence not just declared
- Confidence value
# Contextual Information
- Knowledge represented by structure and activation weight
- Any neuron can be affected by global activity
- Contextual information handled naturally
# Fault Tolerance
- Hardware implementations
- Performance degrades gracefully with adverse conditions
- If some of it breaks, it won't cause the whole thing to break
- Like a real brain
# VLSI Implementability
- Very large-scale integration
- Chips with millions of transistors (MOS)
- E.g. microprocessor, memory chips
- Massively parallel nature
- Well suited for VLSI
# Uniformity in Analysis
- Are domain agnostic in application
- Analysis methods are the same
- Can share theories, learning algorithms
# Neurobiological Analogy
- Design analogous to brain
- Already a demonstrable fault-tolerant, powerful, fast, parallel processor

35
CS/ABI.md Normal file
View File

@ -0,0 +1,35 @@
- How data structures & computational routines are accessed in machine code
- Machine code therefore hardware-dependent
- API defines this structure in source code
- Adherence usually responsibility of
- Compiler
- OS
- Library author
# Components
- Processor instruction set
- Register file structure
- Stack organisation
- Memory access types
- Size, layouts and alignments of basic data types
- ___Calling convention___
- How function arguments are passed
- Stack or register
- Which registers for which function param
- Parameter order
- Return values retrieved
- How app makes sys calls to OS
- If ABI specifies direct sys calls over procedure calls to sys call stubs then sys call numbers
- Binary format of object files, program files
- For complete OS ABIs
# Complete ABI
- Allows program from one OS to run on any other without change
- Provided all shared libraries and prerequisites etc
# Embedded ABI
- File format, data types, register usage, stack frame organisation, function parameter passing conventions
- For embedded OS
- Compilers create object code compatible with code from other compilers
- Link libraries from different compilers

28
CS/Calling Conventions.md Normal file
View File

@ -0,0 +1,28 @@
- The order in which atomic (scalar) parameters, or individual parts of a complex parameter, are allocated
- How parameters are passed
- Pushed on the stack, placed in registers, or a mix of both
- Which registers the called function must preserve for the caller
- Also known as: callee-saved registers or non-volatile registers
- How the task of preparing the stack for, and restoring after, a function call is divided between the caller and the callee
Subtle differences between compilers, can be difficult to interface codes from different compilers
Calling conventions, type representations, and name mangling are all part of what is known as an [application binary interface](https://en.wikipedia.org/wiki/Application_binary_interface) ([[ABI]])
# cdecl
C declaration
- Originally from Microsoft's C compiler
- Used by many C compilers for x86
- Subroutine arguments passed on the stack
- Function arguments pushed right-to-left
- Last pushed first
- Caller cleans stack after function call returns
# stdcall
- Variation on Pascal calling convention
- Callee cleans stack
- Params pushed onto stack right-to-left
- Same as _cdecl_
- Standard for Microsoft Win32 API

41
CS/Code Types.md Normal file
View File

@ -0,0 +1,41 @@
## Machine Code
- Machine language instructions
- Directly control CPU
- Strictly numerical
- Lowest-level representation of a compiled or assembled program
- Lowest-level visible to programmer
- Internally microcode might used
- Hardware dependent
- Higher-level languages translated to machine code
- Compilers, assemblers and linkers
- Not for interpreted code
- Interpreter runs machine code
- Assembly is effectively human readable machine code
- Has mnemonics for opcodes etc
## Microcode
- Layer between CPU hardware and instruction set architecture
- Normally written during design phase
- Deployed to ROM or PLA
- Programmable logic array
- Machine code often has some backward compatibility
- Microcode is circuit specific
## Byte Code
Portable Code
- Efficient execution by interpreter
- Compact numeric codes, constants and references
- Encode compiler output following analysis and validation
- Can be further compiled
- JIT
- Typically passed to VM
- Java, Python
## Object Code
- Product of compiler
- Sequence of statements
- Machine code
- Intermediate
- RTL
- Linked to form executable
- Object code portion of machine code not yet linked

30
CS/Compilers.md Normal file
View File

@ -0,0 +1,30 @@
## JIT
Just-in-Time
- Compilation during execution
- At run time
- Bytecode translation to machine code for execution
- Combination of AOT compilation and interpretation
- Speed of compiled code
- Flexibility of interpretation
- Overhead of an interpreter
- Overhead of compiling
- As well as interpreting
- Dynamic compilation
- Adaptive optimization
- Dynamic recompilation
- Microarchitecture-specific speedups
## AOT
Ahead-of-Time
- Compile higher-level language or intermediate representation to machine code
- Runs natively
- Machine-optimized code
## GCC
- Standard compiler for GNU projects and Linux
- Parse source code to produce abstract syntax tree
## LLVM
- Compiler infrastructure
- Develop language front ends for ISAs
- Apple sponsored

106
CS/ISA.md Normal file
View File

@ -0,0 +1,106 @@
Instruction Set Architecture
___Not Microarchitecture___
- Physical implementation of ISA
- Abstract model of a computer
- CPU is an implementation
- Defines
- Data types
- Registers
- Hardware support for main memory
- Features
- Memory consistency
- Addressing modes
- Virtual memory
- Specifies behaviour of machine code
- Binary compatibility
- Allows many implementations
# Complexity
## Complex
- CISC
- Complex instruction set computer
## Reduced
- RISC
- Reduced instruction set computer
- Simplifies processor
- Implementing only frequent instructions
- Less frequent as subroutines
- Typically requires less transistors than CISC
- Improves
- Cost
- Power consumption
- Heat dissipation
## Very Long Instruction Word
VLIW
## Long Instruction Word
LIW
## Explicitly Parallel instruction Computing
EPIC
# ARM
Acorn RISC Machine
Advanced RISC Machines
- RISC architectures
- System-on-Chips, System-on-Modules
- SOC, SOM
- iPhones A Series
- 32-bit Profiles
- A
- Application
- Cortex-A
- R
- Real-time
- Cortex-R
- M
- Micro-controller
- Cortex-M
# Instructions
- Params
- Registers
- Functions
- Arithmetic
- Addressing
- Control
- Memory locations
- With offsets
- Addressing modes
- Interpret operands
- Types
- Data handling and memory
- Set register
- Copy data from memory to register or reverse
- Load and store operations
- Read and write from hardware
- Arithmetic and logic
- +, -, x, ÷
- Bitwise
- Compare
- Floating point instructions
- Control flow
- Branch
- Another location in program to execute
- Conditionally branch
- Indirectly branch
- Branch with argument memory address
- Call
- Save the location to return to
- Coprocessor
- Load/store to and from coprocessor
- Perform coops
- Complex
- Multiple things at once
- Move multiple values between stack and memory
- Move large blocks of memory
- Complicated integer and floating point maths
- Square root, log, sin, cos
- ALU operations from memory not register

25
CS/Language Binding.md Normal file
View File

@ -0,0 +1,25 @@
- Binding is an API that provides glue code
- Allows language to use a foreign library or OS
## Runtime Environments
### Object Models
- COM
- Component Object Model
- MS only cross-language model
- CLI
- .NET Common Language Infrastructure
- Freedesktop.org D-Bus
- Open cross-platform-language model
### Virtual Machines
- CLR
- .NET Common Language Runtime
- Mono
- CLI languages
- Cross-platform
- Adobe Flash Player
- Tamarin
- JVM
- LLVM
- Silverlight

11
CS/Languages/Assembly.md Normal file
View File

@ -0,0 +1,11 @@
[Uni of Virginia - x86 Assembly Guide](https://www.cs.virginia.edu/~evans/cs216/guides/x86.html)
## x86 32-bit
![[x86registers.png]]
## Stack
- push, pop, call, ret
![[stack.png]]
- Growing upwards

19
CS/Languages/C++.md Normal file
View File

@ -0,0 +1,19 @@
## To Read
- [Iterators](https://en.cppreference.com/w/cpp/iterator) -> [spans](https://en.cppreference.com/w/cpp/container/span) -> [ranges](https://en.cppreference.com/w/cpp/ranges)
- [constexpr](https://en.cppreference.com/w/cpp/language/constexpr)
- Can be evaluated at compile-time instead of runtime
- Shift processing to compile-time, quicker at runtime
- Can be run at run-time
- Not the only way to be used in constant expressions
- `const`
- Can use with const
- `constexpr const int N = 5;`
- same as `constexpr int N = 5;`
- `constexpr` implies `const`
## Conan
cmake-conan
[https://github.com/conan-io/cmake-conan](https://github.com/conan-io/cmake-conan)
[https://cliutils.gitlab.io/modern-cmake/](https://cliutils.gitlab.io/modern-cmake/)

25
CS/Languages/Python.md Normal file
View File

@ -0,0 +1,25 @@
pip freeze | %{$_.split('==')[0]} | %{pip install --upgrade $_}
From <[https://www.activestate.com/resources/quick-reads/how-to-update-all-python-packages/](https://www.activestate.com/resources/quick-reads/how-to-update-all-python-packages/)>
[poetry cheat sheet](https://gist.github.com/CarlosDomingues/b88df15749af23a463148bd2c2b9b3fb)
## Twisted
Network engine
numpy scipy jupyterlab matplotlib pandas scikit-learn
## Nuitka
Compiler
## Plotly
Publication-quality Graphs
[NLTK](https://www.nltk.org)
NLP
If you are not getting good results, you should first check that you are using the right classification algorithm (is your data well fit to be classified by a linear SVM?) and that you have enough training data. Practically, that means you might consider visualizing your dataset through PCA or t-SNE to see how "clustered" your classes are, and checking how your classification metrics evolve with the amount of data your classifier is given.
If you then confirm that investing in tweaking your linear SVM is the right way to approach your problem, you can look at modifying the class weights. Note then that what you suggest as weights is probably the opposite of what you want to do: you are giving more weights to less frequent classes, marginalizing them further - said differently, you typically want to use weights that are inversely proportional to class frequencies. You can calculate these manually, or you can let sklearn do it automatically for you by specificing class_weight='balanced'.
From <[https://stats.stackexchange.com/questions/254779/optimal-class-weight-for-svc](https://stats.stackexchange.com/questions/254779/optimal-class-weight-for-svc)>

12
CS/Languages/Rust.md Normal file
View File

@ -0,0 +1,12 @@
## Web
#### Backend
- Actix-web
- Quick
- Rocket
[Benchmarks](https://github.com/programatik29/rust-web-benchmarks)
## Rayon
[https://crates.io/crates/rayon](https://crates.io/crates/rayon)
- Data parallelism

30
CS/Languages/dotNet.md Normal file
View File

@ -0,0 +1,30 @@
# Common Language Infrastructure
## CLI
- Language-neutral platform
# Common Language Runtime
## CLR
- Virtual Execution System
- VES
- Defined by CLI
- JIT managed code into machine instructions
- Execution engine
- VM
- Services
- Memory management
- Type safety
- Exception handling
- Garbage collection
- Security
- Thread management
# Common Intermediate Language
## CIL
- Intermediate language for CLI
- Run by CLR
- Object-oriented, stack-based bytecode
# Assemblies
- Compiled CLI code
- Portable executable (PE)
- DLL, EXE

27
CS/Processors.md Normal file
View File

@ -0,0 +1,27 @@
## Execution Mode
Starts in Real Mode
# Real Mode
- 16 bit
- 20 bit segmented memory
- Max 1 MB memory
- Direct access to peripherals
- No memory protection or multitasking
- BIOS computers start in this mode
# Protected Mode
- 16 bit & 32 bit
- Max 16 MB of physical memory
- Max 1 GB virtual memory
- Privilege levels and protected memory
# Long Mode
- 64 bit
- Largely an extension to 32 bit protected mode
# System Management Mode
- 16 bit
- System-wide functions
- Power management
- System control hardware
- Proprietary OEM code

1
CS/Quantum.md Normal file
View File

@ -0,0 +1 @@
[5 books](https://fivebooks.com/best-books/quantum-computing-chris-bernhardt/)

1
CS/Resources.md Normal file
View File

@ -0,0 +1 @@
[Wigle - wifi enumerating](http://wigle.net)

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
Images/stack.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
Images/tensor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
Images/x86registers.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

10
Light.md Normal file
View File

@ -0,0 +1,10 @@
$$E=hf$$
## Photoelectric Effect
- Emission of charged particles when exposed to UV light
- Electrons
- Einstein suggested light is quantised
1. The maximum KE of ejected electrons is independent of intensity, but dependent on frequency $n$
2. There is a minimum frequency n0below which there is no emission
3. No time delay (less than 1 ns) before the onset of emission but the rate of electrons depends on the intensity.

View File

@ -0,0 +1,3 @@
$$grad\equiv \nabla$$
$$div\equiv \nabla \cdot$$
$$curl\equiv \nabla \times$$

3
Quantum/Confinement.md Normal file
View File

@ -0,0 +1,3 @@
$$E_{ne}=\frac{\hbar^2}{2m_e^*} \frac{\pi^2}{L^2} n^2$$
![[quantum-confinement.png]]
![[confinement-band-gaps.png]]

26
Quantum/Orbitals.md Normal file
View File

@ -0,0 +1,26 @@
$$\psi(r,\theta,\phi)=R(r)\cdot Y_{ml}(\theta, \phi)$$
Wave functions are products of
Radial Function
- $R_{n,l}(r)$
Spherical Harmonic
- $Y_{ml}(\theta, \phi)$
Absolute value of wave function squared gives probability density of finding electron inside differential volume $dV$ centred on $r, \theta, \phi$
$$|\psi(r,\theta,\phi)|^2$$
# Quantum Numbers
$$n$$
Principal quantum number
- 1, 2, 3...
- ***Electron shell***, electron energy and size of orbital
$$l$$
Orbital Angualar Momentum Number
- $0-(n-1)$
- ***Shape*** of the orbital
- 0 = s
- 1 = p
- 2 = d
$$m$$
Z-component / Magentic of $l$
- $-l$ to $+l$
- ***Orientation*** of orbital

32
Quantum/Schrödinger.md Normal file
View File

@ -0,0 +1,32 @@
$$-\frac{\hbar^2}{2m}\nabla^2\psi+V\psi=E\psi$$
- Time Independent
- $\psi$ is the wave function
Quantum counterpart of Newton's second law in classical mechanics
$$F=ma$$
[From](https://en.wikipedia.org/wiki/Schr%C3%B6dinger_equation)
Given a set of known initial conditions, Newton's second law makes a mathematical prediction as to what path a given physical system will take over time. The Schrödinger equation gives the evolution over time of a [wave function](https://en.wikipedia.org/wiki/Wave_function), the quantum-mechanical characterization of an isolated physical system.
[From](https://en.wikipedia.org/wiki/Schr%C3%B6dinger_equation)
[TimeIndependent Schrödinger Equation](https://homepage.univie.ac.at/reinhold.bertlmann/pdfs/T2_Skript_Ch_4.pdf)
[RadialEquation.pdf](https://physics.weber.edu/schroeder/quantum/RadialEquation.pdf)
## Hamiltonian
- Operator
- Total energy of a system
- Kinetic + Potential energy
$$\hat{H}=\hat{T}+\hat{V}$$
- $\hat{V}$
- Potential Energy
- $\hat{T}=\frac{\hat{p}\cdot\hat{p}}{2m}=-\frac{\hbar^2}{2m}\nabla^2$
- Kinetic Energy
- $\hat{p}=-i\hbar\nabla$
- Momentum operator
## Wavefunction Normalisation
- Adds up to 1 under the curve

23
Quantum/Standard Model.md Normal file
View File

@ -0,0 +1,23 @@
- 4 fundamental forces
- Bosons
- Elementary particles
- Fermions
- Spin 1/2
- Fermi-Dirac statistics
- 3 generations of similar pairs
- Quarks
- Colour charge
- Strong interactions
- Leptons
- No colour
- Electroweak interactions
- Bosons
- Scalar
- Spin 0
- Higgs
- Gauge
- Spin 1
- Force carriers
- y, W, Z, g

21
Semiconductors/Doping.md Normal file
View File

@ -0,0 +1,21 @@
$$n=N_c\cdot e^{\frac{-(E_c-E_F)}{kT}}$$
$$p=N_v\cdot e^{\frac{-(E_F-E_v)}{kT}}$$
- $E_c$ is the position of the conduction band minimum
- $E_v$ is the position of the valence band maxmimum
- $k$ is Boltzmann's constant
- $N_x$ are the effective density of states
$$np=n_i^2$$
- $n_i$ = Intrinsic carrier concentration
$$n_i=\sqrt{N_cN_v}e^{\frac{-E_g}{2kt}}$$
- $E_g$ = Band Gap = $E_c-E_v$
## Substitutional Doping
- Donated electrons are delocalised
- Ions are immobile
$$N_c \equiv 2 \left[ \frac{2\pi m_nkT}{h^2}\right]^{3/2}$$
$$N_v \equiv 2 \left[ \frac{2\pi m_pkT}{h^2}\right]^{3/2}$$

View File

@ -0,0 +1,30 @@
$$R=\frac{\rho L}{A}$$
- $R$ = Resistance
- $\rho$ = Resistivity ($\Omega cm$)
- $L$ = Length
- $A$ = CS Area
$$J=\sigma E$$
- $J$ = Current Density
- $\sigma$ = Conductivity ($\frac{1}{\Omega cm}$)
- $E$ = Electric Field
$$V_{bi} = \frac{kT}{q}ln(\frac{N_D N_A}{n_i^2})$$
- $V_{bi}$ = Built-in Potential
$$J=nev$$
- $n$ = Charge Density
- $e$ = Charge
- $v$ = Drift Velocity
$$v=\mu E$$
- $v$ = Drift Velocity
- $\mu$ = Mobility
- $E$ = Electric Field
$$\sigma = ne\mu$$
$$\rho=\frac{1}{\sigma}$$
$$\sigma=q(\mu_nn+\mu_pp)$$
- $q$ = Electronic Charge
- $\mu$ = Carrier Mobility ($\frac{cm^2}{Vs}$)
$$1 eV = 1.602\times 10^{-19}J$$

5
Specific Energy.md Normal file
View File

@ -0,0 +1,5 @@
- Massic energy
- Gravimetric energy density
- Energy density
- Can mean energy per unit volume