What do you want to save?
Add Code snippet
New code examples
-
Python 2021-10-29 10:07:11
y=mx+b python
import matplotlib.pyplot as plt import numpy as np x = np.linspace(-5,5,100) y = 2*x+1 plt.plot(x, y, '-r', label='y=2x+1') plt.title('Graph of y=2x+1') plt.xlabel('x', color='#1C2833') plt.ylabel('y', color='#1C2833') plt.legend(loc='upper left') plt.gri... 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-20 03:21:04
matplotlib latex non italic indices
plt.xlabel(r'Primary T$_{\rm eff}$') Add solution -
Python 2021-10-19 09:15:16
scatter plot python
# 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-10-18 06:56:13
roc curve python
import sklearn.metrics as metrics # calculate the fpr and tpr for all thresholds of the classification probs = model.predict_proba(X_test) preds = probs[:,1] fpr, tpr, threshold = metrics.roc_curve(y_test, preds) roc_auc = metrics.auc(fpr, tpr) # method ... Add solution -
Python 2021-10-16 04:58:04
how to display the first 25 images from training dataset
plt.figure(figsize=(10,10))for i in range(25): plt.subplot(5,5,i+1) plt.xticks([]) plt.yticks([]) plt.grid(False) plt.imshow(train_images[i], cmap=plt.cm.binary) plt.xlabel(class_names[train_labels[i]])plt.show() Add solution -
Other 2021-10-16 03:26:10
simple pendulum with image processing code
import numpy as np from scipy.integrate import odeint import math import matplotlib.pyplot as plt """ damping: effects that reduce the amplitude of the vibrations """ def ode_func(theta,t,b,g,l,m): theta1=theta[0] thet... Add solution -
TypeScript 2021-10-16 01:49:08
Interest and principal payments python
import numpy as np import pandas as pd import numpy_financial as npf import matplotlib.pyplot as plt loan = float(input("Please enter the value of the loan: ")) ir = float(input("Please enter the annual rate on that loan: ")) length = ... Add solution -
Python 2021-10-12 16:19:05
roc curve
import sklearn.metrics as metrics # calculate the fpr and tpr for all thresholds of the classification probs = model.predict_proba(X_test) preds = probs[:,1] fpr, tpr, threshold = metrics.roc_curve(y_test, preds) roc_auc = metrics.auc(fpr, tpr) # method ... Add solution