Skip to content

Instantly share code, notes, and snippets.

View jainakshansh's full-sized avatar
🎯
Focusing

Akshansh Jain jainakshansh

🎯
Focusing
View GitHub Profile
#!/usr/bin/env bash
# Name variables.
ENVIRONMENT=$1
SLACK_TITLE=$2
# Safety checks. Exiting if the parameters are not passed.
if [[ -z "$ENVIRONMENT" ]]; then
echo "Need environment data. Choose from: Debug, Release, etc."
exit 1
@jainakshansh
jainakshansh / cross_entropy.py
Created December 25, 2018 05:31
The Cross-Entropy Algorithm - Facebook Udacity PyTorch Challenge
import numpy as np
def cross_entropy(Y, P):
Y = np.float_(Y)
P = np.float_(P)
return -np.sum(Y * np.log(P) + (1 - Y) * np.log(1 - P))
Y = [1, 0, 1, 1]
@jainakshansh
jainakshansh / softmax_algo.py
Created December 22, 2018 18:27
The Softmax Algorithm for Multi-class Classification - Facebook Udacity PyTorch Challenge
import numpy as np
def softmax(L):
expL = np.exp(L)
sumExpL = sum(expL)
result = []
for i in expL:
result.append(i * 1.0 / sumExpL)
return result
@jainakshansh
jainakshansh / perceptron_algo.py
Last active December 22, 2018 18:26
The Perceptron Algorithm for Linear Classification Model - Facebook Udacity PyTorch Challenge
import numpy as np
# What does numpy.random.seed() do? - https://stackoverflow.com/questions/21494489/what-does-numpy-random-seed0-do
np.random.seed(42)
def stepFunction(t):
if t >= 0:
return 1
return 0