This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
big oh and time complecity : http://bigocheatsheet.com/ | |
: http://www.studytonight.com/data-structures/time-complexity-of-algorithms | |
: http://web.mit.edu/16.070/www/lecture/big_o.pdf | |
Prime Check: http://ideone.com/Sp58lL | |
searcing algorithms : | |
binary search : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_cnn_architecture(weights_path=None): | |
input_img = Input(shape=(64,64,3)) # adapt this if using `channels_first` image data format | |
x1 = Conv2D(64, (3, 3), activation='relu', padding='same')(input_img) | |
gateFactor = Input(tensor = K.variable([0.3])) | |
fractionG = Multiply()([x1,gateFactor]) | |
complement = Lambda(lambda x: x[0] - x[1])([x1,fractionG]) | |
x = MaxPooling2D((2, 2), padding='same')(fractionG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_gated_connections(gatePercentageFactor,inputLayer): | |
gateFactor = Input(tensor = K.variable([gatePercentageFactor])) | |
fractionG = Lambda(lambda x: x[0]*x[1])([inputLayer,gateFactor]) | |
complement = Lambda(lambda x: x[0] - x[1])([inputLayer,fractionG]) | |
return gateFactor,fractionG,complement | |
#x is conv layer | |
#y is de-conv layer | |
#gf is gating factor |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def natural_number_generator(n): | |
yield n | |
yield from natural_number_generator(n+1) | |
def sieve_of_eratosthenes(number_list): | |
next_prime = next(number_list) | |
yield next_prime | |
yield from sieve_of_eratosthenes(i for i in number_list if i%next_prime != 0) | |
if __name__ == '__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
# Generator for all possible sudoku grids | |
def sudoku_generator(sudoku): | |
for y in range(9): | |
for x in range(9): | |
# If cell not filled | |
if sudoku[y][x] == 0: | |
# Check if any number in the range is valid in the empty cell | |
for n in range(1,10): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
int count = 7; | |
switch ( | |
count % 5) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.optimize import nnls | |
from scipy.optimize import curve_fit | |
import math | |
def optimus_fitting(df): | |
""" | |
This function takes in a csv file and returns b0,b1 and b2 fitting the model | |
l = 1/(b0*k + b1) + b2 | |
l is the training loss | |
k is the number of iterations |