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 time | |
| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| from torchvision import datasets | |
| from torchvision import transforms | |
| from torch.utils.data import DataLoader | |
| if torch.cuda.is_available(): |
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
| #!/usr/bin/env python | |
| """ | |
| simple example script for running and testing notebooks. | |
| Usage: `ipnbdoctest.py foo.ipynb [bar.ipynb [...]]` | |
| Each cell is submitted to the kernel, and the outputs are compared with those stored in the notebook. | |
| """ | |
| # License: Public Domain, but credit is nice (Min RK). |
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 matplotlib.colors import ListedColormap | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| from sklearn import datasets | |
| from sklearn.linear_model import LogisticRegression | |
| def plot_decision_regions(X, y, classifier, resolution=0.1): | |
| # setup marker generator and color map | |
| markers = ('s', 'x', 'o', '^', 'v') |
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 nltk | |
| def eng_ratio(text): | |
| ''' Returns the ratio of non-English to English words from a text ''' | |
| english_vocab = set(w.lower() for w in nltk.corpus.words.words()) | |
| text_vocab = set(w.lower() for w in text.split() if w.lower().isalpha()) | |
| unusual = text_vocab.difference(english_vocab) | |
| diff = len(unusual)/len(text_vocab) | |
| return diff |
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
| " Sebastian Raschka | |
| " 09/11/2013 | |
| " | |
| syntax on | |
| set nonumber | |
| set ruler | |
| set tabstop=4 | |
| set shiftwidth=4 " controls the depth of autoindentation |
NewerOlder