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
# Recipe from https://unix.stackexchange.com/questions/66931/split-pdf-into-documents-with-several-pages-each | |
pagesper=2 | |
file=layout_atlas_multipage.pdf | |
number=$(pdfinfo -- "$file" 2> /dev/null | awk '$1 == "Pages:" {print $2}') | |
count=$((number / pagesper)) | |
filename=${file%.pdf} | |
counter=0 | |
while [ "$count" -gt "$counter" ]; do |
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 torch | |
# Credits to AllenNLP for the base implementation and base tests: | |
# https://github.com/allenai/allennlp/blob/master/allennlp/nn/util.py#L174 | |
# Modified AllenNLP `viterbi_decode` to support `top_k` sequences efficiently. | |
def viterbi_decode(tag_sequence: torch.Tensor, transition_matrix: torch.Tensor, top_k: int=5): | |
""" | |
Perform Viterbi decoding in log space over a sequence given a transition matrix | |
specifying pairwise (transition) potentials between tags and a matrix of shape |
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
""" | |
Efficient implementation of FISTA. | |
""" | |
# Author: Mathieu Blondel | |
# License: BSD 3 clause | |
import numpy as np | |
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
g_LastCtrlKeyDownTime := 0 | |
g_AbortSendEsc := false | |
g_ControlRepeatDetected := false | |
*CapsLock:: | |
if (g_ControlRepeatDetected) | |
{ | |
return | |
} |
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 time | |
import sys | |
import numpy as np | |
from numpy.lib.stride_tricks import as_strided | |
from math import sqrt | |
from scipy import linalg | |
from scikits.learn.linear_model import Lasso, lars_path | |
from joblib import Parallel, delayed |