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 requests | |
test_data = [ | |
[8.0, 390.0, 190.0, 3850.0, 8.5, 70.0, 0.0, 0.0, 1.0], | |
[8.0, 360.0, 215.0, 4615.0, 14.0, 70.0, 0.0, 0.0, 1.0], | |
[8.0, 304.0, 193.0, 4732.0, 18.5, 70.0, 0.0, 0.0, 1.0], | |
[4.0, 113.0, 95.0, 2228.0, 14.0, 71.0, 0.0, 1.0, 0.0], | |
[6.0, 232.0, 100.0, 2634.0, 13.0, 71.0, 0.0, 0.0, 1.0], | |
] |
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 sys | |
from flask import Flask, request, jsonify | |
import traceback | |
import pandas as pd | |
import numpy as np | |
import json | |
import tensorflow as tf | |
from tensorflow import keras | |
from tensorflow.keras import layers | |
from tensorflow.keras.layers.experimental import preprocessing |
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
normalizer = preprocessing.Normalization(axis=-1) | |
normalizer.adapt(np.array(train_features)) | |
model = keras.Sequential( | |
[ | |
normalizer, | |
layers.Dense(64, activation="relu"), | |
layers.Dense(64, activation="relu"), | |
layers.Dense(1), | |
] |
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
url = "http://archive.ics.uci.edu/ml/machine-learning-databases/auto-mpg/auto-mpg.data" | |
column_names = [ | |
"MPG", | |
"Cylinders", | |
"Displacement", | |
"Horsepower", | |
"Weight", | |
"Acceleration", | |
"Model Year", | |
"Origin", |
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 pyvirtualdisplay import Display | |
from selenium import webdriver | |
import time | |
import numpy as np | |
display = Display(visible=0, size=(1920, 1080)) | |
display.start() | |
options = webdriver.ChromeOptions() | |
options.add_argument("--kiosk") |
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 math | |
from mayavi import mlab | |
mlab.clf() | |
x, y, z = np.mgrid[-3:3:50j, -3:3:50j, -3:3:50j] | |
# Plot a sphere of radius 1 | |
values = x * x + y * y + z * z - np.sqrt(3) | |
mlab.contour3d(x, y, z, values, contours=20, colormap="jet", opacity=0.5) |
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 import mplot3d | |
theta = np.linspace(0, 8 * np.pi, 120) | |
w = np.linspace(-0.25, 0.25, 8) | |
w, theta = np.meshgrid(w, theta) |
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 | |
import random | |
from matplotlib import rc | |
rc('font',**{'family':'serif','serif':['Helvetica']}) | |
rc('text', usetex=True) | |
start, stop, step = 1, 10, 0.4 | |
data_x = [x for x in np.arange(start, stop, step)] |
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
# -*- coding: utf-8 -*- | |
import random | |
import time | |
from concurrent.futures import ProcessPoolExecutor, as_completed | |
from multiprocessing import Pool | |
import numpy | |
from tqdm import tqdm |