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 torchvision.datasets import MNIST | |
| import numpy as np | |
| def data(train): | |
| mnist = MNIST(root='.', download=True, train=train) | |
| X = mnist.data.numpy().reshape(-1, 784) / 255 | |
| y = mnist.targets.numpy() | |
| return X, y | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| from scipy.stats import chi2_contingency | |
| # example data taken from | |
| # https://en.wikipedia.org/wiki/Chi-squared_test#Example_chi-squared_test_for_categorical_data | |
| X = np.array([ | |
| [90, 60, 104, 95], | |
| [30, 50, 51, 20], | |
| [30, 40, 45, 35], | |
| ]) |
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
| fswatch ~/repo/ -o | xargs -I {} rsync -avzhe ssh ~/repo/ server:/home/user/repo/ --delete --exclude "venv/*" |
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 cProfile | |
| import pstats | |
| import io | |
| def profile(file_path=None, breakpoint_after_call=False): | |
| """decorator for runtime profiling of functions or class methods | |
| prints the profiling statistics sorted by | |
| cumulative time, | |
| total time, |
NewerOlder