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 numpy as np | |
| import scipy.stats as stats | |
| def generate_split(n_char, mu = 0.0, std = 1.0): | |
| return stats.norm.ppf(np.arange(1, n_char) / n_char, mu, std) | |
| def convert(x, splits, cardinality): | |
| n = len(x) | |
| chars = np.zeros(n, dtype=np.int) | |
| for i in range(0, n): |
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
| public class UnionFind { | |
| private int id[]; | |
| private int count; | |
| public UnionFind(int N) { | |
| count = N; | |
| id = new int[N]; | |
| for(int i = 0; i < N; i++) { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 lxml import html | |
| import requests | |
| import urllib.request | |
| BASE_URL = 'https://papers.nips.cc/' | |
| page = requests.get(BASE_URL) | |
| tree = html.fromstring(page.content) | |
| books = [ href.attrib['href'] for href in tree.xpath('//a') if 'book' in href.attrib['href']] |
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 Alignment[A]( | |
| init: (Int, Int) => Double, | |
| rank: (Double, Double, Double, A, A) => Double | |
| ) { | |
| def score(x: Array[A], y: Array[A]): Double = { | |
| val n = x.size | |
| val m = y.size | |
| val dp = Array.ofDim[Double](n + 1, m + 1) |
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
| ,~~+++===~:,,,, | |
| ,,:=+==~~~=~========::, | |
| ,:++?=~::~~~~~~~~~~=~====:, | |
| ,::=?+=~~~~~~~~::::::::~~~~~~~~==~: | |
| ,,:=?+?=~~~~~:~~~~~~::::::::::::::~====~:, | |
| :++???=~~~::::~:~~~::,,,,,,,,,:::,::::~~=++~, | |
| ,~+++===~~:::::::::::,,,,,,,,,,,,,,,,:::~~==?=, | |
| , ,+?+==~~::::::::::,,,,,,,..........,,,,,,~~~==?=, | |
| =~?+???=~::::::,,,,,,,,,,,,..............,,~~=+??+=: | |
| +++=+====~:::::,,,,,,,,,,,,,...............,,,,~++===+: |
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
| //Given two sparse vectors. Write a function to find a dot product of these vectors. | |
| // [0,4,0,0,1,0,0,10,0] | |
| // [2,0,0,0,3,0,0,0,0] | |
| // 3 | |
| x = (4, 1), (1, 4), (10, 7) | |
| y = (2, 0), (3, 4) |
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
| package processing.signals; | |
| import java.util.ArrayList; | |
| /** | |
| * Extract all local features from current spectrogram | |
| * | |
| * @author Daniel Kohlsdorf | |
| */ | |
| public class LocalFeatureExtractor { |
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
| package parser; | |
| public class ExpressionNode { | |
| public static final char or = '|'; | |
| public static final char and = '.'; | |
| public static final char repeat = '*'; | |
| public char symbol; | |
| public ExpressionNode left, right; |
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
| public class BitSet { | |
| private int set = 0; | |
| public void add(int position) { | |
| int mask = 1 << position; | |
| set = set | mask; | |
| } |