This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import loader | |
| train_features, train_labels, test_features, test_labels = loader.load_images('TrainImages') | |
| train_features = np.reshape(train_features,(500, 4000)) | |
| train_labels = np.reshape(train_labels, (500, 2)) | |
| test_features = np.reshape(test_features, (550, 4000)) | |
| test_labels = np.reshape(test_labels, (550, 2)) | |
| train_data = zip(train_features, train_labels) | |
| test_data = zip(test_features, test_labels) |
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
| [ 60 76 67 ..., 253 253 243],[ 0. 1.][33 49 22 ..., 94 94 94],[ 1. 0.][ 68 68 60 ..., 227 255 255],[ 0. 1.][164 107 88 ..., 181 164 164],[ 0. 1.][ 72 63 72 ..., 205 205 205],[ 0. 1.][228 228 228 ..., 203 213 220],[ 0. 1.][223 215 215 ..., 72 91 110],[ 1. 0.][251 251 251 ..., 91 99 99],[ 1. 0.][ 54 80 94 ..., 210 196 217],[ 0. 1.][ 12 12 12 ..., 139 131 139],[ 1. 0.][ 44 60 60 ..., 204 211 211],[ 0. 1.][218 218 218 ..., 115 147 67],[ 1. 0.][185 185 185 ..., 111 111 126],[ 1. 0.][102 114 125 ..., 42 53 53],[ 1. 0.][140 188 132 ..., 251 251 251],[ 0. 1.][255 255 255 ..., 59 28 4],[ 1. 0.][116 108 164 ..., 132 139 132],[ 0. 1.][108 123 84 ..., 212 212 131],[ 1. 0.][19 19 27 ..., 83 68 68],[ 1. 0.][ 57 70 57 ..., 89 111 89],[ 0. 1.][ 99 83 68 ..., 212 212 220],[ 0. 1.][220 212 212 ..., 36 36 27],[ 1. 0.][ 35 35 44 ..., 211 211 220],[ 0. 1.][ 20 116 164 ..., 203 212 227],[ 0. 1.][123 123 116 ..., 156 163 83],[ 1. 0.][172 187 195 ..., 116 116 100],[ 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
| import numpy as np | |
| import loader | |
| train_features, train_labels, test_features, test_labels = loader.load_images('TrainImages') | |
| train_features = np.reshape(train_features,(500, 4000)) | |
| train_labels = np.reshape(train_labels, (500, 2)) | |
| test_features = np.reshape(test_features, (550, 4000)) | |
| test_labels = np.reshape(test_labels, (550, 2)) | |
| train_data = zip(train_features, train_labels) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import loader | |
| train_features, train_labels, test_features, test_labels = loader.load_images('TrainImages') | |
| train_features = np.reshape(train_features,(500, 4000)) | |
| train_labels = np.reshape(train_labels, (500, 2)) | |
| test_features = np.reshape(test_features, (550, 4000)) | |
| test_labels = np.reshape(test_labels, (550, 2)) | |
| train_data = zip(train_features, train_labels) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import os | |
| import random | |
| from PIL import Image | |
| def vectorized_result(y): | |
| f_array = np.zeros((2, 1)) | |
| f_array[y] = 1 | |
| return f_array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import loader | |
| train_features, train_labels, test_features, test_labels = loader.load_images('TrainImages') | |
| train_features = np.reshape(train_features,(500, 4000)) | |
| train_labels = np.reshape(train_labels, (500, 2)) | |
| test_features = np.reshape(test_features, (550, 4000)) | |
| test_labels = np.reshape(test_labels, (550, 2)) | |
| train_data = zip(train_features, train_labels) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Queue(object): | |
| def __init__(self): | |
| self.queue = [] | |
| self.curr_size = 0 | |
| def enqueue(self, item): | |
| self.queue.insert(0, item) | |
| self.curr_size += 1 | |
| def dequeue(self): |
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 random | |
| from qyu import Queue | |
| class Printer(): | |
| def __init__(self, ppm): | |
| self.pagerate = ppm | |
| self.current_task = None | |
| self.time_remaining = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import random | |
| class Network(object): | |
| def __init__(self, sizes): | |
| self.num_layers = len(sizes) | |
| self.sizes = sizes | |
| self.biases = [np.random.randn(y, 1) for y in sizes[1:]] | |
| self.weights = [np.random.randn(y, x) for x, y in zip(sizes[:-1], sizes[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
| import numpy as np | |
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| import time | |
| # 1 : malignant ; 0: benign | |
| df = pd.read_csv('data.csv') | |
| df.drop(['id', 'Unnamed: 32'], axis=1, inplace=True) | |
| df['diagnosis'] = df.diagnosis.map({'M':1, 'B':0}) | |
| df.insert(0, 'Ones', 1) |