Skip to content

Instantly share code, notes, and snippets.

View imohitmayank's full-sized avatar

Mohit imohitmayank

View GitHub Profile
@imohitmayank
imohitmayank / Guide to Custom Recurrent Modeling in Keras.ipynb
Created November 14, 2020 09:33
Complimentary code for "Guide to Custom Recurrent Modeling in Keras" article by Mohit Mayank
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@imohitmayank
imohitmayank / node2vec_karateclub_eval.ipynb
Created August 4, 2020 16:26
To test the node2vec model of KarateClub on the LesMiserable graph (as reported in paper)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@imohitmayank
imohitmayank / bezier_curve.py
Created August 4, 2019 08:40
Draw bezier curve using Processing.py
# Libraries
import time
# Points
p = [{"x" : 100, "y" : 300}, {"x" : 500, "y" : 100}, {"x" : 700, "y" : 300}]
# default values
prev_x = p[0]['x']
prev_y = p[0]['y']
t = 0
@imohitmayank
imohitmayank / edit_distance.py
Created April 16, 2019 19:06
edit distance
import numpy as np
def editdistance(str1, str2):
# define
m, n = len(str1) + 1, len(str2) + 1
table = np.empty([m, n])
for i in range(m):
table[i, 0] = i
for j in range(n):
table[0, j] = j
for i in range(1, m):
@imohitmayank
imohitmayank / fibonaci_number_memo.py
Last active April 16, 2019 18:07
Fibonacci number - memoization
memory = {0: 0, 1: 1}
def fib(n):
if n in memory.keys():
return(memory[n])
else:
memory[n] = fib(n-1) + fib(n-2)
return memory[n]
@imohitmayank
imohitmayank / fibonaci_number.py
Created April 16, 2019 17:51
Fibonacci number
def fib(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fib(n-1) + fib(n-2)
# The status of the solution is printed to the screen
print("Status:", LpStatus[prob.status])
# Output=
# Status: Optimal
# Each of the variables is printed with it's resolved optimum value
for v in prob.variables():
print(v.name, "=", v.varValue)
# Output=
# Medicine_1_units = 3.0
@imohitmayank
imohitmayank / miracle_worker_lp.py
Last active October 27, 2018 14:21
Solving miracle worker using LP
# import PuLP
from pulp import *
# Create the 'prob' variable to contain the problem data
prob = LpProblem("The Miracle Worker", LpMaximize)
# Create problem variables
x=LpVariable("Medicine_1_units",0,None,LpInteger)
y=LpVariable("Medicine_2_units",0, None, LpInteger)
@imohitmayank
imohitmayank / nlu_output
Last active August 11, 2018 14:29
rasa_starter/nlu_output.json
{'intent': {'name': 'query_days_in_month', 'confidence': 0.6128492334410716}, 'entities': [{'start': 17, 'end': 24, 'value': 'january', 'entity': 'month', 'confidence': 0.5002208121139594, 'extractor': 'ner_crf'}], 'intent_ranking': [{'name': 'query_days_in_month', 'confidence': 0.6128492334410716}, {'name': 'bye', 'confidence': 0.1951941314517159}, {'name': 'greet', 'confidence': 0.19195663510721267}], 'text': 'How many days in January'}
{'intent': {'name': 'query_days_in_month', 'confidence': 0.6105606961005596}, 'entities': [{'start': 17, 'end': 22, 'value': 'march', 'entity': 'month', 'confidence': 0.5002208121139594, 'extractor': 'ner_crf'}], 'intent_ranking': [{'name': 'query_days_in_month', 'confidence': 0.6105606961005596}, {'name': 'bye', 'confidence': 0.20686031746694789}, {'name': 'greet', 'confidence': 0.18257898643249237}], 'text': 'How many days in March'