partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
_ipa_syllable_to_numbered
Convert IPA syllable *s* to a numbered Pinyin syllable.
dragonmapper/transcriptions.py
def _ipa_syllable_to_numbered(s): """Convert IPA syllable *s* to a numbered Pinyin syllable.""" ipa_syllable, tone = _parse_ipa_syllable(s) try: pinyin_syllable = _IPA_MAP[ipa_syllable]['Pinyin'] except KeyError: raise ValueError('Not a valid syllable: %s' % s) return pinyin_syllable...
def _ipa_syllable_to_numbered(s): """Convert IPA syllable *s* to a numbered Pinyin syllable.""" ipa_syllable, tone = _parse_ipa_syllable(s) try: pinyin_syllable = _IPA_MAP[ipa_syllable]['Pinyin'] except KeyError: raise ValueError('Not a valid syllable: %s' % s) return pinyin_syllable...
[ "Convert", "IPA", "syllable", "*", "s", "*", "to", "a", "numbered", "Pinyin", "syllable", "." ]
tsroten/dragonmapper
python
https://github.com/tsroten/dragonmapper/blob/68eaf43c32725f4b4923c01284cfc0112079e8ab/dragonmapper/transcriptions.py#L278-L285
[ "def", "_ipa_syllable_to_numbered", "(", "s", ")", ":", "ipa_syllable", ",", "tone", "=", "_parse_ipa_syllable", "(", "s", ")", "try", ":", "pinyin_syllable", "=", "_IPA_MAP", "[", "ipa_syllable", "]", "[", "'Pinyin'", "]", "except", "KeyError", ":", "raise", ...
68eaf43c32725f4b4923c01284cfc0112079e8ab
train
_convert
Convert a string's syllables to a different transcription system.
dragonmapper/transcriptions.py
def _convert(s, re_pattern, syllable_function, add_apostrophes=False, remove_apostrophes=False, separate_syllables=False): """Convert a string's syllables to a different transcription system.""" original = s new = '' while original: match = re.search(re_pattern, original, re.IGNOREC...
def _convert(s, re_pattern, syllable_function, add_apostrophes=False, remove_apostrophes=False, separate_syllables=False): """Convert a string's syllables to a different transcription system.""" original = s new = '' while original: match = re.search(re_pattern, original, re.IGNOREC...
[ "Convert", "a", "string", "s", "syllables", "to", "a", "different", "transcription", "system", "." ]
tsroten/dragonmapper
python
https://github.com/tsroten/dragonmapper/blob/68eaf43c32725f4b4923c01284cfc0112079e8ab/dragonmapper/transcriptions.py#L313-L343
[ "def", "_convert", "(", "s", ",", "re_pattern", ",", "syllable_function", ",", "add_apostrophes", "=", "False", ",", "remove_apostrophes", "=", "False", ",", "separate_syllables", "=", "False", ")", ":", "original", "=", "s", "new", "=", "''", "while", "orig...
68eaf43c32725f4b4923c01284cfc0112079e8ab
train
numbered_to_accented
Convert all numbered Pinyin syllables in *s* to accented Pinyin.
dragonmapper/transcriptions.py
def numbered_to_accented(s): """Convert all numbered Pinyin syllables in *s* to accented Pinyin.""" return _convert(s, zhon.pinyin.syllable, numbered_syllable_to_accented, add_apostrophes=True)
def numbered_to_accented(s): """Convert all numbered Pinyin syllables in *s* to accented Pinyin.""" return _convert(s, zhon.pinyin.syllable, numbered_syllable_to_accented, add_apostrophes=True)
[ "Convert", "all", "numbered", "Pinyin", "syllables", "in", "*", "s", "*", "to", "accented", "Pinyin", "." ]
tsroten/dragonmapper
python
https://github.com/tsroten/dragonmapper/blob/68eaf43c32725f4b4923c01284cfc0112079e8ab/dragonmapper/transcriptions.py#L346-L349
[ "def", "numbered_to_accented", "(", "s", ")", ":", "return", "_convert", "(", "s", ",", "zhon", ".", "pinyin", ".", "syllable", ",", "numbered_syllable_to_accented", ",", "add_apostrophes", "=", "True", ")" ]
68eaf43c32725f4b4923c01284cfc0112079e8ab
train
pinyin_to_zhuyin
Convert all Pinyin syllables in *s* to Zhuyin. Spaces are added between connected syllables and syllable-separating apostrophes are removed.
dragonmapper/transcriptions.py
def pinyin_to_zhuyin(s): """Convert all Pinyin syllables in *s* to Zhuyin. Spaces are added between connected syllables and syllable-separating apostrophes are removed. """ return _convert(s, zhon.pinyin.syllable, pinyin_syllable_to_zhuyin, remove_apostrophes=True, separate_syl...
def pinyin_to_zhuyin(s): """Convert all Pinyin syllables in *s* to Zhuyin. Spaces are added between connected syllables and syllable-separating apostrophes are removed. """ return _convert(s, zhon.pinyin.syllable, pinyin_syllable_to_zhuyin, remove_apostrophes=True, separate_syl...
[ "Convert", "all", "Pinyin", "syllables", "in", "*", "s", "*", "to", "Zhuyin", "." ]
tsroten/dragonmapper
python
https://github.com/tsroten/dragonmapper/blob/68eaf43c32725f4b4923c01284cfc0112079e8ab/dragonmapper/transcriptions.py#L357-L365
[ "def", "pinyin_to_zhuyin", "(", "s", ")", ":", "return", "_convert", "(", "s", ",", "zhon", ".", "pinyin", ".", "syllable", ",", "pinyin_syllable_to_zhuyin", ",", "remove_apostrophes", "=", "True", ",", "separate_syllables", "=", "True", ")" ]
68eaf43c32725f4b4923c01284cfc0112079e8ab
train
pinyin_to_ipa
Convert all Pinyin syllables in *s* to IPA. Spaces are added between connected syllables and syllable-separating apostrophes are removed.
dragonmapper/transcriptions.py
def pinyin_to_ipa(s): """Convert all Pinyin syllables in *s* to IPA. Spaces are added between connected syllables and syllable-separating apostrophes are removed. """ return _convert(s, zhon.pinyin.syllable, pinyin_syllable_to_ipa, remove_apostrophes=True, separate_syllables=Tr...
def pinyin_to_ipa(s): """Convert all Pinyin syllables in *s* to IPA. Spaces are added between connected syllables and syllable-separating apostrophes are removed. """ return _convert(s, zhon.pinyin.syllable, pinyin_syllable_to_ipa, remove_apostrophes=True, separate_syllables=Tr...
[ "Convert", "all", "Pinyin", "syllables", "in", "*", "s", "*", "to", "IPA", "." ]
tsroten/dragonmapper
python
https://github.com/tsroten/dragonmapper/blob/68eaf43c32725f4b4923c01284cfc0112079e8ab/dragonmapper/transcriptions.py#L368-L376
[ "def", "pinyin_to_ipa", "(", "s", ")", ":", "return", "_convert", "(", "s", ",", "zhon", ".", "pinyin", ".", "syllable", ",", "pinyin_syllable_to_ipa", ",", "remove_apostrophes", "=", "True", ",", "separate_syllables", "=", "True", ")" ]
68eaf43c32725f4b4923c01284cfc0112079e8ab
train
zhuyin_to_pinyin
Convert all Zhuyin syllables in *s* to Pinyin. If *accented* is ``True``, diacritics are added to the Pinyin syllables. If it's ``False``, numbers are used to indicate tone.
dragonmapper/transcriptions.py
def zhuyin_to_pinyin(s, accented=True): """Convert all Zhuyin syllables in *s* to Pinyin. If *accented* is ``True``, diacritics are added to the Pinyin syllables. If it's ``False``, numbers are used to indicate tone. """ if accented: function = _zhuyin_syllable_to_accented else: ...
def zhuyin_to_pinyin(s, accented=True): """Convert all Zhuyin syllables in *s* to Pinyin. If *accented* is ``True``, diacritics are added to the Pinyin syllables. If it's ``False``, numbers are used to indicate tone. """ if accented: function = _zhuyin_syllable_to_accented else: ...
[ "Convert", "all", "Zhuyin", "syllables", "in", "*", "s", "*", "to", "Pinyin", "." ]
tsroten/dragonmapper
python
https://github.com/tsroten/dragonmapper/blob/68eaf43c32725f4b4923c01284cfc0112079e8ab/dragonmapper/transcriptions.py#L379-L390
[ "def", "zhuyin_to_pinyin", "(", "s", ",", "accented", "=", "True", ")", ":", "if", "accented", ":", "function", "=", "_zhuyin_syllable_to_accented", "else", ":", "function", "=", "_zhuyin_syllable_to_numbered", "return", "_convert", "(", "s", ",", "zhon", ".", ...
68eaf43c32725f4b4923c01284cfc0112079e8ab
train
ipa_to_pinyin
Convert all IPA syllables in *s* to Pinyin. If *accented* is ``True``, diacritics are added to the Pinyin syllables. If it's ``False``, numbers are used to indicate tone.
dragonmapper/transcriptions.py
def ipa_to_pinyin(s, accented=True): """Convert all IPA syllables in *s* to Pinyin. If *accented* is ``True``, diacritics are added to the Pinyin syllables. If it's ``False``, numbers are used to indicate tone. """ if accented: function = _ipa_syllable_to_accented else: functio...
def ipa_to_pinyin(s, accented=True): """Convert all IPA syllables in *s* to Pinyin. If *accented* is ``True``, diacritics are added to the Pinyin syllables. If it's ``False``, numbers are used to indicate tone. """ if accented: function = _ipa_syllable_to_accented else: functio...
[ "Convert", "all", "IPA", "syllables", "in", "*", "s", "*", "to", "Pinyin", "." ]
tsroten/dragonmapper
python
https://github.com/tsroten/dragonmapper/blob/68eaf43c32725f4b4923c01284cfc0112079e8ab/dragonmapper/transcriptions.py#L398-L409
[ "def", "ipa_to_pinyin", "(", "s", ",", "accented", "=", "True", ")", ":", "if", "accented", ":", "function", "=", "_ipa_syllable_to_accented", "else", ":", "function", "=", "_ipa_syllable_to_numbered", "return", "_convert", "(", "s", ",", "_IPA_SYLLABLE", ",", ...
68eaf43c32725f4b4923c01284cfc0112079e8ab
train
to_pinyin
Convert *s* to Pinyin. If *accented* is ``True``, diacritics are added to the Pinyin syllables. If it's ``False``, numbers are used to indicate tone.
dragonmapper/transcriptions.py
def to_pinyin(s, accented=True): """Convert *s* to Pinyin. If *accented* is ``True``, diacritics are added to the Pinyin syllables. If it's ``False``, numbers are used to indicate tone. """ identity = identify(s) if identity == PINYIN: if _has_accented_vowels(s): return s i...
def to_pinyin(s, accented=True): """Convert *s* to Pinyin. If *accented* is ``True``, diacritics are added to the Pinyin syllables. If it's ``False``, numbers are used to indicate tone. """ identity = identify(s) if identity == PINYIN: if _has_accented_vowels(s): return s i...
[ "Convert", "*", "s", "*", "to", "Pinyin", "." ]
tsroten/dragonmapper
python
https://github.com/tsroten/dragonmapper/blob/68eaf43c32725f4b4923c01284cfc0112079e8ab/dragonmapper/transcriptions.py#L417-L435
[ "def", "to_pinyin", "(", "s", ",", "accented", "=", "True", ")", ":", "identity", "=", "identify", "(", "s", ")", "if", "identity", "==", "PINYIN", ":", "if", "_has_accented_vowels", "(", "s", ")", ":", "return", "s", "if", "accented", "else", "accente...
68eaf43c32725f4b4923c01284cfc0112079e8ab
train
to_zhuyin
Convert *s* to Zhuyin.
dragonmapper/transcriptions.py
def to_zhuyin(s): """Convert *s* to Zhuyin.""" identity = identify(s) if identity == ZHUYIN: return s elif identity == PINYIN: return pinyin_to_zhuyin(s) elif identity == IPA: return ipa_to_zhuyin(s) else: raise ValueError("String is not a valid Chinese transcript...
def to_zhuyin(s): """Convert *s* to Zhuyin.""" identity = identify(s) if identity == ZHUYIN: return s elif identity == PINYIN: return pinyin_to_zhuyin(s) elif identity == IPA: return ipa_to_zhuyin(s) else: raise ValueError("String is not a valid Chinese transcript...
[ "Convert", "*", "s", "*", "to", "Zhuyin", "." ]
tsroten/dragonmapper
python
https://github.com/tsroten/dragonmapper/blob/68eaf43c32725f4b4923c01284cfc0112079e8ab/dragonmapper/transcriptions.py#L438-L448
[ "def", "to_zhuyin", "(", "s", ")", ":", "identity", "=", "identify", "(", "s", ")", "if", "identity", "==", "ZHUYIN", ":", "return", "s", "elif", "identity", "==", "PINYIN", ":", "return", "pinyin_to_zhuyin", "(", "s", ")", "elif", "identity", "==", "I...
68eaf43c32725f4b4923c01284cfc0112079e8ab
train
to_ipa
Convert *s* to IPA.
dragonmapper/transcriptions.py
def to_ipa(s): """Convert *s* to IPA.""" identity = identify(s) if identity == IPA: return s elif identity == PINYIN: return pinyin_to_ipa(s) elif identity == ZHUYIN: return zhuyin_to_ipa(s) else: raise ValueError("String is not a valid Chinese transcription.")
def to_ipa(s): """Convert *s* to IPA.""" identity = identify(s) if identity == IPA: return s elif identity == PINYIN: return pinyin_to_ipa(s) elif identity == ZHUYIN: return zhuyin_to_ipa(s) else: raise ValueError("String is not a valid Chinese transcription.")
[ "Convert", "*", "s", "*", "to", "IPA", "." ]
tsroten/dragonmapper
python
https://github.com/tsroten/dragonmapper/blob/68eaf43c32725f4b4923c01284cfc0112079e8ab/dragonmapper/transcriptions.py#L451-L461
[ "def", "to_ipa", "(", "s", ")", ":", "identity", "=", "identify", "(", "s", ")", "if", "identity", "==", "IPA", ":", "return", "s", "elif", "identity", "==", "PINYIN", ":", "return", "pinyin_to_ipa", "(", "s", ")", "elif", "identity", "==", "ZHUYIN", ...
68eaf43c32725f4b4923c01284cfc0112079e8ab
train
_is_pattern_match
Check if a re pattern expression matches an entire string.
dragonmapper/transcriptions.py
def _is_pattern_match(re_pattern, s): """Check if a re pattern expression matches an entire string.""" match = re.match(re_pattern, s, re.I) return match.group() == s if match else False
def _is_pattern_match(re_pattern, s): """Check if a re pattern expression matches an entire string.""" match = re.match(re_pattern, s, re.I) return match.group() == s if match else False
[ "Check", "if", "a", "re", "pattern", "expression", "matches", "an", "entire", "string", "." ]
tsroten/dragonmapper
python
https://github.com/tsroten/dragonmapper/blob/68eaf43c32725f4b4923c01284cfc0112079e8ab/dragonmapper/transcriptions.py#L464-L467
[ "def", "_is_pattern_match", "(", "re_pattern", ",", "s", ")", ":", "match", "=", "re", ".", "match", "(", "re_pattern", ",", "s", ",", "re", ".", "I", ")", "return", "match", ".", "group", "(", ")", "==", "s", "if", "match", "else", "False" ]
68eaf43c32725f4b4923c01284cfc0112079e8ab
train
is_pinyin
Check if *s* consists of valid Pinyin.
dragonmapper/transcriptions.py
def is_pinyin(s): """Check if *s* consists of valid Pinyin.""" re_pattern = ('(?:%(word)s|[ \t%(punctuation)s])+' % {'word': zhon.pinyin.word, 'punctuation': zhon.pinyin.punctuation}) return _is_pattern_match(re_pattern, s)
def is_pinyin(s): """Check if *s* consists of valid Pinyin.""" re_pattern = ('(?:%(word)s|[ \t%(punctuation)s])+' % {'word': zhon.pinyin.word, 'punctuation': zhon.pinyin.punctuation}) return _is_pattern_match(re_pattern, s)
[ "Check", "if", "*", "s", "*", "consists", "of", "valid", "Pinyin", "." ]
tsroten/dragonmapper
python
https://github.com/tsroten/dragonmapper/blob/68eaf43c32725f4b4923c01284cfc0112079e8ab/dragonmapper/transcriptions.py#L470-L475
[ "def", "is_pinyin", "(", "s", ")", ":", "re_pattern", "=", "(", "'(?:%(word)s|[ \\t%(punctuation)s])+'", "%", "{", "'word'", ":", "zhon", ".", "pinyin", ".", "word", ",", "'punctuation'", ":", "zhon", ".", "pinyin", ".", "punctuation", "}", ")", "return", ...
68eaf43c32725f4b4923c01284cfc0112079e8ab
train
is_zhuyin_compatible
Checks if *s* is consists of Zhuyin-compatible characters. This does not check if *s* contains valid Zhuyin syllables; for that see :func:`is_zhuyin`. Besides Zhuyin characters and tone marks, spaces are also accepted. This function checks that all characters in *s* exist in :data:`zhon.zhuyin.cha...
dragonmapper/transcriptions.py
def is_zhuyin_compatible(s): """Checks if *s* is consists of Zhuyin-compatible characters. This does not check if *s* contains valid Zhuyin syllables; for that see :func:`is_zhuyin`. Besides Zhuyin characters and tone marks, spaces are also accepted. This function checks that all characters in *s*...
def is_zhuyin_compatible(s): """Checks if *s* is consists of Zhuyin-compatible characters. This does not check if *s* contains valid Zhuyin syllables; for that see :func:`is_zhuyin`. Besides Zhuyin characters and tone marks, spaces are also accepted. This function checks that all characters in *s*...
[ "Checks", "if", "*", "s", "*", "is", "consists", "of", "Zhuyin", "-", "compatible", "characters", "." ]
tsroten/dragonmapper
python
https://github.com/tsroten/dragonmapper/blob/68eaf43c32725f4b4923c01284cfc0112079e8ab/dragonmapper/transcriptions.py#L497-L509
[ "def", "is_zhuyin_compatible", "(", "s", ")", ":", "printable_zhuyin", "=", "zhon", ".", "zhuyin", ".", "characters", "+", "zhon", ".", "zhuyin", ".", "marks", "+", "' '", "return", "_is_pattern_match", "(", "'[%s]+'", "%", "printable_zhuyin", ",", "s", ")" ...
68eaf43c32725f4b4923c01284cfc0112079e8ab
train
is_ipa
Check if *s* consists of valid Chinese IPA.
dragonmapper/transcriptions.py
def is_ipa(s): """Check if *s* consists of valid Chinese IPA.""" re_pattern = ('(?:%(syllable)s|[ \t%(punctuation)s])+' % {'syllable': _IPA_SYLLABLE, 'punctuation': zhon.pinyin.punctuation}) return _is_pattern_match(re_pattern, s)
def is_ipa(s): """Check if *s* consists of valid Chinese IPA.""" re_pattern = ('(?:%(syllable)s|[ \t%(punctuation)s])+' % {'syllable': _IPA_SYLLABLE, 'punctuation': zhon.pinyin.punctuation}) return _is_pattern_match(re_pattern, s)
[ "Check", "if", "*", "s", "*", "consists", "of", "valid", "Chinese", "IPA", "." ]
tsroten/dragonmapper
python
https://github.com/tsroten/dragonmapper/blob/68eaf43c32725f4b4923c01284cfc0112079e8ab/dragonmapper/transcriptions.py#L512-L517
[ "def", "is_ipa", "(", "s", ")", ":", "re_pattern", "=", "(", "'(?:%(syllable)s|[ \\t%(punctuation)s])+'", "%", "{", "'syllable'", ":", "_IPA_SYLLABLE", ",", "'punctuation'", ":", "zhon", ".", "pinyin", ".", "punctuation", "}", ")", "return", "_is_pattern_match", ...
68eaf43c32725f4b4923c01284cfc0112079e8ab
train
identify
Identify a given string's transcription system. *s* is the string to identify. The string is checked to see if its contents are valid Pinyin, Zhuyin, or IPA. The :data:`PINYIN`, :data:`ZHUYIN`, and :data:`IPA` constants are returned to indicate the string's identity. If *s* is not a valid transcrip...
dragonmapper/transcriptions.py
def identify(s): """Identify a given string's transcription system. *s* is the string to identify. The string is checked to see if its contents are valid Pinyin, Zhuyin, or IPA. The :data:`PINYIN`, :data:`ZHUYIN`, and :data:`IPA` constants are returned to indicate the string's identity. If *s* ...
def identify(s): """Identify a given string's transcription system. *s* is the string to identify. The string is checked to see if its contents are valid Pinyin, Zhuyin, or IPA. The :data:`PINYIN`, :data:`ZHUYIN`, and :data:`IPA` constants are returned to indicate the string's identity. If *s* ...
[ "Identify", "a", "given", "string", "s", "transcription", "system", "." ]
tsroten/dragonmapper
python
https://github.com/tsroten/dragonmapper/blob/68eaf43c32725f4b4923c01284cfc0112079e8ab/dragonmapper/transcriptions.py#L520-L548
[ "def", "identify", "(", "s", ")", ":", "if", "is_pinyin", "(", "s", ")", ":", "return", "PINYIN", "elif", "is_zhuyin", "(", "s", ")", ":", "return", "ZHUYIN", "elif", "is_ipa", "(", "s", ")", ":", "return", "IPA", "else", ":", "return", "UNKNOWN" ]
68eaf43c32725f4b4923c01284cfc0112079e8ab
train
NewtonOptimizer.prepare
Accept an objective function for optimization.
tinyik/optimizer.py
def prepare(self, f): """Accept an objective function for optimization.""" self.g = autograd.grad(f) self.h = autograd.hessian(f)
def prepare(self, f): """Accept an objective function for optimization.""" self.g = autograd.grad(f) self.h = autograd.hessian(f)
[ "Accept", "an", "objective", "function", "for", "optimization", "." ]
lanius/tinyik
python
https://github.com/lanius/tinyik/blob/dffe5031ee044caf43e51746c4b0a6d45922d50e/tinyik/optimizer.py#L16-L19
[ "def", "prepare", "(", "self", ",", "f", ")", ":", "self", ".", "g", "=", "autograd", ".", "grad", "(", "f", ")", "self", ".", "h", "=", "autograd", ".", "hessian", "(", "f", ")" ]
dffe5031ee044caf43e51746c4b0a6d45922d50e
train
NewtonOptimizer.optimize
Calculate an optimum argument of an objective function.
tinyik/optimizer.py
def optimize(self, x0, target): """Calculate an optimum argument of an objective function.""" x = x0 for _ in range(self.maxiter): delta = np.linalg.solve(self.h(x, target), -self.g(x, target)) x = x + delta if np.linalg.norm(delta) < self.tol: ...
def optimize(self, x0, target): """Calculate an optimum argument of an objective function.""" x = x0 for _ in range(self.maxiter): delta = np.linalg.solve(self.h(x, target), -self.g(x, target)) x = x + delta if np.linalg.norm(delta) < self.tol: ...
[ "Calculate", "an", "optimum", "argument", "of", "an", "objective", "function", "." ]
lanius/tinyik
python
https://github.com/lanius/tinyik/blob/dffe5031ee044caf43e51746c4b0a6d45922d50e/tinyik/optimizer.py#L21-L29
[ "def", "optimize", "(", "self", ",", "x0", ",", "target", ")", ":", "x", "=", "x0", "for", "_", "in", "range", "(", "self", ".", "maxiter", ")", ":", "delta", "=", "np", ".", "linalg", ".", "solve", "(", "self", ".", "h", "(", "x", ",", "targ...
dffe5031ee044caf43e51746c4b0a6d45922d50e
train
ConjugateGradientOptimizer.optimize
Calculate an optimum argument of an objective function.
tinyik/optimizer.py
def optimize(self, x0, target): """Calculate an optimum argument of an objective function.""" x = x0 for i in range(self.maxiter): g = self.g(x, target) h = self.h(x, target) if i == 0: alpha = 0 m = g else: ...
def optimize(self, x0, target): """Calculate an optimum argument of an objective function.""" x = x0 for i in range(self.maxiter): g = self.g(x, target) h = self.h(x, target) if i == 0: alpha = 0 m = g else: ...
[ "Calculate", "an", "optimum", "argument", "of", "an", "objective", "function", "." ]
lanius/tinyik
python
https://github.com/lanius/tinyik/blob/dffe5031ee044caf43e51746c4b0a6d45922d50e/tinyik/optimizer.py#L69-L86
[ "def", "optimize", "(", "self", ",", "x0", ",", "target", ")", ":", "x", "=", "x0", "for", "i", "in", "range", "(", "self", ".", "maxiter", ")", ":", "g", "=", "self", ".", "g", "(", "x", ",", "target", ")", "h", "=", "self", ".", "h", "(",...
dffe5031ee044caf43e51746c4b0a6d45922d50e
train
ScipyOptimizer.optimize
Calculate an optimum argument of an objective function.
tinyik/optimizer.py
def optimize(self, angles0, target): """Calculate an optimum argument of an objective function.""" def new_objective(angles): return self.f(angles, target) return scipy.optimize.minimize( new_objective, angles0, **self.optimizer_opt).x
def optimize(self, angles0, target): """Calculate an optimum argument of an objective function.""" def new_objective(angles): return self.f(angles, target) return scipy.optimize.minimize( new_objective, angles0, **self.optimizer_opt).x
[ "Calculate", "an", "optimum", "argument", "of", "an", "objective", "function", "." ]
lanius/tinyik
python
https://github.com/lanius/tinyik/blob/dffe5031ee044caf43e51746c4b0a6d45922d50e/tinyik/optimizer.py#L106-L114
[ "def", "optimize", "(", "self", ",", "angles0", ",", "target", ")", ":", "def", "new_objective", "(", "angles", ")", ":", "return", "self", ".", "f", "(", "angles", ",", "target", ")", "return", "scipy", ".", "optimize", ".", "minimize", "(", "new_obje...
dffe5031ee044caf43e51746c4b0a6d45922d50e
train
ScipySmoothOptimizer.optimize
Calculate an optimum argument of an objective function.
tinyik/optimizer.py
def optimize(self, angles0, target): """Calculate an optimum argument of an objective function.""" def new_objective(angles): a = angles - angles0 if isinstance(self.smooth_factor, (np.ndarray, list)): if len(a) == len(self.smooth_factor): retu...
def optimize(self, angles0, target): """Calculate an optimum argument of an objective function.""" def new_objective(angles): a = angles - angles0 if isinstance(self.smooth_factor, (np.ndarray, list)): if len(a) == len(self.smooth_factor): retu...
[ "Calculate", "an", "optimum", "argument", "of", "an", "objective", "function", "." ]
lanius/tinyik
python
https://github.com/lanius/tinyik/blob/dffe5031ee044caf43e51746c4b0a6d45922d50e/tinyik/optimizer.py#L130-L147
[ "def", "optimize", "(", "self", ",", "angles0", ",", "target", ")", ":", "def", "new_objective", "(", "angles", ")", ":", "a", "=", "angles", "-", "angles0", "if", "isinstance", "(", "self", ".", "smooth_factor", ",", "(", "np", ".", "ndarray", ",", ...
dffe5031ee044caf43e51746c4b0a6d45922d50e
train
FKSolver.solve
Calculate a position of the end-effector and return it.
tinyik/solver.py
def solve(self, angles): """Calculate a position of the end-effector and return it.""" return reduce( lambda a, m: np.dot(m, a), reversed(self._matrices(angles)), np.array([0., 0., 0., 1.]) )[:3]
def solve(self, angles): """Calculate a position of the end-effector and return it.""" return reduce( lambda a, m: np.dot(m, a), reversed(self._matrices(angles)), np.array([0., 0., 0., 1.]) )[:3]
[ "Calculate", "a", "position", "of", "the", "end", "-", "effector", "and", "return", "it", "." ]
lanius/tinyik
python
https://github.com/lanius/tinyik/blob/dffe5031ee044caf43e51746c4b0a6d45922d50e/tinyik/solver.py#L26-L32
[ "def", "solve", "(", "self", ",", "angles", ")", ":", "return", "reduce", "(", "lambda", "a", ",", "m", ":", "np", ".", "dot", "(", "m", ",", "a", ")", ",", "reversed", "(", "self", ".", "_matrices", "(", "angles", ")", ")", ",", "np", ".", "...
dffe5031ee044caf43e51746c4b0a6d45922d50e
train
IKSolver.solve
Calculate joint angles and returns it.
tinyik/solver.py
def solve(self, angles0, target): """Calculate joint angles and returns it.""" return self.optimizer.optimize(np.array(angles0), target)
def solve(self, angles0, target): """Calculate joint angles and returns it.""" return self.optimizer.optimize(np.array(angles0), target)
[ "Calculate", "joint", "angles", "and", "returns", "it", "." ]
lanius/tinyik
python
https://github.com/lanius/tinyik/blob/dffe5031ee044caf43e51746c4b0a6d45922d50e/tinyik/solver.py#L47-L49
[ "def", "solve", "(", "self", ",", "angles0", ",", "target", ")", ":", "return", "self", ".", "optimizer", ".", "optimize", "(", "np", ".", "array", "(", "angles0", ")", ",", "target", ")" ]
dffe5031ee044caf43e51746c4b0a6d45922d50e
train
Link.matrix
Return translation matrix in homogeneous coordinates.
tinyik/component.py
def matrix(self, _): """Return translation matrix in homogeneous coordinates.""" x, y, z = self.coord return np.array([ [1., 0., 0., x], [0., 1., 0., y], [0., 0., 1., z], [0., 0., 0., 1.] ])
def matrix(self, _): """Return translation matrix in homogeneous coordinates.""" x, y, z = self.coord return np.array([ [1., 0., 0., x], [0., 1., 0., y], [0., 0., 1., z], [0., 0., 0., 1.] ])
[ "Return", "translation", "matrix", "in", "homogeneous", "coordinates", "." ]
lanius/tinyik
python
https://github.com/lanius/tinyik/blob/dffe5031ee044caf43e51746c4b0a6d45922d50e/tinyik/component.py#L13-L21
[ "def", "matrix", "(", "self", ",", "_", ")", ":", "x", ",", "y", ",", "z", "=", "self", ".", "coord", "return", "np", ".", "array", "(", "[", "[", "1.", ",", "0.", ",", "0.", ",", "x", "]", ",", "[", "0.", ",", "1.", ",", "0.", ",", "y"...
dffe5031ee044caf43e51746c4b0a6d45922d50e
train
Joint.matrix
Return rotation matrix in homogeneous coordinates.
tinyik/component.py
def matrix(self, angle): """Return rotation matrix in homogeneous coordinates.""" _rot_mat = { 'x': self._x_rot, 'y': self._y_rot, 'z': self._z_rot } return _rot_mat[self.axis](angle)
def matrix(self, angle): """Return rotation matrix in homogeneous coordinates.""" _rot_mat = { 'x': self._x_rot, 'y': self._y_rot, 'z': self._z_rot } return _rot_mat[self.axis](angle)
[ "Return", "rotation", "matrix", "in", "homogeneous", "coordinates", "." ]
lanius/tinyik
python
https://github.com/lanius/tinyik/blob/dffe5031ee044caf43e51746c4b0a6d45922d50e/tinyik/component.py#L31-L38
[ "def", "matrix", "(", "self", ",", "angle", ")", ":", "_rot_mat", "=", "{", "'x'", ":", "self", ".", "_x_rot", ",", "'y'", ":", "self", ".", "_y_rot", ",", "'z'", ":", "self", ".", "_z_rot", "}", "return", "_rot_mat", "[", "self", ".", "axis", "]...
dffe5031ee044caf43e51746c4b0a6d45922d50e
train
LendingClub.set_logger
Set a logger to send debug messages to Parameters ---------- logger : `Logger <http://docs.python.org/2/library/logging.html>`_ A python logger used to get debugging output from this module.
lendingclub/__init__.py
def set_logger(self, logger): """ Set a logger to send debug messages to Parameters ---------- logger : `Logger <http://docs.python.org/2/library/logging.html>`_ A python logger used to get debugging output from this module. """ self.__logger = logger...
def set_logger(self, logger): """ Set a logger to send debug messages to Parameters ---------- logger : `Logger <http://docs.python.org/2/library/logging.html>`_ A python logger used to get debugging output from this module. """ self.__logger = logger...
[ "Set", "a", "logger", "to", "send", "debug", "messages", "to" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L92-L102
[ "def", "set_logger", "(", "self", ",", "logger", ")", ":", "self", ".", "__logger", "=", "logger", "self", ".", "session", ".", "set_logger", "(", "self", ".", "__logger", ")" ]
4495f99fd869810f39c00e02b0f4112c6b210384
train
LendingClub.version
Return the version number of the Lending Club Investor tool Returns ------- string The version number string
lendingclub/__init__.py
def version(self): """ Return the version number of the Lending Club Investor tool Returns ------- string The version number string """ this_path = os.path.dirname(os.path.realpath(__file__)) version_file = os.path.join(this_path, 'VERSION') ...
def version(self): """ Return the version number of the Lending Club Investor tool Returns ------- string The version number string """ this_path = os.path.dirname(os.path.realpath(__file__)) version_file = os.path.join(this_path, 'VERSION') ...
[ "Return", "the", "version", "number", "of", "the", "Lending", "Club", "Investor", "tool" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L104-L115
[ "def", "version", "(", "self", ")", ":", "this_path", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ")", "version_file", "=", "os", ".", "path", ".", "join", "(", "this_path", ",", "'VERSION'",...
4495f99fd869810f39c00e02b0f4112c6b210384
train
LendingClub.authenticate
Attempt to authenticate the user. Parameters ---------- email : string The email of a user on Lending Club password : string The user's password, for authentication. Returns ------- boolean True if the user authenticated or ra...
lendingclub/__init__.py
def authenticate(self, email=None, password=None): """ Attempt to authenticate the user. Parameters ---------- email : string The email of a user on Lending Club password : string The user's password, for authentication. Returns -...
def authenticate(self, email=None, password=None): """ Attempt to authenticate the user. Parameters ---------- email : string The email of a user on Lending Club password : string The user's password, for authentication. Returns -...
[ "Attempt", "to", "authenticate", "the", "user", "." ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L117-L141
[ "def", "authenticate", "(", "self", ",", "email", "=", "None", ",", "password", "=", "None", ")", ":", "if", "self", ".", "session", ".", "authenticate", "(", "email", ",", "password", ")", ":", "return", "True" ]
4495f99fd869810f39c00e02b0f4112c6b210384
train
LendingClub.get_cash_balance
Returns the account cash balance available for investing Returns ------- float The cash balance in your account.
lendingclub/__init__.py
def get_cash_balance(self): """ Returns the account cash balance available for investing Returns ------- float The cash balance in your account. """ cash = False try: response = self.session.get('/browse/cashBalanceAj.action') ...
def get_cash_balance(self): """ Returns the account cash balance available for investing Returns ------- float The cash balance in your account. """ cash = False try: response = self.session.get('/browse/cashBalanceAj.action') ...
[ "Returns", "the", "account", "cash", "balance", "available", "for", "investing" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L154-L186
[ "def", "get_cash_balance", "(", "self", ")", ":", "cash", "=", "False", "try", ":", "response", "=", "self", ".", "session", ".", "get", "(", "'/browse/cashBalanceAj.action'", ")", "json_response", "=", "response", ".", "json", "(", ")", "if", "self", ".",...
4495f99fd869810f39c00e02b0f4112c6b210384
train
LendingClub.get_portfolio_list
Get your list of named portfolios from the lendingclub.com Parameters ---------- names_only : boolean, optional If set to True, the function will return a list of portfolio names, instead of portfolio objects Returns ------- list A list of portfo...
lendingclub/__init__.py
def get_portfolio_list(self, names_only=False): """ Get your list of named portfolios from the lendingclub.com Parameters ---------- names_only : boolean, optional If set to True, the function will return a list of portfolio names, instead of portfolio objects ...
def get_portfolio_list(self, names_only=False): """ Get your list of named portfolios from the lendingclub.com Parameters ---------- names_only : boolean, optional If set to True, the function will return a list of portfolio names, instead of portfolio objects ...
[ "Get", "your", "list", "of", "named", "portfolios", "from", "the", "lendingclub", ".", "com" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L203-L229
[ "def", "get_portfolio_list", "(", "self", ",", "names_only", "=", "False", ")", ":", "folios", "=", "[", "]", "response", "=", "self", ".", "session", ".", "get", "(", "'/data/portfolioManagement?method=getLCPortfolios'", ")", "json_response", "=", "response", "...
4495f99fd869810f39c00e02b0f4112c6b210384
train
LendingClub.assign_to_portfolio
Assign a note to a named portfolio. `loan_id` and `order_id` can be either integer values or lists. If choosing lists, they both **MUST** be the same length and line up. For example, `order_id[5]` must be the order ID for `loan_id[5]` Parameters ---------- portfolio_name : strin...
lendingclub/__init__.py
def assign_to_portfolio(self, portfolio_name, loan_id, order_id): """ Assign a note to a named portfolio. `loan_id` and `order_id` can be either integer values or lists. If choosing lists, they both **MUST** be the same length and line up. For example, `order_id[5]` must be the order ID ...
def assign_to_portfolio(self, portfolio_name, loan_id, order_id): """ Assign a note to a named portfolio. `loan_id` and `order_id` can be either integer values or lists. If choosing lists, they both **MUST** be the same length and line up. For example, `order_id[5]` must be the order ID ...
[ "Assign", "a", "note", "to", "a", "named", "portfolio", ".", "loan_id", "and", "order_id", "can", "be", "either", "integer", "values", "or", "lists", ".", "If", "choosing", "lists", "they", "both", "**", "MUST", "**", "be", "the", "same", "length", "and"...
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L258-L323
[ "def", "assign_to_portfolio", "(", "self", ",", "portfolio_name", ",", "loan_id", ",", "order_id", ")", ":", "response", "=", "None", "assert", "type", "(", "loan_id", ")", "==", "type", "(", "order_id", ")", ",", "\"Both loan_id and order_id need to be the same t...
4495f99fd869810f39c00e02b0f4112c6b210384
train
LendingClub.search
Search for a list of notes that can be invested in. (similar to searching for notes in the Browse section on the site) Parameters ---------- filters : lendingclub.filters.*, optional The filter to use to search for notes. If no filter is passed, a wildcard search ...
lendingclub/__init__.py
def search(self, filters=None, start_index=0, limit=100): """ Search for a list of notes that can be invested in. (similar to searching for notes in the Browse section on the site) Parameters ---------- filters : lendingclub.filters.*, optional The filter to ...
def search(self, filters=None, start_index=0, limit=100): """ Search for a list of notes that can be invested in. (similar to searching for notes in the Browse section on the site) Parameters ---------- filters : lendingclub.filters.*, optional The filter to ...
[ "Search", "for", "a", "list", "of", "notes", "that", "can", "be", "invested", "in", ".", "(", "similar", "to", "searching", "for", "notes", "in", "the", "Browse", "section", "on", "the", "site", ")" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L325-L378
[ "def", "search", "(", "self", ",", "filters", "=", "None", ",", "start_index", "=", "0", ",", "limit", "=", "100", ")", ":", "assert", "filters", "is", "None", "or", "isinstance", "(", "filters", ",", "Filter", ")", ",", "'filter is not a lendingclub.filte...
4495f99fd869810f39c00e02b0f4112c6b210384
train
LendingClub.build_portfolio
Returns a list of loan notes that are diversified by your min/max percent request and filters. One way to invest in these loan notes, is to start an order and use add_batch to add all the loan fragments to them. (see examples) Parameters ---------- cash : int The tot...
lendingclub/__init__.py
def build_portfolio(self, cash, max_per_note=25, min_percent=0, max_percent=20, filters=None, automatically_invest=False, do_not_clear_staging=False): """ Returns a list of loan notes that are diversified by your min/max percent request and filters. One way to invest in these loan notes, is to s...
def build_portfolio(self, cash, max_per_note=25, min_percent=0, max_percent=20, filters=None, automatically_invest=False, do_not_clear_staging=False): """ Returns a list of loan notes that are diversified by your min/max percent request and filters. One way to invest in these loan notes, is to s...
[ "Returns", "a", "list", "of", "loan", "notes", "that", "are", "diversified", "by", "your", "min", "/", "max", "percent", "request", "and", "filters", ".", "One", "way", "to", "invest", "in", "these", "loan", "notes", "is", "to", "start", "an", "order", ...
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L380-L594
[ "def", "build_portfolio", "(", "self", ",", "cash", ",", "max_per_note", "=", "25", ",", "min_percent", "=", "0", ",", "max_percent", "=", "20", ",", "filters", "=", "None", ",", "automatically_invest", "=", "False", ",", "do_not_clear_staging", "=", "False"...
4495f99fd869810f39c00e02b0f4112c6b210384
train
LendingClub.my_notes
Return all the loan notes you've already invested in. By default it'll return 100 results at a time. Parameters ---------- start_index : int, optional The result index to start on. By default only 100 records will be returned at a time, so use this to start at a later in...
lendingclub/__init__.py
def my_notes(self, start_index=0, limit=100, get_all=False, sort_by='loanId', sort_dir='asc'): """ Return all the loan notes you've already invested in. By default it'll return 100 results at a time. Parameters ---------- start_index : int, optional The result index ...
def my_notes(self, start_index=0, limit=100, get_all=False, sort_by='loanId', sort_dir='asc'): """ Return all the loan notes you've already invested in. By default it'll return 100 results at a time. Parameters ---------- start_index : int, optional The result index ...
[ "Return", "all", "the", "loan", "notes", "you", "ve", "already", "invested", "in", ".", "By", "default", "it", "ll", "return", "100", "results", "at", "a", "time", "." ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L596-L656
[ "def", "my_notes", "(", "self", ",", "start_index", "=", "0", ",", "limit", "=", "100", ",", "get_all", "=", "False", ",", "sort_by", "=", "'loanId'", ",", "sort_dir", "=", "'asc'", ")", ":", "index", "=", "start_index", "notes", "=", "{", "'loans'", ...
4495f99fd869810f39c00e02b0f4112c6b210384
train
LendingClub.get_note
Get a loan note that you've invested in by ID Parameters ---------- note_id : int The note ID Returns ------- dict A dictionary representing the matching note or False Examples -------- >>> from lendingclub import Len...
lendingclub/__init__.py
def get_note(self, note_id): """ Get a loan note that you've invested in by ID Parameters ---------- note_id : int The note ID Returns ------- dict A dictionary representing the matching note or False Examples ---...
def get_note(self, note_id): """ Get a loan note that you've invested in by ID Parameters ---------- note_id : int The note ID Returns ------- dict A dictionary representing the matching note or False Examples ---...
[ "Get", "a", "loan", "note", "that", "you", "ve", "invested", "in", "by", "ID" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L658-L710
[ "def", "get_note", "(", "self", ",", "note_id", ")", ":", "index", "=", "0", "while", "True", ":", "notes", "=", "self", ".", "my_notes", "(", "start_index", "=", "index", ",", "sort_by", "=", "'noteId'", ")", "if", "notes", "[", "'result'", "]", "!=...
4495f99fd869810f39c00e02b0f4112c6b210384
train
LendingClub.search_my_notes
Search for notes you are invested in. Use the parameters to define how to search. Passing no parameters is the same as calling `my_notes(get_all=True)` Parameters ---------- loan_id : int, optional Search for notes for a specific loan. Since a loan is broken up into a pool o...
lendingclub/__init__.py
def search_my_notes(self, loan_id=None, order_id=None, grade=None, portfolio_name=None, status=None, term=None): """ Search for notes you are invested in. Use the parameters to define how to search. Passing no parameters is the same as calling `my_notes(get_all=True)` Parameters ...
def search_my_notes(self, loan_id=None, order_id=None, grade=None, portfolio_name=None, status=None, term=None): """ Search for notes you are invested in. Use the parameters to define how to search. Passing no parameters is the same as calling `my_notes(get_all=True)` Parameters ...
[ "Search", "for", "notes", "you", "are", "invested", "in", ".", "Use", "the", "parameters", "to", "define", "how", "to", "search", ".", "Passing", "no", "parameters", "is", "the", "same", "as", "calling", "my_notes", "(", "get_all", "=", "True", ")" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L712-L808
[ "def", "search_my_notes", "(", "self", ",", "loan_id", "=", "None", ",", "order_id", "=", "None", ",", "grade", "=", "None", ",", "portfolio_name", "=", "None", ",", "status", "=", "None", ",", "term", "=", "None", ")", ":", "assert", "grade", "is", ...
4495f99fd869810f39c00e02b0f4112c6b210384
train
Order.add
Add a loan and amount you want to invest, to your order. If this loan is already in your order, it's amount will be replaced with the this new amount Parameters ---------- loan_id : int or dict The ID of the loan you want to add or a dictionary containing a `loan_id`...
lendingclub/__init__.py
def add(self, loan_id, amount): """ Add a loan and amount you want to invest, to your order. If this loan is already in your order, it's amount will be replaced with the this new amount Parameters ---------- loan_id : int or dict The ID of the loan yo...
def add(self, loan_id, amount): """ Add a loan and amount you want to invest, to your order. If this loan is already in your order, it's amount will be replaced with the this new amount Parameters ---------- loan_id : int or dict The ID of the loan yo...
[ "Add", "a", "loan", "and", "amount", "you", "want", "to", "invest", "to", "your", "order", ".", "If", "this", "loan", "is", "already", "in", "your", "order", "it", "s", "amount", "will", "be", "replaced", "with", "the", "this", "new", "amount" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L906-L928
[ "def", "add", "(", "self", ",", "loan_id", ",", "amount", ")", ":", "assert", "amount", ">", "0", "and", "amount", "%", "25", "==", "0", ",", "'Amount must be a multiple of 25'", "assert", "type", "(", "amount", ")", "in", "(", "float", ",", "int", ")"...
4495f99fd869810f39c00e02b0f4112c6b210384
train
Order.add_batch
Add a batch of loans to your order. Parameters ---------- loans : list A list of dictionary objects representing each loan and the amount you want to invest in it (see examples below). batch_amount : int, optional The dollar amount you want to set on ALL loans in...
lendingclub/__init__.py
def add_batch(self, loans, batch_amount=None): """ Add a batch of loans to your order. Parameters ---------- loans : list A list of dictionary objects representing each loan and the amount you want to invest in it (see examples below). batch_amount : int, opt...
def add_batch(self, loans, batch_amount=None): """ Add a batch of loans to your order. Parameters ---------- loans : list A list of dictionary objects representing each loan and the amount you want to invest in it (see examples below). batch_amount : int, opt...
[ "Add", "a", "batch", "of", "loans", "to", "your", "order", "." ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L943-L994
[ "def", "add_batch", "(", "self", ",", "loans", ",", "batch_amount", "=", "None", ")", ":", "assert", "batch_amount", "is", "None", "or", "batch_amount", "%", "25", "==", "0", ",", "'batch_amount must be a multiple of 25'", "# Add each loan", "assert", "type", "(...
4495f99fd869810f39c00e02b0f4112c6b210384
train
Order.execute
Place the order with LendingClub Parameters ---------- portfolio_name : string The name of the portfolio to add the invested loan notes to. This can be a new or existing portfolio name. Raises ------ LendingClubError Returns ----...
lendingclub/__init__.py
def execute(self, portfolio_name=None): """ Place the order with LendingClub Parameters ---------- portfolio_name : string The name of the portfolio to add the invested loan notes to. This can be a new or existing portfolio name. Raises -...
def execute(self, portfolio_name=None): """ Place the order with LendingClub Parameters ---------- portfolio_name : string The name of the portfolio to add the invested loan notes to. This can be a new or existing portfolio name. Raises -...
[ "Place", "the", "order", "with", "LendingClub" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L1014-L1047
[ "def", "execute", "(", "self", ",", "portfolio_name", "=", "None", ")", ":", "assert", "self", ".", "order_id", "==", "0", ",", "'This order has already been place. Start a new order.'", "assert", "len", "(", "self", ".", "loans", ")", ">", "0", ",", "'There a...
4495f99fd869810f39c00e02b0f4112c6b210384
train
Order.assign_to_portfolio
Assign all the notes in this order to a portfolio Parameters ---------- portfolio_name -- The name of the portfolio to assign it to (new or existing) Raises ------ LendingClubError Returns ------- boolean True on success
lendingclub/__init__.py
def assign_to_portfolio(self, portfolio_name=None): """ Assign all the notes in this order to a portfolio Parameters ---------- portfolio_name -- The name of the portfolio to assign it to (new or existing) Raises ------ LendingClubError Retu...
def assign_to_portfolio(self, portfolio_name=None): """ Assign all the notes in this order to a portfolio Parameters ---------- portfolio_name -- The name of the portfolio to assign it to (new or existing) Raises ------ LendingClubError Retu...
[ "Assign", "all", "the", "notes", "in", "this", "order", "to", "a", "portfolio" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L1049-L1074
[ "def", "assign_to_portfolio", "(", "self", ",", "portfolio_name", "=", "None", ")", ":", "assert", "self", ".", "order_id", ">", "0", ",", "'You need to execute this order before you can assign to a portfolio.'", "# Get loan IDs as a list", "loan_ids", "=", "self", ".", ...
4495f99fd869810f39c00e02b0f4112c6b210384
train
Order.__stage_order
Add all the loans to the LC order session
lendingclub/__init__.py
def __stage_order(self): """ Add all the loans to the LC order session """ # Skip staging...probably not a good idea...you've been warned if self.__already_staged is True and self.__i_know_what_im_doing is True: self.__log('Not staging the order...I hope you know wha...
def __stage_order(self): """ Add all the loans to the LC order session """ # Skip staging...probably not a good idea...you've been warned if self.__already_staged is True and self.__i_know_what_im_doing is True: self.__log('Not staging the order...I hope you know wha...
[ "Add", "all", "the", "loans", "to", "the", "LC", "order", "session" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L1076-L1132
[ "def", "__stage_order", "(", "self", ")", ":", "# Skip staging...probably not a good idea...you've been warned", "if", "self", ".", "__already_staged", "is", "True", "and", "self", ".", "__i_know_what_im_doing", "is", "True", ":", "self", ".", "__log", "(", "'Not stag...
4495f99fd869810f39c00e02b0f4112c6b210384
train
Order.__get_strut_token
Move the staged loan notes to the order stage and get the struts token from the place order HTML. The order will not be placed until calling _confirm_order() Returns ------- dict A dict with the token name and value
lendingclub/__init__.py
def __get_strut_token(self): """ Move the staged loan notes to the order stage and get the struts token from the place order HTML. The order will not be placed until calling _confirm_order() Returns ------- dict A dict with the token name and value ...
def __get_strut_token(self): """ Move the staged loan notes to the order stage and get the struts token from the place order HTML. The order will not be placed until calling _confirm_order() Returns ------- dict A dict with the token name and value ...
[ "Move", "the", "staged", "loan", "notes", "to", "the", "order", "stage", "and", "get", "the", "struts", "token", "from", "the", "place", "order", "HTML", ".", "The", "order", "will", "not", "be", "placed", "until", "calling", "_confirm_order", "()" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L1134-L1183
[ "def", "__get_strut_token", "(", "self", ")", ":", "try", ":", "# Move to the place order page and get the struts token", "response", "=", "self", ".", "lc", ".", "session", ".", "get", "(", "'/portfolio/placeOrder.action'", ")", "soup", "=", "BeautifulSoup", "(", "...
4495f99fd869810f39c00e02b0f4112c6b210384
train
Order.__place_order
Use the struts token to place the order. Parameters ---------- token : string The struts token received from the place order page Returns ------- int The completed order ID.
lendingclub/__init__.py
def __place_order(self, token): """ Use the struts token to place the order. Parameters ---------- token : string The struts token received from the place order page Returns ------- int The completed order ID. """ ...
def __place_order(self, token): """ Use the struts token to place the order. Parameters ---------- token : string The struts token received from the place order page Returns ------- int The completed order ID. """ ...
[ "Use", "the", "struts", "token", "to", "place", "the", "order", "." ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L1185-L1231
[ "def", "__place_order", "(", "self", ",", "token", ")", ":", "order_id", "=", "0", "response", "=", "None", "if", "not", "token", "or", "token", "[", "'value'", "]", "==", "''", ":", "raise", "LendingClubError", "(", "'The token parameter is False, None or unk...
4495f99fd869810f39c00e02b0f4112c6b210384
train
Session.__continue_session
Check if the time since the last HTTP request is under the session timeout limit. If it's been too long since the last request attempt to authenticate again.
lendingclub/session.py
def __continue_session(self): """ Check if the time since the last HTTP request is under the session timeout limit. If it's been too long since the last request attempt to authenticate again. """ now = time.time() diff = abs(now - self.last_request_time) t...
def __continue_session(self): """ Check if the time since the last HTTP request is under the session timeout limit. If it's been too long since the last request attempt to authenticate again. """ now = time.time() diff = abs(now - self.last_request_time) t...
[ "Check", "if", "the", "time", "since", "the", "last", "HTTP", "request", "is", "under", "the", "session", "timeout", "limit", ".", "If", "it", "s", "been", "too", "long", "since", "the", "last", "request", "attempt", "to", "authenticate", "again", "." ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/session.py#L73-L85
[ "def", "__continue_session", "(", "self", ")", ":", "now", "=", "time", ".", "time", "(", ")", "diff", "=", "abs", "(", "now", "-", "self", ".", "last_request_time", ")", "timeout_sec", "=", "self", ".", "session_timeout", "*", "60", "# convert minutes to ...
4495f99fd869810f39c00e02b0f4112c6b210384
train
Session.build_url
Build a LendingClub URL from a URL path (without the domain). Parameters ---------- path : string The path part of the URL after the domain. i.e. https://www.lendingclub.com/<path>
lendingclub/session.py
def build_url(self, path): """ Build a LendingClub URL from a URL path (without the domain). Parameters ---------- path : string The path part of the URL after the domain. i.e. https://www.lendingclub.com/<path> """ url = '{0}{1}'.format(self.base_url...
def build_url(self, path): """ Build a LendingClub URL from a URL path (without the domain). Parameters ---------- path : string The path part of the URL after the domain. i.e. https://www.lendingclub.com/<path> """ url = '{0}{1}'.format(self.base_url...
[ "Build", "a", "LendingClub", "URL", "from", "a", "URL", "path", "(", "without", "the", "domain", ")", "." ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/session.py#L99-L110
[ "def", "build_url", "(", "self", ",", "path", ")", ":", "url", "=", "'{0}{1}'", ".", "format", "(", "self", ".", "base_url", ",", "path", ")", "url", "=", "re", ".", "sub", "(", "'([^:])//'", ",", "'\\\\1/'", ",", "url", ")", "# Remove double slashes",...
4495f99fd869810f39c00e02b0f4112c6b210384
train
Session.authenticate
Authenticate with LendingClub and preserve the user session for future requests. This will raise an exception if the login appears to have failed, otherwise it returns True. Since Lending Club doesn't seem to have a login API, the code has to try to decide if the login worked or not by looking ...
lendingclub/session.py
def authenticate(self, email=None, password=None): """ Authenticate with LendingClub and preserve the user session for future requests. This will raise an exception if the login appears to have failed, otherwise it returns True. Since Lending Club doesn't seem to have a login API, the c...
def authenticate(self, email=None, password=None): """ Authenticate with LendingClub and preserve the user session for future requests. This will raise an exception if the login appears to have failed, otherwise it returns True. Since Lending Club doesn't seem to have a login API, the c...
[ "Authenticate", "with", "LendingClub", "and", "preserve", "the", "user", "session", "for", "future", "requests", ".", "This", "will", "raise", "an", "exception", "if", "the", "login", "appears", "to", "have", "failed", "otherwise", "it", "returns", "True", "."...
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/session.py#L112-L216
[ "def", "authenticate", "(", "self", ",", "email", "=", "None", ",", "password", "=", "None", ")", ":", "# Get email and password", "if", "email", "is", "None", ":", "email", "=", "self", ".", "email", "else", ":", "self", ".", "email", "=", "email", "i...
4495f99fd869810f39c00e02b0f4112c6b210384
train
Session.is_site_available
Returns true if we can access LendingClub.com This is also a simple test to see if there's a network connection Returns ------- boolean True or False
lendingclub/session.py
def is_site_available(self): """ Returns true if we can access LendingClub.com This is also a simple test to see if there's a network connection Returns ------- boolean True or False """ try: response = requests.head(self.base_url)...
def is_site_available(self): """ Returns true if we can access LendingClub.com This is also a simple test to see if there's a network connection Returns ------- boolean True or False """ try: response = requests.head(self.base_url)...
[ "Returns", "true", "if", "we", "can", "access", "LendingClub", ".", "com", "This", "is", "also", "a", "simple", "test", "to", "see", "if", "there", "s", "a", "network", "connection" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/session.py#L218-L233
[ "def", "is_site_available", "(", "self", ")", ":", "try", ":", "response", "=", "requests", ".", "head", "(", "self", ".", "base_url", ")", "status", "=", "response", ".", "status_code", "return", "200", "<=", "status", "<", "400", "# Returns true if the sta...
4495f99fd869810f39c00e02b0f4112c6b210384
train
Session.request
Sends HTTP request to LendingClub. Parameters ---------- method : {GET, POST, HEAD, DELETE} The HTTP method to use: GET, POST, HEAD or DELETE path : string The path that will be appended to the domain defined in :attr:`base_url`. query : dict ...
lendingclub/session.py
def request(self, method, path, query=None, data=None, redirects=True): """ Sends HTTP request to LendingClub. Parameters ---------- method : {GET, POST, HEAD, DELETE} The HTTP method to use: GET, POST, HEAD or DELETE path : string The path that w...
def request(self, method, path, query=None, data=None, redirects=True): """ Sends HTTP request to LendingClub. Parameters ---------- method : {GET, POST, HEAD, DELETE} The HTTP method to use: GET, POST, HEAD or DELETE path : string The path that w...
[ "Sends", "HTTP", "request", "to", "LendingClub", "." ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/session.py#L235-L290
[ "def", "request", "(", "self", ",", "method", ",", "path", ",", "query", "=", "None", ",", "data", "=", "None", ",", "redirects", "=", "True", ")", ":", "# Check session time", "self", ".", "__continue_session", "(", ")", "try", ":", "url", "=", "self"...
4495f99fd869810f39c00e02b0f4112c6b210384
train
Session.post
POST request wrapper for :func:`request()`
lendingclub/session.py
def post(self, path, query=None, data=None, redirects=True): """ POST request wrapper for :func:`request()` """ return self.request('POST', path, query, data, redirects)
def post(self, path, query=None, data=None, redirects=True): """ POST request wrapper for :func:`request()` """ return self.request('POST', path, query, data, redirects)
[ "POST", "request", "wrapper", "for", ":", "func", ":", "request", "()" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/session.py#L292-L296
[ "def", "post", "(", "self", ",", "path", ",", "query", "=", "None", ",", "data", "=", "None", ",", "redirects", "=", "True", ")", ":", "return", "self", ".", "request", "(", "'POST'", ",", "path", ",", "query", ",", "data", ",", "redirects", ")" ]
4495f99fd869810f39c00e02b0f4112c6b210384
train
Session.get
GET request wrapper for :func:`request()`
lendingclub/session.py
def get(self, path, query=None, redirects=True): """ GET request wrapper for :func:`request()` """ return self.request('GET', path, query, None, redirects)
def get(self, path, query=None, redirects=True): """ GET request wrapper for :func:`request()` """ return self.request('GET', path, query, None, redirects)
[ "GET", "request", "wrapper", "for", ":", "func", ":", "request", "()" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/session.py#L298-L302
[ "def", "get", "(", "self", ",", "path", ",", "query", "=", "None", ",", "redirects", "=", "True", ")", ":", "return", "self", ".", "request", "(", "'GET'", ",", "path", ",", "query", ",", "None", ",", "redirects", ")" ]
4495f99fd869810f39c00e02b0f4112c6b210384
train
Session.head
HEAD request wrapper for :func:`request()`
lendingclub/session.py
def head(self, path, query=None, data=None, redirects=True): """ HEAD request wrapper for :func:`request()` """ return self.request('HEAD', path, query, None, redirects)
def head(self, path, query=None, data=None, redirects=True): """ HEAD request wrapper for :func:`request()` """ return self.request('HEAD', path, query, None, redirects)
[ "HEAD", "request", "wrapper", "for", ":", "func", ":", "request", "()" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/session.py#L304-L308
[ "def", "head", "(", "self", ",", "path", ",", "query", "=", "None", ",", "data", "=", "None", ",", "redirects", "=", "True", ")", ":", "return", "self", ".", "request", "(", "'HEAD'", ",", "path", ",", "query", ",", "None", ",", "redirects", ")" ]
4495f99fd869810f39c00e02b0f4112c6b210384
train
Session.json_success
Check the JSON response object for the success flag Parameters ---------- json : dict A dictionary representing a JSON object from lendingclub.com
lendingclub/session.py
def json_success(self, json): """ Check the JSON response object for the success flag Parameters ---------- json : dict A dictionary representing a JSON object from lendingclub.com """ if type(json) is dict and 'result' in json and json['result'] == '...
def json_success(self, json): """ Check the JSON response object for the success flag Parameters ---------- json : dict A dictionary representing a JSON object from lendingclub.com """ if type(json) is dict and 'result' in json and json['result'] == '...
[ "Check", "the", "JSON", "response", "object", "for", "the", "success", "flag" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/session.py#L316-L327
[ "def", "json_success", "(", "self", ",", "json", ")", ":", "if", "type", "(", "json", ")", "is", "dict", "and", "'result'", "in", "json", "and", "json", "[", "'result'", "]", "==", "'success'", ":", "return", "True", "return", "False" ]
4495f99fd869810f39c00e02b0f4112c6b210384
train
Filter.__merge_values
Merge dictionary objects recursively, by only updating keys existing in to_dict
lendingclub/filters.py
def __merge_values(self, from_dict, to_dict): """ Merge dictionary objects recursively, by only updating keys existing in to_dict """ for key, value in from_dict.iteritems(): # Only if the key already exists if key in to_dict: # Make sure the val...
def __merge_values(self, from_dict, to_dict): """ Merge dictionary objects recursively, by only updating keys existing in to_dict """ for key, value in from_dict.iteritems(): # Only if the key already exists if key in to_dict: # Make sure the val...
[ "Merge", "dictionary", "objects", "recursively", "by", "only", "updating", "keys", "existing", "in", "to_dict" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/filters.py#L159-L179
[ "def", "__merge_values", "(", "self", ",", "from_dict", ",", "to_dict", ")", ":", "for", "key", ",", "value", "in", "from_dict", ".", "iteritems", "(", ")", ":", "# Only if the key already exists", "if", "key", "in", "to_dict", ":", "# Make sure the values are t...
4495f99fd869810f39c00e02b0f4112c6b210384
train
Filter.__normalize_grades
Adjust the grades list. If a grade has been set, set All to false
lendingclub/filters.py
def __normalize_grades(self): """ Adjust the grades list. If a grade has been set, set All to false """ if 'grades' in self and self['grades']['All'] is True: for grade in self['grades']: if grade != 'All' and self['grades'][grade] is True: ...
def __normalize_grades(self): """ Adjust the grades list. If a grade has been set, set All to false """ if 'grades' in self and self['grades']['All'] is True: for grade in self['grades']: if grade != 'All' and self['grades'][grade] is True: ...
[ "Adjust", "the", "grades", "list", ".", "If", "a", "grade", "has", "been", "set", "set", "All", "to", "false" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/filters.py#L197-L207
[ "def", "__normalize_grades", "(", "self", ")", ":", "if", "'grades'", "in", "self", "and", "self", "[", "'grades'", "]", "[", "'All'", "]", "is", "True", ":", "for", "grade", "in", "self", "[", "'grades'", "]", ":", "if", "grade", "!=", "'All'", "and...
4495f99fd869810f39c00e02b0f4112c6b210384
train
Filter.__normalize_progress
Adjust the funding progress filter to be a factor of 10
lendingclub/filters.py
def __normalize_progress(self): """ Adjust the funding progress filter to be a factor of 10 """ progress = self['funding_progress'] if progress % 10 != 0: progress = round(float(progress) / 10) progress = int(progress) * 10 self['funding_prog...
def __normalize_progress(self): """ Adjust the funding progress filter to be a factor of 10 """ progress = self['funding_progress'] if progress % 10 != 0: progress = round(float(progress) / 10) progress = int(progress) * 10 self['funding_prog...
[ "Adjust", "the", "funding", "progress", "filter", "to", "be", "a", "factor", "of", "10" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/filters.py#L209-L219
[ "def", "__normalize_progress", "(", "self", ")", ":", "progress", "=", "self", "[", "'funding_progress'", "]", "if", "progress", "%", "10", "!=", "0", ":", "progress", "=", "round", "(", "float", "(", "progress", ")", "/", "10", ")", "progress", "=", "...
4495f99fd869810f39c00e02b0f4112c6b210384
train
Filter.__normalize
Adjusts the values of the filters to be correct. For example, if you set grade 'B' to True, then 'All' should be set to False
lendingclub/filters.py
def __normalize(self): """ Adjusts the values of the filters to be correct. For example, if you set grade 'B' to True, then 'All' should be set to False """ # Don't normalize if we're already normalizing or intializing if self.__normalizing is True or self.__init...
def __normalize(self): """ Adjusts the values of the filters to be correct. For example, if you set grade 'B' to True, then 'All' should be set to False """ # Don't normalize if we're already normalizing or intializing if self.__normalizing is True or self.__init...
[ "Adjusts", "the", "values", "of", "the", "filters", "to", "be", "correct", ".", "For", "example", "if", "you", "set", "grade", "B", "to", "True", "then", "All", "should", "be", "set", "to", "False" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/filters.py#L221-L235
[ "def", "__normalize", "(", "self", ")", ":", "# Don't normalize if we're already normalizing or intializing", "if", "self", ".", "__normalizing", "is", "True", "or", "self", ".", "__initialized", "is", "False", ":", "return", "self", ".", "__normalizing", "=", "True...
4495f99fd869810f39c00e02b0f4112c6b210384
train
Filter.validate_one
Validate a single loan result record against the filters Parameters ---------- loan : dict A single loan note record Returns ------- boolean True or raises FilterValidationError Raises ------ FilterValidationError ...
lendingclub/filters.py
def validate_one(self, loan): """ Validate a single loan result record against the filters Parameters ---------- loan : dict A single loan note record Returns ------- boolean True or raises FilterValidationError Raises ...
def validate_one(self, loan): """ Validate a single loan result record against the filters Parameters ---------- loan : dict A single loan note record Returns ------- boolean True or raises FilterValidationError Raises ...
[ "Validate", "a", "single", "loan", "result", "record", "against", "the", "filters" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/filters.py#L265-L344
[ "def", "validate_one", "(", "self", ",", "loan", ")", ":", "assert", "type", "(", "loan", ")", "is", "dict", ",", "'loan parameter must be a dictionary object'", "# Map the loan value keys to the filter keys", "req", "=", "{", "'loanGUID'", ":", "'loan_id'", ",", "'...
4495f99fd869810f39c00e02b0f4112c6b210384
train
Filter.search_string
Returns the JSON string that LendingClub expects for it's search
lendingclub/filters.py
def search_string(self): """" Returns the JSON string that LendingClub expects for it's search """ self.__normalize() # Get the template tmpl_source = unicode(open(self.tmpl_file).read()) # Process template compiler = Compiler() template = compil...
def search_string(self): """" Returns the JSON string that LendingClub expects for it's search """ self.__normalize() # Get the template tmpl_source = unicode(open(self.tmpl_file).read()) # Process template compiler = Compiler() template = compil...
[ "Returns", "the", "JSON", "string", "that", "LendingClub", "expects", "for", "it", "s", "search" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/filters.py#L346-L380
[ "def", "search_string", "(", "self", ")", ":", "self", ".", "__normalize", "(", ")", "# Get the template", "tmpl_source", "=", "unicode", "(", "open", "(", "self", ".", "tmpl_file", ")", ".", "read", "(", ")", ")", "# Process template", "compiler", "=", "C...
4495f99fd869810f39c00e02b0f4112c6b210384
train
SavedFilter.all_filters
Get a list of all your saved filters Parameters ---------- lc : :py:class:`lendingclub.LendingClub` An instance of the authenticated LendingClub class Returns ------- list A list of lendingclub.filters.SavedFilter objects
lendingclub/filters.py
def all_filters(lc): """ Get a list of all your saved filters Parameters ---------- lc : :py:class:`lendingclub.LendingClub` An instance of the authenticated LendingClub class Returns ------- list A list of lendingclub.filters.Sav...
def all_filters(lc): """ Get a list of all your saved filters Parameters ---------- lc : :py:class:`lendingclub.LendingClub` An instance of the authenticated LendingClub class Returns ------- list A list of lendingclub.filters.Sav...
[ "Get", "a", "list", "of", "all", "your", "saved", "filters" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/filters.py#L431-L455
[ "def", "all_filters", "(", "lc", ")", ":", "filters", "=", "[", "]", "response", "=", "lc", ".", "session", ".", "get", "(", "'/browse/getSavedFiltersAj.action'", ")", "json_response", "=", "response", ".", "json", "(", ")", "# Load all filters", "if", "lc",...
4495f99fd869810f39c00e02b0f4112c6b210384
train
SavedFilter.load
Load the filter from the server
lendingclub/filters.py
def load(self): """ Load the filter from the server """ # Attempt to load the saved filter payload = { 'id': self.id } response = self.lc.session.get('/browse/getSavedFilterAj.action', query=payload) self.response = response json_respo...
def load(self): """ Load the filter from the server """ # Attempt to load the saved filter payload = { 'id': self.id } response = self.lc.session.get('/browse/getSavedFilterAj.action', query=payload) self.response = response json_respo...
[ "Load", "the", "filter", "from", "the", "server" ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/filters.py#L468-L561
[ "def", "load", "(", "self", ")", ":", "# Attempt to load the saved filter", "payload", "=", "{", "'id'", ":", "self", ".", "id", "}", "response", "=", "self", ".", "lc", ".", "session", ".", "get", "(", "'/browse/getSavedFilterAj.action'", ",", "query", "=",...
4495f99fd869810f39c00e02b0f4112c6b210384
train
SavedFilter.__analyze
Analyze the filter JSON and attempt to parse out the individual filters.
lendingclub/filters.py
def __analyze(self): """ Analyze the filter JSON and attempt to parse out the individual filters. """ filter_values = {} # ID to filter name mapping name_map = { 10: 'grades', 11: 'loan_purpose', 13: 'approved', 15: 'fundin...
def __analyze(self): """ Analyze the filter JSON and attempt to parse out the individual filters. """ filter_values = {} # ID to filter name mapping name_map = { 10: 'grades', 11: 'loan_purpose', 13: 'approved', 15: 'fundin...
[ "Analyze", "the", "filter", "JSON", "and", "attempt", "to", "parse", "out", "the", "individual", "filters", "." ]
jgillick/LendingClub
python
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/filters.py#L572-L634
[ "def", "__analyze", "(", "self", ")", ":", "filter_values", "=", "{", "}", "# ID to filter name mapping", "name_map", "=", "{", "10", ":", "'grades'", ",", "11", ":", "'loan_purpose'", ",", "13", ":", "'approved'", ",", "15", ":", "'funding_progress'", ",", ...
4495f99fd869810f39c00e02b0f4112c6b210384
train
_float_copy_to_out
Copy origin to out and return it. If ``out`` is None, a new copy (casted to floating point) is used. If ``out`` and ``origin`` are the same, we simply return it. Otherwise we copy the values.
dcor/_dcor_internals.py
def _float_copy_to_out(out, origin): """ Copy origin to out and return it. If ``out`` is None, a new copy (casted to floating point) is used. If ``out`` and ``origin`` are the same, we simply return it. Otherwise we copy the values. """ if out is None: out = origin / 1 # The divis...
def _float_copy_to_out(out, origin): """ Copy origin to out and return it. If ``out`` is None, a new copy (casted to floating point) is used. If ``out`` and ``origin`` are the same, we simply return it. Otherwise we copy the values. """ if out is None: out = origin / 1 # The divis...
[ "Copy", "origin", "to", "out", "and", "return", "it", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor_internals.py#L40-L53
[ "def", "_float_copy_to_out", "(", "out", ",", "origin", ")", ":", "if", "out", "is", "None", ":", "out", "=", "origin", "/", "1", "# The division forces cast to a floating point type", "elif", "out", "is", "not", "origin", ":", "np", ".", "copyto", "(", "out...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_double_centered_imp
Real implementation of :func:`double_centered`. This function is used to make parameter ``out`` keyword-only in Python 2.
dcor/_dcor_internals.py
def _double_centered_imp(a, out=None): """ Real implementation of :func:`double_centered`. This function is used to make parameter ``out`` keyword-only in Python 2. """ out = _float_copy_to_out(out, a) dim = np.size(a, 0) mu = np.sum(a) / (dim * dim) sum_cols = np.sum(a, 0, keepd...
def _double_centered_imp(a, out=None): """ Real implementation of :func:`double_centered`. This function is used to make parameter ``out`` keyword-only in Python 2. """ out = _float_copy_to_out(out, a) dim = np.size(a, 0) mu = np.sum(a) / (dim * dim) sum_cols = np.sum(a, 0, keepd...
[ "Real", "implementation", "of", ":", "func", ":", "double_centered", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor_internals.py#L56-L79
[ "def", "_double_centered_imp", "(", "a", ",", "out", "=", "None", ")", ":", "out", "=", "_float_copy_to_out", "(", "out", ",", "a", ")", "dim", "=", "np", ".", "size", "(", "a", ",", "0", ")", "mu", "=", "np", ".", "sum", "(", "a", ")", "/", ...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_u_centered_imp
Real implementation of :func:`u_centered`. This function is used to make parameter ``out`` keyword-only in Python 2.
dcor/_dcor_internals.py
def _u_centered_imp(a, out=None): """ Real implementation of :func:`u_centered`. This function is used to make parameter ``out`` keyword-only in Python 2. """ out = _float_copy_to_out(out, a) dim = np.size(a, 0) u_mu = np.sum(a) / ((dim - 1) * (dim - 2)) sum_cols = np.sum(a, 0, k...
def _u_centered_imp(a, out=None): """ Real implementation of :func:`u_centered`. This function is used to make parameter ``out`` keyword-only in Python 2. """ out = _float_copy_to_out(out, a) dim = np.size(a, 0) u_mu = np.sum(a) / ((dim - 1) * (dim - 2)) sum_cols = np.sum(a, 0, k...
[ "Real", "implementation", "of", ":", "func", ":", "u_centered", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor_internals.py#L146-L172
[ "def", "_u_centered_imp", "(", "a", ",", "out", "=", "None", ")", ":", "out", "=", "_float_copy_to_out", "(", "out", ",", "a", ")", "dim", "=", "np", ".", "size", "(", "a", ",", "0", ")", "u_mu", "=", "np", ".", "sum", "(", "a", ")", "/", "("...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
u_product
r""" Inner product in the Hilbert space of :math:`U`-centered distance matrices. This inner product is defined as .. math:: \frac{1}{n(n-3)} \sum_{i,j=1}^n a_{i, j} b_{i, j} Parameters ---------- a: array_like First input array to be multiplied. b: array_like Secon...
dcor/_dcor_internals.py
def u_product(a, b): r""" Inner product in the Hilbert space of :math:`U`-centered distance matrices. This inner product is defined as .. math:: \frac{1}{n(n-3)} \sum_{i,j=1}^n a_{i, j} b_{i, j} Parameters ---------- a: array_like First input array to be multiplied. b:...
def u_product(a, b): r""" Inner product in the Hilbert space of :math:`U`-centered distance matrices. This inner product is defined as .. math:: \frac{1}{n(n-3)} \sum_{i,j=1}^n a_{i, j} b_{i, j} Parameters ---------- a: array_like First input array to be multiplied. b:...
[ "r", "Inner", "product", "in", "the", "Hilbert", "space", "of", ":", "math", ":", "U", "-", "centered", "distance", "matrices", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor_internals.py#L294-L367
[ "def", "u_product", "(", "a", ",", "b", ")", ":", "n", "=", "np", ".", "size", "(", "a", ",", "0", ")", "return", "np", ".", "sum", "(", "a", "*", "b", ")", "/", "(", "n", "*", "(", "n", "-", "3", ")", ")" ]
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
u_projection
r""" Return the orthogonal projection function over :math:`a`. The function returned computes the orthogonal projection over :math:`a` in the Hilbert space of :math:`U`-centered distance matrices. The projection of a matrix :math:`B` over a matrix :math:`A` is defined as .. math:: ...
dcor/_dcor_internals.py
def u_projection(a): r""" Return the orthogonal projection function over :math:`a`. The function returned computes the orthogonal projection over :math:`a` in the Hilbert space of :math:`U`-centered distance matrices. The projection of a matrix :math:`B` over a matrix :math:`A` is defined ...
def u_projection(a): r""" Return the orthogonal projection function over :math:`a`. The function returned computes the orthogonal projection over :math:`a` in the Hilbert space of :math:`U`-centered distance matrices. The projection of a matrix :math:`B` over a matrix :math:`A` is defined ...
[ "r", "Return", "the", "orthogonal", "projection", "function", "over", ":", "math", ":", "a", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor_internals.py#L370-L480
[ "def", "u_projection", "(", "a", ")", ":", "c", "=", "a", "denominator", "=", "u_product", "(", "c", ",", "c", ")", "docstring", "=", "\"\"\"\n Orthogonal projection over a :math:`U`-centered distance matrix.\n\n This function was returned by :code:`u_projection`. The com...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
u_complementary_projection
r""" Return the orthogonal projection function over :math:`a^{\perp}`. The function returned computes the orthogonal projection over :math:`a^{\perp}` (the complementary projection over a) in the Hilbert space of :math:`U`-centered distance matrices. The projection of a matrix :math:`B` over a mat...
dcor/_dcor_internals.py
def u_complementary_projection(a): r""" Return the orthogonal projection function over :math:`a^{\perp}`. The function returned computes the orthogonal projection over :math:`a^{\perp}` (the complementary projection over a) in the Hilbert space of :math:`U`-centered distance matrices. The proj...
def u_complementary_projection(a): r""" Return the orthogonal projection function over :math:`a^{\perp}`. The function returned computes the orthogonal projection over :math:`a^{\perp}` (the complementary projection over a) in the Hilbert space of :math:`U`-centered distance matrices. The proj...
[ "r", "Return", "the", "orthogonal", "projection", "function", "over", ":", "math", ":", "a^", "{", "\\", "perp", "}", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor_internals.py#L483-L573
[ "def", "u_complementary_projection", "(", "a", ")", ":", "proj", "=", "u_projection", "(", "a", ")", "def", "projection", "(", "a", ")", ":", "\"\"\"\n Orthogonal projection over the complementary space.\n\n This function was returned by :code:`u_complementary_proje...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_distance_matrix_generic
Compute a centered distance matrix given a matrix.
dcor/_dcor_internals.py
def _distance_matrix_generic(x, centering, exponent=1): """Compute a centered distance matrix given a matrix.""" _check_valid_dcov_exponent(exponent) x = _transform_to_2d(x) # Calculate distance matrices a = distances.pairwise_distances(x, exponent=exponent) # Double centering a = centeri...
def _distance_matrix_generic(x, centering, exponent=1): """Compute a centered distance matrix given a matrix.""" _check_valid_dcov_exponent(exponent) x = _transform_to_2d(x) # Calculate distance matrices a = distances.pairwise_distances(x, exponent=exponent) # Double centering a = centeri...
[ "Compute", "a", "centered", "distance", "matrix", "given", "a", "matrix", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor_internals.py#L576-L588
[ "def", "_distance_matrix_generic", "(", "x", ",", "centering", ",", "exponent", "=", "1", ")", ":", "_check_valid_dcov_exponent", "(", "exponent", ")", "x", "=", "_transform_to_2d", "(", "x", ")", "# Calculate distance matrices", "a", "=", "distances", ".", "pai...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_af_inv_scaled
Scale a random vector for using the affinely invariant measures
dcor/_dcor_internals.py
def _af_inv_scaled(x): """Scale a random vector for using the affinely invariant measures""" x = _transform_to_2d(x) cov_matrix = np.atleast_2d(np.cov(x, rowvar=False)) cov_matrix_power = _mat_sqrt_inv(cov_matrix) return x.dot(cov_matrix_power)
def _af_inv_scaled(x): """Scale a random vector for using the affinely invariant measures""" x = _transform_to_2d(x) cov_matrix = np.atleast_2d(np.cov(x, rowvar=False)) cov_matrix_power = _mat_sqrt_inv(cov_matrix) return x.dot(cov_matrix_power)
[ "Scale", "a", "random", "vector", "for", "using", "the", "affinely", "invariant", "measures" ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor_internals.py#L615-L623
[ "def", "_af_inv_scaled", "(", "x", ")", ":", "x", "=", "_transform_to_2d", "(", "x", ")", "cov_matrix", "=", "np", ".", "atleast_2d", "(", "np", ".", "cov", "(", "x", ",", "rowvar", "=", "False", ")", ")", "cov_matrix_power", "=", "_mat_sqrt_inv", "(",...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
partial_distance_covariance
Partial distance covariance estimator. Compute the estimator for the partial distance covariance of the random vectors corresponding to :math:`x` and :math:`y` with respect to the random variable corresponding to :math:`z`. Parameters ---------- x: array_like First random vector. The c...
dcor/_partial_dcor.py
def partial_distance_covariance(x, y, z): """ Partial distance covariance estimator. Compute the estimator for the partial distance covariance of the random vectors corresponding to :math:`x` and :math:`y` with respect to the random variable corresponding to :math:`z`. Parameters ---------...
def partial_distance_covariance(x, y, z): """ Partial distance covariance estimator. Compute the estimator for the partial distance covariance of the random vectors corresponding to :math:`x` and :math:`y` with respect to the random variable corresponding to :math:`z`. Parameters ---------...
[ "Partial", "distance", "covariance", "estimator", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_partial_dcor.py#L13-L70
[ "def", "partial_distance_covariance", "(", "x", ",", "y", ",", "z", ")", ":", "a", "=", "_u_distance_matrix", "(", "x", ")", "b", "=", "_u_distance_matrix", "(", "y", ")", "c", "=", "_u_distance_matrix", "(", "z", ")", "proj", "=", "u_complementary_project...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
partial_distance_correlation
Partial distance correlation estimator. Compute the estimator for the partial distance correlation of the random vectors corresponding to :math:`x` and :math:`y` with respect to the random variable corresponding to :math:`z`. Parameters ---------- x: array_like First random vector. The...
dcor/_partial_dcor.py
def partial_distance_correlation(x, y, z): # pylint:disable=too-many-locals """ Partial distance correlation estimator. Compute the estimator for the partial distance correlation of the random vectors corresponding to :math:`x` and :math:`y` with respect to the random variable corresponding to :ma...
def partial_distance_correlation(x, y, z): # pylint:disable=too-many-locals """ Partial distance correlation estimator. Compute the estimator for the partial distance correlation of the random vectors corresponding to :math:`x` and :math:`y` with respect to the random variable corresponding to :ma...
[ "Partial", "distance", "correlation", "estimator", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_partial_dcor.py#L73-L145
[ "def", "partial_distance_correlation", "(", "x", ",", "y", ",", "z", ")", ":", "# pylint:disable=too-many-locals", "a", "=", "_u_distance_matrix", "(", "x", ")", "b", "=", "_u_distance_matrix", "(", "y", ")", "c", "=", "_u_distance_matrix", "(", "z", ")", "a...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_energy_distance_from_distance_matrices
Compute energy distance with precalculated distance matrices.
dcor/_energy.py
def _energy_distance_from_distance_matrices( distance_xx, distance_yy, distance_xy): """Compute energy distance with precalculated distance matrices.""" return (2 * np.mean(distance_xy) - np.mean(distance_xx) - np.mean(distance_yy))
def _energy_distance_from_distance_matrices( distance_xx, distance_yy, distance_xy): """Compute energy distance with precalculated distance matrices.""" return (2 * np.mean(distance_xy) - np.mean(distance_xx) - np.mean(distance_yy))
[ "Compute", "energy", "distance", "with", "precalculated", "distance", "matrices", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_energy.py#L24-L28
[ "def", "_energy_distance_from_distance_matrices", "(", "distance_xx", ",", "distance_yy", ",", "distance_xy", ")", ":", "return", "(", "2", "*", "np", ".", "mean", "(", "distance_xy", ")", "-", "np", ".", "mean", "(", "distance_xx", ")", "-", "np", ".", "m...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_energy_distance_imp
Real implementation of :func:`energy_distance`. This function is used to make parameter ``exponent`` keyword-only in Python 2.
dcor/_energy.py
def _energy_distance_imp(x, y, exponent=1): """ Real implementation of :func:`energy_distance`. This function is used to make parameter ``exponent`` keyword-only in Python 2. """ x = _transform_to_2d(x) y = _transform_to_2d(y) _check_valid_energy_exponent(exponent) distance_xx = ...
def _energy_distance_imp(x, y, exponent=1): """ Real implementation of :func:`energy_distance`. This function is used to make parameter ``exponent`` keyword-only in Python 2. """ x = _transform_to_2d(x) y = _transform_to_2d(y) _check_valid_energy_exponent(exponent) distance_xx = ...
[ "Real", "implementation", "of", ":", "func", ":", "energy_distance", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_energy.py#L31-L50
[ "def", "_energy_distance_imp", "(", "x", ",", "y", ",", "exponent", "=", "1", ")", ":", "x", "=", "_transform_to_2d", "(", "x", ")", "y", "=", "_transform_to_2d", "(", "y", ")", "_check_valid_energy_exponent", "(", "exponent", ")", "distance_xx", "=", "dis...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_distance_covariance_sqr_naive
Naive biased estimator for distance covariance. Computes the unbiased estimator for distance covariance between two matrices, using an :math:`O(N^2)` algorithm.
dcor/_dcor.py
def _distance_covariance_sqr_naive(x, y, exponent=1): """ Naive biased estimator for distance covariance. Computes the unbiased estimator for distance covariance between two matrices, using an :math:`O(N^2)` algorithm. """ a = _distance_matrix(x, exponent=exponent) b = _distance_matrix(y, e...
def _distance_covariance_sqr_naive(x, y, exponent=1): """ Naive biased estimator for distance covariance. Computes the unbiased estimator for distance covariance between two matrices, using an :math:`O(N^2)` algorithm. """ a = _distance_matrix(x, exponent=exponent) b = _distance_matrix(y, e...
[ "Naive", "biased", "estimator", "for", "distance", "covariance", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor.py#L34-L44
[ "def", "_distance_covariance_sqr_naive", "(", "x", ",", "y", ",", "exponent", "=", "1", ")", ":", "a", "=", "_distance_matrix", "(", "x", ",", "exponent", "=", "exponent", ")", "b", "=", "_distance_matrix", "(", "y", ",", "exponent", "=", "exponent", ")"...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_u_distance_covariance_sqr_naive
Naive unbiased estimator for distance covariance. Computes the unbiased estimator for distance covariance between two matrices, using an :math:`O(N^2)` algorithm.
dcor/_dcor.py
def _u_distance_covariance_sqr_naive(x, y, exponent=1): """ Naive unbiased estimator for distance covariance. Computes the unbiased estimator for distance covariance between two matrices, using an :math:`O(N^2)` algorithm. """ a = _u_distance_matrix(x, exponent=exponent) b = _u_distance_mat...
def _u_distance_covariance_sqr_naive(x, y, exponent=1): """ Naive unbiased estimator for distance covariance. Computes the unbiased estimator for distance covariance between two matrices, using an :math:`O(N^2)` algorithm. """ a = _u_distance_matrix(x, exponent=exponent) b = _u_distance_mat...
[ "Naive", "unbiased", "estimator", "for", "distance", "covariance", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor.py#L47-L57
[ "def", "_u_distance_covariance_sqr_naive", "(", "x", ",", "y", ",", "exponent", "=", "1", ")", ":", "a", "=", "_u_distance_matrix", "(", "x", ",", "exponent", "=", "exponent", ")", "b", "=", "_u_distance_matrix", "(", "y", ",", "exponent", "=", "exponent",...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_distance_sqr_stats_naive_generic
Compute generic squared stats.
dcor/_dcor.py
def _distance_sqr_stats_naive_generic(x, y, matrix_centered, product, exponent=1): """Compute generic squared stats.""" a = matrix_centered(x, exponent=exponent) b = matrix_centered(y, exponent=exponent) covariance_xy_sqr = product(a, b) variance_x_sqr = produc...
def _distance_sqr_stats_naive_generic(x, y, matrix_centered, product, exponent=1): """Compute generic squared stats.""" a = matrix_centered(x, exponent=exponent) b = matrix_centered(y, exponent=exponent) covariance_xy_sqr = product(a, b) variance_x_sqr = produc...
[ "Compute", "generic", "squared", "stats", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor.py#L60-L83
[ "def", "_distance_sqr_stats_naive_generic", "(", "x", ",", "y", ",", "matrix_centered", ",", "product", ",", "exponent", "=", "1", ")", ":", "a", "=", "matrix_centered", "(", "x", ",", "exponent", "=", "exponent", ")", "b", "=", "matrix_centered", "(", "y"...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_distance_correlation_sqr_naive
Biased distance correlation estimator between two matrices.
dcor/_dcor.py
def _distance_correlation_sqr_naive(x, y, exponent=1): """Biased distance correlation estimator between two matrices.""" return _distance_sqr_stats_naive_generic( x, y, matrix_centered=_distance_matrix, product=mean_product, exponent=exponent).correlation_xy
def _distance_correlation_sqr_naive(x, y, exponent=1): """Biased distance correlation estimator between two matrices.""" return _distance_sqr_stats_naive_generic( x, y, matrix_centered=_distance_matrix, product=mean_product, exponent=exponent).correlation_xy
[ "Biased", "distance", "correlation", "estimator", "between", "two", "matrices", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor.py#L86-L92
[ "def", "_distance_correlation_sqr_naive", "(", "x", ",", "y", ",", "exponent", "=", "1", ")", ":", "return", "_distance_sqr_stats_naive_generic", "(", "x", ",", "y", ",", "matrix_centered", "=", "_distance_matrix", ",", "product", "=", "mean_product", ",", "expo...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_u_distance_correlation_sqr_naive
Bias-corrected distance correlation estimator between two matrices.
dcor/_dcor.py
def _u_distance_correlation_sqr_naive(x, y, exponent=1): """Bias-corrected distance correlation estimator between two matrices.""" return _distance_sqr_stats_naive_generic( x, y, matrix_centered=_u_distance_matrix, product=u_product, exponent=exponent).correlation_xy
def _u_distance_correlation_sqr_naive(x, y, exponent=1): """Bias-corrected distance correlation estimator between two matrices.""" return _distance_sqr_stats_naive_generic( x, y, matrix_centered=_u_distance_matrix, product=u_product, exponent=exponent).correlation_xy
[ "Bias", "-", "corrected", "distance", "correlation", "estimator", "between", "two", "matrices", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor.py#L95-L101
[ "def", "_u_distance_correlation_sqr_naive", "(", "x", ",", "y", ",", "exponent", "=", "1", ")", ":", "return", "_distance_sqr_stats_naive_generic", "(", "x", ",", "y", ",", "matrix_centered", "=", "_u_distance_matrix", ",", "product", "=", "u_product", ",", "exp...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_can_use_fast_algorithm
Check if the fast algorithm for distance stats can be used. The fast algorithm has complexity :math:`O(NlogN)`, better than the complexity of the naive algorithm (:math:`O(N^2)`). The algorithm can only be used for random variables (not vectors) where the number of instances is greater than 3. Also, t...
dcor/_dcor.py
def _can_use_fast_algorithm(x, y, exponent=1): """ Check if the fast algorithm for distance stats can be used. The fast algorithm has complexity :math:`O(NlogN)`, better than the complexity of the naive algorithm (:math:`O(N^2)`). The algorithm can only be used for random variables (not vectors) w...
def _can_use_fast_algorithm(x, y, exponent=1): """ Check if the fast algorithm for distance stats can be used. The fast algorithm has complexity :math:`O(NlogN)`, better than the complexity of the naive algorithm (:math:`O(N^2)`). The algorithm can only be used for random variables (not vectors) w...
[ "Check", "if", "the", "fast", "algorithm", "for", "distance", "stats", "can", "be", "used", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor.py#L115-L127
[ "def", "_can_use_fast_algorithm", "(", "x", ",", "y", ",", "exponent", "=", "1", ")", ":", "return", "(", "_is_random_variable", "(", "x", ")", "and", "_is_random_variable", "(", "y", ")", "and", "x", ".", "shape", "[", "0", "]", ">", "3", "and", "y"...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_dyad_update
Inner function of the fast distance covariance. This function is compiled because otherwise it would become a bottleneck.
dcor/_dcor.py
def _dyad_update(y, c): # pylint:disable=too-many-locals # This function has many locals so it can be compared # with the original algorithm. """ Inner function of the fast distance covariance. This function is compiled because otherwise it would become a bottleneck. """ n = y.shape[0...
def _dyad_update(y, c): # pylint:disable=too-many-locals # This function has many locals so it can be compared # with the original algorithm. """ Inner function of the fast distance covariance. This function is compiled because otherwise it would become a bottleneck. """ n = y.shape[0...
[ "Inner", "function", "of", "the", "fast", "distance", "covariance", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor.py#L131-L178
[ "def", "_dyad_update", "(", "y", ",", "c", ")", ":", "# pylint:disable=too-many-locals", "# This function has many locals so it can be compared", "# with the original algorithm.", "n", "=", "y", ".", "shape", "[", "0", "]", "gamma", "=", "np", ".", "zeros", "(", "n"...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_distance_covariance_sqr_fast_generic
Fast algorithm for the squared distance covariance.
dcor/_dcor.py
def _distance_covariance_sqr_fast_generic( x, y, unbiased=False): # pylint:disable=too-many-locals # This function has many locals so it can be compared # with the original algorithm. """Fast algorithm for the squared distance covariance.""" x = np.asarray(x) y = np.asarray(y) x = np.r...
def _distance_covariance_sqr_fast_generic( x, y, unbiased=False): # pylint:disable=too-many-locals # This function has many locals so it can be compared # with the original algorithm. """Fast algorithm for the squared distance covariance.""" x = np.asarray(x) y = np.asarray(y) x = np.r...
[ "Fast", "algorithm", "for", "the", "squared", "distance", "covariance", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor.py#L229-L303
[ "def", "_distance_covariance_sqr_fast_generic", "(", "x", ",", "y", ",", "unbiased", "=", "False", ")", ":", "# pylint:disable=too-many-locals", "# This function has many locals so it can be compared", "# with the original algorithm.", "x", "=", "np", ".", "asarray", "(", "...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_distance_stats_sqr_fast_generic
Compute the distance stats using the fast algorithm.
dcor/_dcor.py
def _distance_stats_sqr_fast_generic(x, y, dcov_function): """Compute the distance stats using the fast algorithm.""" covariance_xy_sqr = dcov_function(x, y) variance_x_sqr = dcov_function(x, x) variance_y_sqr = dcov_function(y, y) denominator_sqr_signed = variance_x_sqr * variance_y_sqr denomin...
def _distance_stats_sqr_fast_generic(x, y, dcov_function): """Compute the distance stats using the fast algorithm.""" covariance_xy_sqr = dcov_function(x, y) variance_x_sqr = dcov_function(x, x) variance_y_sqr = dcov_function(y, y) denominator_sqr_signed = variance_x_sqr * variance_y_sqr denomin...
[ "Compute", "the", "distance", "stats", "using", "the", "fast", "algorithm", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor.py#L316-L335
[ "def", "_distance_stats_sqr_fast_generic", "(", "x", ",", "y", ",", "dcov_function", ")", ":", "covariance_xy_sqr", "=", "dcov_function", "(", "x", ",", "y", ")", "variance_x_sqr", "=", "dcov_function", "(", "x", ",", "x", ")", "variance_y_sqr", "=", "dcov_fun...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
distance_covariance_sqr
distance_covariance_sqr(x, y, *, exponent=1) Computes the usual (biased) estimator for the squared distance covariance between two random vectors. Parameters ---------- x: array_like First random vector. The columns correspond with the individual random variables while the rows are...
dcor/_dcor.py
def distance_covariance_sqr(x, y, **kwargs): """ distance_covariance_sqr(x, y, *, exponent=1) Computes the usual (biased) estimator for the squared distance covariance between two random vectors. Parameters ---------- x: array_like First random vector. The columns correspond with t...
def distance_covariance_sqr(x, y, **kwargs): """ distance_covariance_sqr(x, y, *, exponent=1) Computes the usual (biased) estimator for the squared distance covariance between two random vectors. Parameters ---------- x: array_like First random vector. The columns correspond with t...
[ "distance_covariance_sqr", "(", "x", "y", "*", "exponent", "=", "1", ")" ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor.py#L360-L417
[ "def", "distance_covariance_sqr", "(", "x", ",", "y", ",", "*", "*", "kwargs", ")", ":", "if", "_can_use_fast_algorithm", "(", "x", ",", "y", ",", "*", "*", "kwargs", ")", ":", "return", "_distance_covariance_sqr_fast", "(", "x", ",", "y", ")", "else", ...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
u_distance_covariance_sqr
u_distance_covariance_sqr(x, y, *, exponent=1) Computes the unbiased estimator for the squared distance covariance between two random vectors. Parameters ---------- x: array_like First random vector. The columns correspond with the individual random variables while the rows are ind...
dcor/_dcor.py
def u_distance_covariance_sqr(x, y, **kwargs): """ u_distance_covariance_sqr(x, y, *, exponent=1) Computes the unbiased estimator for the squared distance covariance between two random vectors. Parameters ---------- x: array_like First random vector. The columns correspond with the...
def u_distance_covariance_sqr(x, y, **kwargs): """ u_distance_covariance_sqr(x, y, *, exponent=1) Computes the unbiased estimator for the squared distance covariance between two random vectors. Parameters ---------- x: array_like First random vector. The columns correspond with the...
[ "u_distance_covariance_sqr", "(", "x", "y", "*", "exponent", "=", "1", ")" ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor.py#L420-L477
[ "def", "u_distance_covariance_sqr", "(", "x", ",", "y", ",", "*", "*", "kwargs", ")", ":", "if", "_can_use_fast_algorithm", "(", "x", ",", "y", ",", "*", "*", "kwargs", ")", ":", "return", "_u_distance_covariance_sqr_fast", "(", "x", ",", "y", ")", "else...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
distance_stats_sqr
distance_stats_sqr(x, y, *, exponent=1) Computes the usual (biased) estimators for the squared distance covariance and squared distance correlation between two random vectors, and the individual squared distance variances. Parameters ---------- x: array_like First random vector. The co...
dcor/_dcor.py
def distance_stats_sqr(x, y, **kwargs): """ distance_stats_sqr(x, y, *, exponent=1) Computes the usual (biased) estimators for the squared distance covariance and squared distance correlation between two random vectors, and the individual squared distance variances. Parameters ---------- ...
def distance_stats_sqr(x, y, **kwargs): """ distance_stats_sqr(x, y, *, exponent=1) Computes the usual (biased) estimators for the squared distance covariance and squared distance correlation between two random vectors, and the individual squared distance variances. Parameters ---------- ...
[ "distance_stats_sqr", "(", "x", "y", "*", "exponent", "=", "1", ")" ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor.py#L537-L609
[ "def", "distance_stats_sqr", "(", "x", ",", "y", ",", "*", "*", "kwargs", ")", ":", "if", "_can_use_fast_algorithm", "(", "x", ",", "y", ",", "*", "*", "kwargs", ")", ":", "return", "_distance_stats_sqr_fast", "(", "x", ",", "y", ")", "else", ":", "r...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
u_distance_stats_sqr
u_distance_stats_sqr(x, y, *, exponent=1) Computes the unbiased estimators for the squared distance covariance and squared distance correlation between two random vectors, and the individual squared distance variances. Parameters ---------- x: array_like First random vector. The column...
dcor/_dcor.py
def u_distance_stats_sqr(x, y, **kwargs): """ u_distance_stats_sqr(x, y, *, exponent=1) Computes the unbiased estimators for the squared distance covariance and squared distance correlation between two random vectors, and the individual squared distance variances. Parameters ---------- ...
def u_distance_stats_sqr(x, y, **kwargs): """ u_distance_stats_sqr(x, y, *, exponent=1) Computes the unbiased estimators for the squared distance covariance and squared distance correlation between two random vectors, and the individual squared distance variances. Parameters ---------- ...
[ "u_distance_stats_sqr", "(", "x", "y", "*", "exponent", "=", "1", ")" ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor.py#L612-L687
[ "def", "u_distance_stats_sqr", "(", "x", ",", "y", ",", "*", "*", "kwargs", ")", ":", "if", "_can_use_fast_algorithm", "(", "x", ",", "y", ",", "*", "*", "kwargs", ")", ":", "return", "_u_distance_stats_sqr_fast", "(", "x", ",", "y", ")", "else", ":", ...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
distance_stats
distance_stats(x, y, *, exponent=1) Computes the usual (biased) estimators for the distance covariance and distance correlation between two random vectors, and the individual distance variances. Parameters ---------- x: array_like First random vector. The columns correspond with the in...
dcor/_dcor.py
def distance_stats(x, y, **kwargs): """ distance_stats(x, y, *, exponent=1) Computes the usual (biased) estimators for the distance covariance and distance correlation between two random vectors, and the individual distance variances. Parameters ---------- x: array_like First r...
def distance_stats(x, y, **kwargs): """ distance_stats(x, y, *, exponent=1) Computes the usual (biased) estimators for the distance covariance and distance correlation between two random vectors, and the individual distance variances. Parameters ---------- x: array_like First r...
[ "distance_stats", "(", "x", "y", "*", "exponent", "=", "1", ")" ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor.py#L690-L755
[ "def", "distance_stats", "(", "x", ",", "y", ",", "*", "*", "kwargs", ")", ":", "return", "Stats", "(", "*", "[", "_sqrt", "(", "s", ")", "for", "s", "in", "distance_stats_sqr", "(", "x", ",", "y", ",", "*", "*", "kwargs", ")", "]", ")" ]
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
distance_correlation_sqr
distance_correlation_sqr(x, y, *, exponent=1) Computes the usual (biased) estimator for the squared distance correlation between two random vectors. Parameters ---------- x: array_like First random vector. The columns correspond with the individual random variables while the rows a...
dcor/_dcor.py
def distance_correlation_sqr(x, y, **kwargs): """ distance_correlation_sqr(x, y, *, exponent=1) Computes the usual (biased) estimator for the squared distance correlation between two random vectors. Parameters ---------- x: array_like First random vector. The columns correspond wit...
def distance_correlation_sqr(x, y, **kwargs): """ distance_correlation_sqr(x, y, *, exponent=1) Computes the usual (biased) estimator for the squared distance correlation between two random vectors. Parameters ---------- x: array_like First random vector. The columns correspond wit...
[ "distance_correlation_sqr", "(", "x", "y", "*", "exponent", "=", "1", ")" ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor.py#L758-L815
[ "def", "distance_correlation_sqr", "(", "x", ",", "y", ",", "*", "*", "kwargs", ")", ":", "if", "_can_use_fast_algorithm", "(", "x", ",", "y", ",", "*", "*", "kwargs", ")", ":", "return", "_distance_correlation_sqr_fast", "(", "x", ",", "y", ")", "else",...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
u_distance_correlation_sqr
u_distance_correlation_sqr(x, y, *, exponent=1) Computes the bias-corrected estimator for the squared distance correlation between two random vectors. Parameters ---------- x: array_like First random vector. The columns correspond with the individual random variables while the rows...
dcor/_dcor.py
def u_distance_correlation_sqr(x, y, **kwargs): """ u_distance_correlation_sqr(x, y, *, exponent=1) Computes the bias-corrected estimator for the squared distance correlation between two random vectors. Parameters ---------- x: array_like First random vector. The columns correspond...
def u_distance_correlation_sqr(x, y, **kwargs): """ u_distance_correlation_sqr(x, y, *, exponent=1) Computes the bias-corrected estimator for the squared distance correlation between two random vectors. Parameters ---------- x: array_like First random vector. The columns correspond...
[ "u_distance_correlation_sqr", "(", "x", "y", "*", "exponent", "=", "1", ")" ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor.py#L818-L877
[ "def", "u_distance_correlation_sqr", "(", "x", ",", "y", ",", "*", "*", "kwargs", ")", ":", "if", "_can_use_fast_algorithm", "(", "x", ",", "y", ",", "*", "*", "kwargs", ")", ":", "return", "_u_distance_correlation_sqr_fast", "(", "x", ",", "y", ")", "el...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
distance_correlation_af_inv_sqr
Square of the affinely invariant distance correlation. Computes the estimator for the square of the affinely invariant distance correlation between two random vectors. .. warning:: The return value of this function is undefined when the covariance matrix of :math:`x` or :math:`y` is singu...
dcor/_dcor.py
def distance_correlation_af_inv_sqr(x, y): """ Square of the affinely invariant distance correlation. Computes the estimator for the square of the affinely invariant distance correlation between two random vectors. .. warning:: The return value of this function is undefined when the ...
def distance_correlation_af_inv_sqr(x, y): """ Square of the affinely invariant distance correlation. Computes the estimator for the square of the affinely invariant distance correlation between two random vectors. .. warning:: The return value of this function is undefined when the ...
[ "Square", "of", "the", "affinely", "invariant", "distance", "correlation", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_dcor.py#L937-L988
[ "def", "distance_correlation_af_inv_sqr", "(", "x", ",", "y", ")", ":", "x", "=", "_af_inv_scaled", "(", "x", ")", "y", "=", "_af_inv_scaled", "(", "y", ")", "correlation", "=", "distance_correlation_sqr", "(", "x", ",", "y", ")", "return", "0", "if", "n...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
pairwise
pairwise(function, x, y=None, *, pool=None, is_symmetric=None, **kwargs) Computes a dependency measure between each pair of elements. Parameters ---------- function: Dependency measure function. x: iterable of array_like First list of random vectors. The columns of each vector correspond ...
dcor/_pairwise.py
def pairwise(function, x, y=None, **kwargs): """ pairwise(function, x, y=None, *, pool=None, is_symmetric=None, **kwargs) Computes a dependency measure between each pair of elements. Parameters ---------- function: Dependency measure function. x: iterable of array_like First list o...
def pairwise(function, x, y=None, **kwargs): """ pairwise(function, x, y=None, *, pool=None, is_symmetric=None, **kwargs) Computes a dependency measure between each pair of elements. Parameters ---------- function: Dependency measure function. x: iterable of array_like First list o...
[ "pairwise", "(", "function", "x", "y", "=", "None", "*", "pool", "=", "None", "is_symmetric", "=", "None", "**", "kwargs", ")" ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_pairwise.py#L10-L94
[ "def", "pairwise", "(", "function", ",", "x", ",", "y", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "_pairwise_imp", "(", "function", ",", "x", ",", "y", ",", "*", "*", "kwargs", ")" ]
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_pairwise_imp
Real implementation of :func:`pairwise`. This function is used to make several parameters keyword-only in Python 2.
dcor/_pairwise.py
def _pairwise_imp(function, x, y=None, pool=None, is_symmetric=None, **kwargs): """ Real implementation of :func:`pairwise`. This function is used to make several parameters keyword-only in Python 2. """ map_function = pool.map if pool else map if is_symmetric is None: is_symmetri...
def _pairwise_imp(function, x, y=None, pool=None, is_symmetric=None, **kwargs): """ Real implementation of :func:`pairwise`. This function is used to make several parameters keyword-only in Python 2. """ map_function = pool.map if pool else map if is_symmetric is None: is_symmetri...
[ "Real", "implementation", "of", ":", "func", ":", "pairwise", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_pairwise.py#L97-L134
[ "def", "_pairwise_imp", "(", "function", ",", "x", ",", "y", "=", "None", ",", "pool", "=", "None", ",", "is_symmetric", "=", "None", ",", "*", "*", "kwargs", ")", ":", "map_function", "=", "pool", ".", "map", "if", "pool", "else", "map", "if", "is...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_jit
Compile a function using a jit compiler. The function is always compiled to check errors, but is only used outside tests, so that code coverage analysis can be performed in jitted functions. The tests set sys._called_from_test in conftest.py.
dcor/_utils.py
def _jit(function): """ Compile a function using a jit compiler. The function is always compiled to check errors, but is only used outside tests, so that code coverage analysis can be performed in jitted functions. The tests set sys._called_from_test in conftest.py. """ import sys co...
def _jit(function): """ Compile a function using a jit compiler. The function is always compiled to check errors, but is only used outside tests, so that code coverage analysis can be performed in jitted functions. The tests set sys._called_from_test in conftest.py. """ import sys co...
[ "Compile", "a", "function", "using", "a", "jit", "compiler", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_utils.py#L10-L27
[ "def", "_jit", "(", "function", ")", ":", "import", "sys", "compiled", "=", "numba", ".", "jit", "(", "function", ")", "if", "hasattr", "(", "sys", ",", "'_called_from_test'", ")", ":", "return", "function", "else", ":", "# pragma: no cover", "return", "co...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_sqrt
Return square root of an ndarray. This sqrt function for ndarrays tries to use the exponentiation operator if the objects stored do not supply a sqrt method.
dcor/_utils.py
def _sqrt(x): """ Return square root of an ndarray. This sqrt function for ndarrays tries to use the exponentiation operator if the objects stored do not supply a sqrt method. """ x = np.clip(x, a_min=0, a_max=None) try: return np.sqrt(x) except AttributeError: exponen...
def _sqrt(x): """ Return square root of an ndarray. This sqrt function for ndarrays tries to use the exponentiation operator if the objects stored do not supply a sqrt method. """ x = np.clip(x, a_min=0, a_max=None) try: return np.sqrt(x) except AttributeError: exponen...
[ "Return", "square", "root", "of", "an", "ndarray", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_utils.py#L30-L50
[ "def", "_sqrt", "(", "x", ")", ":", "x", "=", "np", ".", "clip", "(", "x", ",", "a_min", "=", "0", ",", "a_max", "=", "None", ")", "try", ":", "return", "np", ".", "sqrt", "(", "x", ")", "except", "AttributeError", ":", "exponent", "=", "0.5", ...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_transform_to_2d
Convert vectors to column matrices, to always have a 2d shape.
dcor/_utils.py
def _transform_to_2d(t): """Convert vectors to column matrices, to always have a 2d shape.""" t = np.asarray(t) dim = len(t.shape) assert dim <= 2 if dim < 2: t = np.atleast_2d(t).T return t
def _transform_to_2d(t): """Convert vectors to column matrices, to always have a 2d shape.""" t = np.asarray(t) dim = len(t.shape) assert dim <= 2 if dim < 2: t = np.atleast_2d(t).T return t
[ "Convert", "vectors", "to", "column", "matrices", "to", "always", "have", "a", "2d", "shape", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_utils.py#L53-L63
[ "def", "_transform_to_2d", "(", "t", ")", ":", "t", "=", "np", ".", "asarray", "(", "t", ")", "dim", "=", "len", "(", "t", ".", "shape", ")", "assert", "dim", "<=", "2", "if", "dim", "<", "2", ":", "t", "=", "np", ".", "atleast_2d", "(", "t",...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_can_be_double
Return if the array can be safely converted to double. That happens when the dtype is a float with the same size of a double or narrower, or when is an integer that can be safely converted to double (if the roundtrip conversion works).
dcor/_utils.py
def _can_be_double(x): """ Return if the array can be safely converted to double. That happens when the dtype is a float with the same size of a double or narrower, or when is an integer that can be safely converted to double (if the roundtrip conversion works). """ return ((np.issubdtype(...
def _can_be_double(x): """ Return if the array can be safely converted to double. That happens when the dtype is a float with the same size of a double or narrower, or when is an integer that can be safely converted to double (if the roundtrip conversion works). """ return ((np.issubdtype(...
[ "Return", "if", "the", "array", "can", "be", "safely", "converted", "to", "double", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_utils.py#L66-L78
[ "def", "_can_be_double", "(", "x", ")", ":", "return", "(", "(", "np", ".", "issubdtype", "(", "x", ".", "dtype", ",", "np", ".", "floating", ")", "and", "x", ".", "dtype", ".", "itemsize", "<=", "np", ".", "dtype", "(", "float", ")", ".", "items...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_cdist_naive
Pairwise distance, custom implementation.
dcor/distances.py
def _cdist_naive(x, y, exponent=1): """Pairwise distance, custom implementation.""" squared_norms = ((x[_np.newaxis, :, :] - y[:, _np.newaxis, :]) ** 2).sum(2) exponent = exponent / 2 try: exponent = squared_norms.take(0).from_float(exponent) except AttributeError: pass return ...
def _cdist_naive(x, y, exponent=1): """Pairwise distance, custom implementation.""" squared_norms = ((x[_np.newaxis, :, :] - y[:, _np.newaxis, :]) ** 2).sum(2) exponent = exponent / 2 try: exponent = squared_norms.take(0).from_float(exponent) except AttributeError: pass return ...
[ "Pairwise", "distance", "custom", "implementation", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/distances.py#L18-L28
[ "def", "_cdist_naive", "(", "x", ",", "y", ",", "exponent", "=", "1", ")", ":", "squared_norms", "=", "(", "(", "x", "[", "_np", ".", "newaxis", ",", ":", ",", ":", "]", "-", "y", "[", ":", ",", "_np", ".", "newaxis", ",", ":", "]", ")", "*...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_pdist_scipy
Pairwise distance between points in a set.
dcor/distances.py
def _pdist_scipy(x, exponent=1): """Pairwise distance between points in a set.""" metric = 'euclidean' if exponent != 1: metric = 'sqeuclidean' distances = _spatial.distance.pdist(x, metric=metric) distances = _spatial.distance.squareform(distances) if exponent != 1: distances...
def _pdist_scipy(x, exponent=1): """Pairwise distance between points in a set.""" metric = 'euclidean' if exponent != 1: metric = 'sqeuclidean' distances = _spatial.distance.pdist(x, metric=metric) distances = _spatial.distance.squareform(distances) if exponent != 1: distances...
[ "Pairwise", "distance", "between", "points", "in", "a", "set", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/distances.py#L31-L44
[ "def", "_pdist_scipy", "(", "x", ",", "exponent", "=", "1", ")", ":", "metric", "=", "'euclidean'", "if", "exponent", "!=", "1", ":", "metric", "=", "'sqeuclidean'", "distances", "=", "_spatial", ".", "distance", ".", "pdist", "(", "x", ",", "metric", ...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_cdist_scipy
Pairwise distance between the points in two sets.
dcor/distances.py
def _cdist_scipy(x, y, exponent=1): """Pairwise distance between the points in two sets.""" metric = 'euclidean' if exponent != 1: metric = 'sqeuclidean' distances = _spatial.distance.cdist(x, y, metric=metric) if exponent != 1: distances **= exponent / 2 return distances
def _cdist_scipy(x, y, exponent=1): """Pairwise distance between the points in two sets.""" metric = 'euclidean' if exponent != 1: metric = 'sqeuclidean' distances = _spatial.distance.cdist(x, y, metric=metric) if exponent != 1: distances **= exponent / 2 return distances
[ "Pairwise", "distance", "between", "the", "points", "in", "two", "sets", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/distances.py#L47-L59
[ "def", "_cdist_scipy", "(", "x", ",", "y", ",", "exponent", "=", "1", ")", ":", "metric", "=", "'euclidean'", "if", "exponent", "!=", "1", ":", "metric", "=", "'sqeuclidean'", "distances", "=", "_spatial", ".", "distance", ".", "cdist", "(", "x", ",", ...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_pdist
Pairwise distance between points in a set. As Scipy converts every value to double, this wrapper uses a less efficient implementation if the original dtype can not be converted to double.
dcor/distances.py
def _pdist(x, exponent=1): """ Pairwise distance between points in a set. As Scipy converts every value to double, this wrapper uses a less efficient implementation if the original dtype can not be converted to double. """ if _can_be_double(x): return _pdist_scipy(x, exponent) ...
def _pdist(x, exponent=1): """ Pairwise distance between points in a set. As Scipy converts every value to double, this wrapper uses a less efficient implementation if the original dtype can not be converted to double. """ if _can_be_double(x): return _pdist_scipy(x, exponent) ...
[ "Pairwise", "distance", "between", "points", "in", "a", "set", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/distances.py#L62-L74
[ "def", "_pdist", "(", "x", ",", "exponent", "=", "1", ")", ":", "if", "_can_be_double", "(", "x", ")", ":", "return", "_pdist_scipy", "(", "x", ",", "exponent", ")", "else", ":", "return", "_cdist_naive", "(", "x", ",", "x", ",", "exponent", ")" ]
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d
train
_cdist
Pairwise distance between points in two sets. As Scipy converts every value to double, this wrapper uses a less efficient implementation if the original dtype can not be converted to double.
dcor/distances.py
def _cdist(x, y, exponent=1): """ Pairwise distance between points in two sets. As Scipy converts every value to double, this wrapper uses a less efficient implementation if the original dtype can not be converted to double. """ if _can_be_double(x) and _can_be_double(y): return _c...
def _cdist(x, y, exponent=1): """ Pairwise distance between points in two sets. As Scipy converts every value to double, this wrapper uses a less efficient implementation if the original dtype can not be converted to double. """ if _can_be_double(x) and _can_be_double(y): return _c...
[ "Pairwise", "distance", "between", "points", "in", "two", "sets", "." ]
vnmabus/dcor
python
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/distances.py#L77-L89
[ "def", "_cdist", "(", "x", ",", "y", ",", "exponent", "=", "1", ")", ":", "if", "_can_be_double", "(", "x", ")", "and", "_can_be_double", "(", "y", ")", ":", "return", "_cdist_scipy", "(", "x", ",", "y", ",", "exponent", ")", "else", ":", "return",...
b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d