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 gym | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def get_random_policy(): | |
""" | |
Build a numpy array representing agent policy. | |
This array must have one element per each of 16 environment states. | |
Element must be an integer from 0 to 3, representing action | |
to take from that state. |
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 gym | |
from tqdm import tqdm_notebook | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import warnings | |
warnings.filterwarnings('ignore') | |
def get_random_policy(): | |
return np.random.choice(n_actions, tuple(bins)) |
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 fastText import load_model | |
model = load_model('official_fasttext_wiki_200_model') | |
def find_ngrams(string, n): | |
ngrams = zip(*[string[i:] for i in range(n)]) | |
ngrams = [''.join(_) for _ in ngrams] | |
return ngrams | |
string = 'грёзоблаженствующий' |