Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# 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 |
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 | |
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): |
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
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] |
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 fib(n): | |
if n == 0: | |
return 0 | |
elif n == 1: | |
return 1 | |
else: | |
return fib(n-1) + fib(n-2) |
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
# 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 |
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 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) |
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
{'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' |
NewerOlder