This file contains hidden or 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 random | |
x = int(input("What's your input: ")) | |
y = random.randint(5, 20) | |
x_payoff = [] | |
y_payoff = [] | |
if x > y: |
This file contains hidden or 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 matplotlib import pyplot as plt | |
import seaborn as sns | |
import numpy as np | |
from matplotlib.pyplot import axvline | |
from scipy.stats import skewnorm, rv_histogram | |
data = skewnorm.rvs(5, loc=100, scale=200, size=1000).astype(int) # create some random data | |
ax = sns.distplot(data, kde_kws={'label': 'kde of given data'}, label='histogram') # draw histogram & kde of data | |
params = skewnorm.fit(data, 10, loc=80, scale=40) # parameters to fit a skewnorm to the data |
This file contains hidden or 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 matplotlib.pyplot as plt | |
import numpy as np | |
fig, ax = plt.subplots() | |
x = np.linspace(0, 50, 100) | |
# plot the first function | |
plt.plot(x, -0.5*x + 24, '-r', label="Firm 1's best response function") | |
# plot the second function |
This file contains hidden or 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 nashpy as nash | |
import numpy as np | |
row = np.array([[10, 0], [0, 0]]) | |
column = np.array([[10, 0], [0, 0]]) | |
meeting_game = nash.Game(row, column) | |
print(meeting_game) | |
equilibria = meeting_game.support_enumeration() | |
for eq in equilibria: | |
print(f"The unique Nash equilibrium is {eq}") |
This file contains hidden or 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 nashpy as nash | |
import numpy as np | |
row = np.array([[90, 120, 120], [80, 120, 160], [100, 100, 150]]) | |
column = np.array([[90, 80, 100], [120, 120, 100], [120, 160, 150]]) | |
bars_v2 = nash.Game(row, column) | |
print(bars_v2) | |
equilibria = bars_v2.support_enumeration() | |
for eq in equilibria: | |
print(f"The unique Nash equilibrium is {eq}") |
This file contains hidden or 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 nashpy as nash | |
import numpy as np | |
row = np.array([[-3, 0], [-5, -1]]) | |
column = np.array([[-3, -5], [0, -1]]) | |
prisoners_dilemma = nash.Game(row, column) | |
print(prisoners_dilemma) | |
equilibria = prisoners_dilemma.support_enumeration() | |
for eq in equilibria: | |
print(f"The unique Nash equilibrium is {eq}") |
This file contains hidden or 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 | |
from scipy.misc import derivative | |
import matplotlib.pyplot as plt | |
# define the parabola | |
# the quadratic function, which is y = -x^2 + 2.5x + 6 here | |
def function(x): | |
return -x ** 2 + 2.5 * x + 6 | |
# define the parabola derivative |
This file contains hidden or 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 pandas as pd | |
import glob | |
full_month_file = open('result.txt') | |
directory = '../data/*.txt' | |
def read_mpc_txt_files(): | |
read_files = glob.glob(directory) | |
with open('result.txt', 'wb') as outfile: |
We can't make this file beautiful and searchable because it's too large.
This file contains hidden or 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
recency,history,used_discount,used_bogo,zip_code,is_referral,channel,offer,conversion | |
10,142.44,1,0,Surburban,0,Phone,Buy One Get One,0 | |
6,329.08,1,1,Rural,1,Web,No Offer,0 | |
7,180.65,0,1,Surburban,1,Web,Buy One Get One,0 | |
9,675.83,1,0,Rural,1,Web,Discount,0 | |
2,45.34,1,0,Urban,0,Web,Buy One Get One,0 | |
6,134.83,0,1,Surburban,0,Phone,Buy One Get One,1 | |
9,280.2,1,0,Surburban,1,Phone,Buy One Get One,0 | |
9,46.42,0,1,Urban,0,Phone,Buy One Get One,0 | |
9,675.07,1,1,Rural,1,Phone,Discount,0 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder