Skip to content

Instantly share code, notes, and snippets.

View suvojit-0x55aa's full-sized avatar
💭
Learning to Learn

Suvojit Manna suvojit-0x55aa

💭
Learning to Learn
View GitHub Profile
@suvojit-0x55aa
suvojit-0x55aa / compound.py
Last active July 18, 2016 12:19
The power of compounding
__author__ = 'Suvojit Manna'
try:
p = float(raw_input())
r = float(raw_input())
t = int(raw_input())
ans = p
r /= 12*100
for i in xrange(1, t):
ans *= 1 + r
@suvojit-0x55aa
suvojit-0x55aa / Det.java
Last active July 23, 2016 15:33
Determinant of a Matrix Laplace Method
import javax.naming.OperationNotSupportedException;
import java.lang.Exception;
import java.lang.Math;
import java.lang.String;
import java.lang.System;
import java.util.Scanner;
class Matrix
{
private int mat[][];
@suvojit-0x55aa
suvojit-0x55aa / SimpleNeuralNet.py
Created September 24, 2017 13:30
A Simple Neural Net in Python
import numpy as np
import csv
import matplotlib.pyplot as plt
#fix random seed for reproducibility
np.random.seed(1)
#Read Dataset
iris = open('iris.csv','r')
from __future__ import division, print_function
import concurrent.futures as cf
from glob import glob
import logging
import os
from time import time, sleep
import boto3
@suvojit-0x55aa
suvojit-0x55aa / gaussian.py
Created August 1, 2019 12:39
Python Numpy Gaussian Function
def gauss_map(size_x, size_y=None, sigma_x=5, sigma_y=None):
if size_y == None:
size_y = size_x
if sigma_y == None:
sigma_y = sigma_x
assert isinstance(size_x, int)
assert isinstance(size_y, int)
x0 = size_x // 2
@suvojit-0x55aa
suvojit-0x55aa / label_smoothing.py
Created September 30, 2019 07:55
Label Smoothing in Pytorch
import torch
import torch.nn as nn
class LabelSmoothing(nn.Module):
"""
NLL loss with label smoothing.
"""
def __init__(self, smoothing=0.0):
"""
Constructor for the LabelSmoothing module.