Skip to content

Instantly share code, notes, and snippets.

View Atlas7's full-sized avatar

Johnny Chan Atlas7

View GitHub Profile
@Atlas7
Atlas7 / entropy-cost.md
Last active October 5, 2022 05:31
Deep Neural Network - cross entropy cost - np.sum vs np.dot styles

Cross Entropy Cost and Numpy Implementation

Given the Cross Entroy Cost Formula:

cross-entroy-cost-function.png

where:

  • J is the averaged cross entropy cost
  • m is the number of samples
  • super script [L] corresponds to output layer
@Atlas7
Atlas7 / pred-accuracy.md
Last active September 11, 2017 08:36
Prediction accuracy computation

Q: how the following two differ, in the computation of prediction accuracy? (note: Y = true label, Y_preduction = predicted label).

(from deeplearning.ai, programming assignment. Course 1 - deep learning and neural network.)

Option 1 - Logistric Regression (Week 2):

print("Test accuracy: {} %".format(100 - np.mean(np.abs(Y_prediction - Y)) * 100))
@Atlas7
Atlas7 / nbody.md
Last active August 2, 2021 13:56
High Performance Computing (HPC) with Intel Xeon Phi: N-body Simulation Example

Abstract

Imagine we have n particles in our "universe". These particles have a random initial x, y, and z coordinates to begin with. Defined by Newton's law of universal gravitation, each particle attracts every other particles in this universe using a force that is directly proportional to the product of their masses and inversely proportional to the square of the distance between their centers. As as result, these particles gain (and lose) velocities and change positions over time. The modelling of this physical mechanics is called a N-body simulation.

There currently exists many N-body simulation algorithms. Some are less advanced and highly computational costly (execution time in the order of O(N^2)) - but simple and easy to understand. Some others are more advanced and significantly more efficient (execution in the order of O(n*log(n)) - but not as simple and easy to understand. This articles focuses on the implementation aspect of the less advanced toy algorithm - for the benefit of ease o

@Atlas7
Atlas7 / tmux-cheatsheet.markdown
Created August 13, 2017 10:53 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@Atlas7
Atlas7 / environment.yml
Last active July 11, 2017 12:11
environment.yml
name: helloworld
dependencies:
- python=2.7
- anaconda
@Atlas7
Atlas7 / alexa_dev_notes.md
Last active June 16, 2017 16:02
Alex Development - Notes
@Atlas7
Atlas7 / readme.md
Created June 12, 2017 18:06 — forked from endolith/readme.md
How to stream a webcam to a web browser in Ubuntu

Grr this took hours to figure out. I was trying to install MJPG-streamer and running VLC command lines and all this crap but nothing worked.

First install motion:

~> sudo apt-get install motion

Then create a config file:

~> mkdir ~/.motion

~> nano ~/.motion/motion.conf

@Atlas7
Atlas7 / SGBP.md
Last active June 12, 2017 13:50
Intel Joule, Ubuntu, and Intel RealSense - Setup Instructions

Use this page to jot down notes regarding small garden birdwatch project.

Intel Joule

@Atlas7
Atlas7 / numpy_fancy_2.py
Created May 23, 2017 09:43
numpy_fancy_2.py
import numpy as np
# sow a fix seed to make trial and error more predictable
np.random.seed(0)
# create a 10 x 3 NumPy array
a = np.random.rand(10,3)
# do the fancy indexing: for each row, extract the element that is closest to 0.5
a2 = a[np.arange(a.shape[0]), np.argsort(np.abs(a - 0.5))[:,0]]
@Atlas7
Atlas7 / fourier.html
Created May 22, 2017 18:15 — forked from kazad/fourier.html
BetterExplained Fourier Example
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.2/underscore-min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
<script src="//ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js"></script>
<!--
TODO: