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
df = pd.read_csv('conllu.csv') | |
words = [] | |
arcs = [] | |
for index, row in df.iterrows(): | |
words.append({ | |
'text': row['word'], | |
'tag': row['pos'] | |
}) | |
dep_head = row['dependency_head'] - 1 | |
dep_label = row['dependency_label'] |
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
// Run in the console at https://trade.aliexpress.com/orderList.htm | |
Array.from(document.querySelectorAll('.amount-num')).map(x => parseFloat(x.innerText.replace('€ ','').replace('$ ',''))).reduce((a,b) => a+b) |
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
\begin{figure}[h] | |
\centering | |
\captionsetup{justification=centering} | |
\begin{tikzpicture} | |
[%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
box/.style={rectangle,draw=black, thick, minimum size=0.5cm}, | |
dbox/.style={rectangle,draw=black, thick, minimum size=0.5cm, fill=black!20}, | |
gbox/.style={rectangle,draw=black, thick, minimum size=0.5cm, fill=black!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
\begin{figure}[h] | |
\centering | |
\captionsetup{justification=centering} | |
\begin{tikzpicture} | |
[%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
box/.style={rectangle,draw=black, thick, minimum size=0.5cm}, | |
dbox/.style={rectangle,draw=black, thick, minimum size=0.5cm, fill=black!20}, | |
]%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Bit flip |
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
\begin{figure}[h] | |
\centering | |
\captionsetup{justification=centering} | |
\begin{tikzpicture}[node distance = 4cm] | |
\node [frame] (pop) {Population}; | |
\node [above=2cm, left of=pop] (init) {Initialisation}; | |
\node [below=2cm, left of=pop] (term) {Termination}; | |
\node [frame, above=2cm, right of=pop] (parents) {Parents}; | |
\node [frame, below=2cm, right of=pop] (off) {Offspring}; | |
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
\begin{tikzpicture}[node distance = 6em, auto, thick] | |
\node [block] (Agent1) {Agent$_1$}; | |
\node [block, below of=Agent1] (Agent2) {Agent$_2$}; | |
\node [below of=Agent2] (Dots) {\cvdots}; | |
\node [block, below of=Dots] (Agent3) {Agent$_n$}; | |
\node [block, below of=Agent3] (Environment) {Environment}; | |
\path [line] (Agent1.0) --++ (10em,0em) |- node [near start]{$a_{1,t}$} (Environment.-15); | |
\path [line] (Agent2.0) --++ (6em,0em) |- node [near start]{$a_{2,t}$} (Environment.0); | |
\path [line] (Agent3.0) --++ (2em,0em) |- node [near start]{$a_{n,t}$} (Environment.15); |
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
def get_env(): | |
env = gym.make('FrostbiteDeterministic-v4') | |
env = NoopResetEnv(env, noop_max=30) | |
env = WarpFrame(env, 84) | |
env = FrameStack(env, 4) | |
return env | |
register_env("frostbite", get_env) | |
config = { |
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
class GATrainer(Trainer): | |
_name = "GA" | |
@override(Trainer) | |
def _init(self, config, env_creator): | |
self.config = config | |
self._workers = [ | |
Worker.remote(config, env_creator) | |
for _ in range(config["num_workers"]) | |
] |
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
@ray.remote | |
class Worker: | |
def __init__(self, | |
config, | |
env_creator): | |
self.maximum_timesteps = config['max_timesteps_per_episode'] | |
self.mutation_power = config['mutation_power'] | |
self.model = AtariModel() | |
self.env = env_creator({}) |
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
class AtariModel: | |
def __init__(self): | |
inputs = Input(shape=(84, 84, 4)) | |
layer1 = Conv2D(32, [8, 8], strides=(4, 4), activation="relu")(inputs) | |
layer2 = Conv2D(64, [4, 4], strides=(2, 2), activation="relu")(layer1) | |
layer3 = Conv2D(64, [3, 3], strides=(1, 1), activation="relu")(layer2) | |
layer4 = Flatten()(layer3) | |
layer5 = Dense(512, activation="relu")(layer4) | |
action = Dense(6)(layer5) | |
self.model = Model(inputs=inputs, outputs=action) |
NewerOlder