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
# coding: utf-8 | |
# In[1]: | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import torch | |
import torch.nn as nn |
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.
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
from bs4 import BeautifulSoup | |
import requests | |
import lxml | |
from collections import defaultdict, Counter | |
N = 100 | |
l_title = [] | |
for i in range(1, N): | |
r = requests.get("http://URL/archive/?page={}".format(i)) | |
soup = BeautifulSoup(r.text, 'lxml') |
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 | |
import networkx as nx | |
import matplotlib.pyplot as plt | |
G1 = nx.Graph() | |
G1.add_nodes_from(["A", "B", "C", "D", "E"]) | |
G1.add_edges_from([("A", "B"), ("A", "C"), ("A", "D"), ("D", "E")]) | |
G2 = nx.Graph() | |
G2.add_nodes_from([1, 2, 3, 4, 5, 6]) |
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
class Tree(object): | |
def __init__(self, label, left=None, right=None): | |
self.label = label | |
self.left = left | |
self.right = right | |
def __str__(self): | |
return str(self.label) | |
def get_dfs_label(t): |
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 gym | |
from gym.wrappers import Monitor | |
def main(): | |
GAME = "Taxi-v2" | |
env = gym.make(GAME) | |
n_state = env.observation_space.n | |
n_action = env.action_space.n | |
env = Monitor(env, "taxi_simple", force=True) |
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
#[derive(Debug)] | |
struct Mafuyu { | |
max_value: usize, | |
list_of_values: Vec<usize>, | |
} | |
impl Mafuyu { | |
pub fn new(lov: Vec<usize>) -> Mafuyu { | |
let max_v = lov.iter().max().unwrap(); | |
Mafuyu{max_value: *max_v, list_of_values: lov} |
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
#[derive(Debug)] | |
struct Mafuyu2 { | |
list_of_values: Vec<usize>, | |
max_value: usize, | |
} | |
impl Mafuyu2 { | |
pub fn new(lov: Vec<usize>) -> Mafuyu2 { | |
let max_v = lov.iter().max().unwrap(); | |
Mafuyu2{list_of_values: lov, max_value: *max_v} |
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
#[derive(Debug)] | |
struct Mafuyu { | |
max_value: usize, | |
list_of_values: Vec<usize>, | |
} | |
impl Mafuyu { | |
pub fn new(lov: &Vec<usize>) -> Mafuyu { | |
let max_v = lov.iter().max().unwrap(); | |
Mafuyu {max_value: *max_v, list_of_values: lov.to_vec()} |