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 | |
| import matplotlib.pyplot as plt | |
| from uuid import uuid4 | |
| """ | |
| Distributed Self-stabilizing Algorithms: | |
| Compute locally the ring's size. | |
| assuming all variables are initialized randomly. | |
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 | |
| from PIL import Image | |
| fig = plt.figure() | |
| im = Image.open('ball.jpg') | |
| L = 15 | |
| im = np.asarray(im.resize((im.size[0]//L, im.size[1]//L))).astype(np.float)/ 255 | |
| CENTER = fig.bbox.xmax//2, fig.bbox.ymax//4 | |
| DX,DY = -190,280#fig.bbox.xmax//10, fig.bbox.ymax //5 |
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 | |
| """ | |
| Simple code to show how the minimization of the coefficient of variation (i.e. propto the standard deviation) | |
| is equivalent to the maximization of the entropy for the probability distribution model of the number of counts over the total, | |
| i.e. Dirichlet distribution for multinomial variables approximated by the maximum likelihood :-) | |
| Mathematical equivalence to render in Latex/MathJax: | |
| max_x(-\sum_{i=1}^4\frac{N_i(x)}{Ntot(x)}log(\frac{N_i(x)}{Ntot(x)})) = min_x(\sum_{i=1}^4(\frac{N_i(x)-\bar{N}(x)}{\bar{N}(x)})^2) |
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 | |
| x=np.linspace(0,15,100) | |
| y=np.sin(x) | |
| plt.scatter(x,y) | |
| plt.plot(x,y) | |
| plt.title('PMF of the $2^n$ different possible phases') | |
| plt.ylabel('Probability (0-1)') |
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 | |
| import matplotlib.pyplot as plt | |
| from sklearn.ensemble import GradientBoostingClassifier | |
| # Definimos la semilla (SEED) y la cantidad de filas (N) | |
| SEED=1234 | |
| N = 2500 | |
| np.random.seed(SEED) |
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
| #******************************************************************************** | |
| # we are using the conditional_scope of the keras_tuner hyperparameter class | |
| # | |
| # link: https://keras.io/api/keras_tuner/hyperparameters/#hyperparameters-class | |
| # | |
| # example by Gaston Mazzei, https://gastonmazzei.github.io/ | |
| #******************************************************************************** |
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 plotly.graph_objects as go | |
| import pandas as pd | |
| df = pd.read_csv('path/to/file.csv') | |
| # You might want to change the "wanted columns" | |
| wanted_columns = ['time'] | |
| wanted_columns += [f'Question {x+1}' for x in range(6)] | |
| wanted_columns += [f'Answer {x+1}' for x in range(6)] |