Skip to content

Instantly share code, notes, and snippets.

View RealmX1's full-sized avatar

Bomin Zhang RealmX1

  • Well Modeled Man
View GitHub Profile
import os
import sys
from sklearn.linear_model import LogisticRegression
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.model_selection import train_test_split
from imblearn.over_sampling import RandomOverSampler
import sklearn.metrics as metrics
import matplotlib.pyplot as plt
import numpy as np
import json
{"cells":[{"metadata":{},"cell_type":"markdown","source":"# Imports for Python libraries"},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":true},"cell_type":"code","source":"%matplotlib inline\n%config InlineBackend.figure_format = 'retina'\n\nimport numpy as np\nimport torch\nimport torchvision\nimport matplotlib.pyplot as plt\nfrom time import time\nfrom torchvision import datasets, transforms\nfrom torch import nn\nfrom torch import optim","execution_count":1,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Set up the mini-batch size"},{"metadata":{"trusted":true},"cell_type":"code","source":"print(\"Edit code here to change the batch size.\")\nmini_batch_size = 64","execution_count":2,"outputs":[{"output_type":"stream","text":"Edit code here to change the batch size.\n","name":"stdout"}]},{"metadata":{},"cell_type":"markdown","source":"# Download the dataset, pre-process, and divide into mini-batches"},{"metadata"