What do you want to save?
Add Code snippet
New code examples
-
Other 2021-09-15 01:40:03
grid_data=d.iloc[index].as_matrix( ).reshape(28,28) not working
# display or plot a number. plt.figure(figsize=(7,7)) idx = 100 grid_data = d.iloc[idx].as_matrix().reshape(28,28) # reshape from 1d to 2d pixel array plt.imshow(grid_data, interpolation = "none", cmap = "gray") plt.show() print(l[idx]) Add solution -
Python 2021-09-14 19:34:01
torch import
import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader from torchvision import datasets, transforms, models from torchvision.utils import make_grid import numpy as np import pandas as pd from sklearn.me... Add solution -
-
Python 2021-09-14 16:45:03
piecewise linear regression python
from scipy import optimize def piecewise_linear(x, x0, x1, b, k1, k2, k3): condlist = [x < x0, (x >= x0) & (x < x1), x >= x1] funclist = [lambda x: k1*x + b, lambda x: k1*x + b + k2*(x-x0), lambda x: k1*x + b + k2*(x-x0) + k3*(x -... Add solution -
Python 2021-09-14 14:00:02
turn off grid in matplotlib 3d
plt.axis('off') plt.grid(b=None) Add solution -
Other 2021-09-13 23:04:02
how to plot a scatter plot in matplotlib
# Import matplotlib import matplotlib.pyplot as plt # Set plot space as inline for inline plots and qt for external plots %matplotlib inline # Set the figure size in inches plt.figure(figsize=(10,6)) plt.scatter(x, y, label = "label_name" ) ... Add solution -
Python 2021-09-13 10:50:03
how to add subtitle matplotlib
import pandas as pd import matplotlib.pyplot as plt d = {'series a' : pd.Series([1., 2., 3.], index=['a', 'b', 'c']), 'series b' : pd.Series([1., 2., 3., 4.], index=['a', 'b', 'c', 'd'])} df = pd.DataFrame(d) title_string = "This is the title... Add solution -