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
# Create a new bgpvpn | |
neutron bgpvpn-create --type l3 --name mybgpvpn -- --import-targets 55:55 88:88 --export-targets 55:55 88:88 --route-distinguishers 55:55 | |
# Associate network to bgpvpn | |
neutron bgpvpn-net-assoc-create --network my_net mybgpvpn | |
# Associate router to bgpvpn | |
neutron bgpvpn-router-assoc-create --router my_router mybgpvpn2 | |
# Update bgpvpn route targets |
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
############################################################################## | |
# Copyright (c) 2015 Ericsson AB and others. | |
# [email protected] | |
# All rights reserved. This program and the accompanying materials | |
# are made available under the terms of the Apache License, Version 2.0 | |
# which accompanies this distribution, and is available at | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
############################################################################## | |
TOP := $(shell pwd) |
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
#!/usr/bin/env python3 | |
""" | |
Credits https://github.com/ivanychev/learning/blob/master/Python/ipynb2pdf/ipynb2pdf.py | |
Current version of Jupyter doesn't support pdf exporting when it comes to | |
greek language in the document. To fix this, current script has born. | |
It requires nbconvert as long as jupyter to be installed. | |
Author: Sergey Ivanychev |
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 sklearn.base import BaseEstimator, ClassifierMixin | |
class EuclideanClassifier(BaseEstimator, ClassifierMixin): | |
"""Classify samples based on the distance from the mean feature value""" | |
def __init__(self): | |
self.X_mean_ = None | |
def fit(self, X, y): |
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
#!/usr/bin/env bash | |
SPELL_CHECKER_COMPILED=${1} | |
python test.py | | |
fstcompile --isymbols=letter_syms.txt --osymbols=letter_syms.txt | | |
fstcompose - ${SPELL_CHECKER_COMPILED} | | |
fstshortestpath | | |
fstrmepsilon | | |
fsttopsort | |
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
#!/usr/bin/env bash | |
python create_fst.py | fstcompile --isymbols=chars.syms --osymbols=chars.syms - rosebud.bin.fst |
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
# Initialize word2vec. Context is taken as the 2 previous and 2 next words | |
model = Word2Vec(sentences, window=5, size=100, workers=4) | |
model.train(sentences, total_examples=len(sentences), epochs=1000) | |
# get ordered vocabulary list | |
voc = model.wv.index2word | |
# get vector size | |
dim = model.vector_size |
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 os | |
data_dir = './aclImdb/' | |
train_dir = os.path.join(data_dir, 'train') | |
test_dir = os.path.join(data_dir, 'test') | |
pos_train_dir = os.path.join(train_dir, 'pos') | |
neg_train_dir = os.path.join(train_dir, 'neg') | |
pos_test_dir = os.path.join(test_dir, 'pos') | |
neg_test_dir = os.path.join(test_dir, 'neg') |
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 torch.utils.data import Dataset | |
from sklearn.preprocessing import LabelEncoder | |
class LabelTransformer(LabelEncoder): | |
def inverse(self, y): | |
try: | |
return super(LabelTransformer, self).inverse_transform(y) | |
except: | |
return super(LabelTransformer, self).inverse_transform([y]) |
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 gzip | |
import copy | |
from sklearn.preprocessing import LabelEncoder | |
from torch.utils.data import Dataset | |
from torch.utils.data import SubsetRandomSampler, DataLoader | |
# Combine similar classes and remove underrepresented classes | |
class_mapping = { |
OlderNewer