This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function [X, fX, i] = fmincg(f, X, options, P1, P2, P3, P4, P5) | |
| % Minimize a continuous differentialble multivariate function. Starting point | |
| % is given by "X" (D by 1), and the function named in the string "f", must | |
| % return a function value and a vector of partial derivatives. The Polack- | |
| % Ribiere flavour of conjugate gradients is used to compute search directions, | |
| % and a line search using quadratic and cubic polynomial approximations and the | |
| % Wolfe-Powell stopping criteria is used together with the slope ratio method | |
| % for guessing initial step sizes. Additionally a bunch of checks are made to | |
| % make sure that exploration is taking place and that extrapolation will not | |
| % be unboundedly large. The "length" gives the length of the run: if it is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function [J ,grad] = nnCostFunction(nn_params, ... | |
| input_layer_size, ... | |
| hidden_layer_size, ... | |
| num_labels, ... | |
| X, y, lambda) | |
| Theta1 = reshape(nn_params(1:hidden_layer_size * ... | |
| (input_layer_size + 1)), ... | |
| hidden_layer_size, (input_layer_size + 1)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| clear ; close all; clc | |
| % Specify the architecture | |
| input_layer_size = 900; % 30x30 Input Images of Digits | |
| hidden_layer_size = 300; % 300 hidden units | |
| num_labels = 92; | |
| % set maximum number of training iteration as you please | |
| % larger MaxIter results in better accuracy | |
| options = optimset('MaxIter', 10); | |
| lambda = 1; % learning rate for regularization |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pragma once | |
| // @generated from tools/autograd/templates/VariableType.h | |
| #include <ATen/ATen.h> | |
| #include <cstdint> // for size_t | |
| #include <functional> // for function | |
| #include <memory> // for unique_ptr | |
| #include <string> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import stringcase, tokenize, pathlib, tqdm, os | |
| os.system("mkdir -p converted/src/") | |
| os.system("rm -rf converted/src/*") | |
| os.system("cp -r src/* converted/src/") | |
| IGNORE = {'dictConfig', 'Box'} | |
| keywords = set() | |
| source_path = pathlib.Path('converted/src/') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tokenize, collections, pathlib, pprint | |
| counter = collections.Counter() | |
| source_path = pathlib.Path('.') | |
| for filename in source_path.glob('**/*.py'): | |
| print(f'Scanning tokens {filename} ...') | |
| tokens = tokenize.tokenize(open(filename, 'rb').__next__) | |
| for token in tokens: | |
| if token.type == 1 or token.type == '3' and ' ' not in token.string: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Dependencies: | |
| # ripgrep https://github.com/BurntSushi/ripgrep#installation | |
| # realpath from GNU coreutils | |
| # pip3 install pylint isort dewildcard | |
| # Usage: ./fix-python-wild-card-imports.sh "path/to/python/source/to/fix/" | |
| # set -x # uncomment this line to see all commands |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """This module provides tools to clone github repos. The GithubOrgCloner | |
| can clone an entire org worth of codebases and create a local corpus of projects. | |
| """ | |
| import git | |
| import shutil | |
| import traceback | |
| import urllib.parse | |
| from argparse import ArgumentParser | |
| from functools import partial |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tabulate | |
| def calc_indian_tds(salary): | |
| if salary < 2.5e5: | |
| tds = 0 | |
| elif salary < 5e5: | |
| tds = salary * 0.05 | |
| elif salary < 1e6: | |
| tds = (salary - 5e5) * 0.20 + 5e5 * 0.05 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from github import Github | |
| g = Github('your-github-login', 'your-github-token-XXXX') | |
| if __name__ == '__main__': | |
| for repo in g.get_user().get_repos(): | |
| print(repo.name) |