What do you want to save?
Add Code snippet
New code examples
-
TypeScript 2021-11-03 15:35:15
generate random numbers in python within a range
import random # generates completely random number x = random.random() # generates a random int x = random.randint() # generates a random int in a range x = random.randint(1, 100) # NOTE: RANGE DOESN'T WORK FOR random.random() Add solution -
Python 2021-11-03 04:46:22
python webbot
# (A browser I created where you can load a url from the command line) # You can take this as your own if you want, it's pretty simple. import os import webbot import time import random from getkey import * typing_speed = 100 #wpm def slowprint(t): ... Add solution -
Other 2021-10-28 17:14:14
How to create/customize your own scorer function in scikit-learn with GridSearch
from sklearn.grid_search import GridSearchCV from sklearn.metrics import make_scorer from sklearn.svm import SVR import numpy as np rng = np.random.RandomState(1) def my_custom_loss_func(X_train_scaled, Y_train_scaled): error, M = 0, 0 for i in... Add solution -
Other 2021-10-27 20:12:06
sklearn decision tree regressor
Import the necessary modules and libraries import numpy as np from sklearn.tree import DecisionTreeRegressor import matplotlib.pyplot as plt # Create a random dataset rng = np.random.RandomState(1) X = np.sort(5 * rng.rand(80, 1), axis=0) y = np.sin(X).... Add solution -
Python 2021-10-24 19:26:14
best python programs
theta = 2 * np.pi * np.random.random(1000) r = 6 * np.random.random(1000) x = np.ravel(r * np.sin(theta)) y = np.ravel(r * np.cos(theta)) z = f(x, y) ax = plt.axes(projection=’3d’) ax.plot_trisurf(x, y, z,cmap=’viridis’, edgecolor=... Add solution -
Python 2021-10-24 12:40:11
pyevtk documentation writearraystovtk
import numpy as np from enthought.tvtk.api import tvtk, write_data data = np.random.random((10,10,10)) grid = tvtk.ImageData(spacing=(10, 5, -10), origin=(100, 350, 200), dimensions=data.shape) grid.point_data.scalars = np.ravel(o... Add solution
Best helpers
Ranking is empty