Skip to content

Instantly share code, notes, and snippets.

View nniranjhana's full-sized avatar

Niranjhana Narayanan nniranjhana

View GitHub Profile
import random, sys
import numpy as np
import matplotlib.pyplot as plt
# This is to divide generated values by their total sum so they sum up to U
def bigint(num):
# Round off floats to 10 decimal places
num = float('%.10f'%(num))
# Convert to a big int preserving all 10 decimal digits
@nniranjhana
nniranjhana / nn-mnist-tf1.py
Created November 13, 2020 04:11
TF v1 vs v2
#!/usr/bin/python
""" Neural Network.
A 2-Hidden Layers Fully Connected Neural Network (a.k.a Multilayer Perceptron)
implementation with TensorFlow. This example is using the MNIST database
of handwritten digits (http://yann.lecun.com/exdb/mnist/).
Links:
[MNIST Dataset](http://yann.lecun.com/exdb/mnist/).
Author: Aymeric Damien
Project: https://github.com/aymericdamien/TensorFlow-Examples/
@nniranjhana
nniranjhana / 1-palindrome.py
Last active September 10, 2020 02:50
crank leetcode
# https://leetcode.com/problems/palindrome-number/
class Solution:
def isPalindrome(self, x: int) -> bool:
x = str(x)
p = len(x)-1
for i in range(len(x)//2):
if(x[i]!=x[p]):
return False
p = p - 1
return True