What do you want to save?
Add Code snippet
New code examples
-
Other 2022-03-16 23:45:06
Three-dimensional Points and Lines
ax = plt.axes(projection='3d') # Data for a three-dimensional line zline = np.linspace(0, 15, 1000) xline = np.sin(zline) yline = np.cos(zline) ax.plot3D(xline, yline, zline, 'gray') # Data for three-dimensional scattered points zdata = 15 * np.random.r... Add solution -
Python 2022-02-21 00:35:02
affinity propagation cosine similarity python
# credit to Stack Overflow user in the source link import numpy as np from sklearn.metrics.pairwise import cosine_distances # some dummy data word_vectors = np.random.random((77, 300)) word_cosine = cosine_distances(word_vectors) affprop = AffinityPropa... Add solution -
Python 2022-02-02 06:06:04
matplotlib animation
import matplotlib.pyplot as plt from matplotlib import cm import numpy as np from celluloid import Camera numpoints = 10 points = np.random.random((2, numpoints)) colors = cm.rainbow(np.linspace(0, 1, numpoints)) camera = Camera(plt.figure()) for _ in ra... Add solution -
Other 2022-01-30 22:40:32
tqdm update with apply_async in multiprocessing
import time import random from multiprocessing import Pool from tqdm import tqdm def myfunc(a): time.sleep(random.random()) return a ** 2 pool = Pool(2) ''' for _ in tqdm(pool.imap_unordered(myfunc, range(100)), total=100): pass ''' pbar = t... Add solution
Best helpers
Ranking is empty