This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import matplotlib.ticker as ticker | |
from torch.utils.tensorboard import SummaryWriter | |
import numpy as np | |
def vis_confusion(writer, step): | |
""" | |
Visualization of confusion matrix | |
Parameters: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import statsmodels.api as sm | |
data = sm.datasets.get_rdataset("Duncan", "carData") | |
X = data.data[['prestige', 'education']] | |
X = sm.add_constant(X) | |
Y = data.data['income'] | |
model = sm.OLS(Y, X) | |
results = model.fit() | |
print(results.summary()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This code is adapted from the official GPflow document page: | |
# https://gpflow.readthedocs.io/en/master/notebooks/advanced/gps_for_big_data.html | |
import numpy as np | |
import gpflow | |
import tensorflow as tf | |
import matplotlib.pyplot as plt | |
from gpflow.ci_utils import ci_niter | |
plt.style.use("ggplot") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from mpl_toolkits.mplot3d import Axes3D | |
import matplotlib.pyplot as plt | |
from matplotlib import cm | |
n = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import seaborn as sns | |
import numpy as np | |
import tensorflow as tf | |
from gpflow.models import VGP | |
from matplotlib.ticker import MaxNLocator | |
import gpflow | |
from gpflow import default_float | |
import matplotlib.pyplot as plt | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from generate_training_data import generate_points | |
from gp import ExponentialSquaredKernel, GP | |
import numpy as np | |
import matplotlib.pyplot as plt | |
lengthscale = 1. | |
signal_variance = 1. | |
noise_variance = 0.1 | |
X, Y = generate_points(start=np.pi * 0, end=np.pi*2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
import scipy.stats as stats | |
import math | |
mu = 0 | |
variance = 1 | |
sigma = math.sqrt(variance) | |
x = np.linspace(mu - 3*sigma, mu + 3*sigma, 100) | |
fig = plt.figure() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import tensorflow_probability as tfp | |
from tensorflow_probability import sts | |
tf.reset_default_graph() | |
prediction_steps = 12 | |
# skyline is an array storing mountain skyline data points. | |
training_data = skyline[:-prediction_steps] | |
# Build local linear trend model. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import scipy.stats | |
import numpy as np | |
from matplotlib.ticker import NullFormatter | |
x_min = -20.0 | |
x_max = 20.0 | |
x = np.linspace(x_min, x_max, 100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import tensorflow as tf | |
import tensorflow_probability as tfp | |
from tensorflow_probability import sts | |
import seaborn as sns | |
from matplotlib import pylab as plt | |
from matplotlib.ticker import NullFormatter | |
def plot_forecast(x, y, forecast_mean, forecast_scale, title, x_locator=None, x_formatter=None): |
NewerOlder