This file contains hidden or 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 | |
# Plot utility | |
def plot_graphs(history, string): | |
plt.plot(history.history[string]) | |
plt.plot(history.history['val_'+string]) | |
plt.xlabel("Epochs") | |
plt.ylabel(string) | |
plt.legend([string, 'val_'+string]) | |
plt.show() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 | |
plt.rcParams.update({ | |
"lines.color": "white", | |
"patch.edgecolor": "white", | |
"text.color": "white", | |
"axes.facecolor": "black", | |
"axes.edgecolor": "white", | |
"axes.labelcolor": "white", | |
"xtick.color": "white", |
This file contains hidden or 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
<?php | |
namespace App\Http\Controllers\API; | |
class ResponseFormatter | |
{ | |
protected static $response = [ | |
'meta' => [ | |
'code' => 200, | |
'status' => 'success', |
This file contains hidden or 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 pandas as pd | |
evaluation = pd.DataFrame(model.history.history) | |
evaluation[['accuracy', 'val_accuracy']].plot() | |
evaluation[['loss', 'val_loss']].plot() |
This file contains hidden or 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
# Plot the training and validation accuracies for each epoch | |
acc = history.history['accuracy'] | |
val_acc = history.history['val_accuracy'] | |
loss = history.history['loss'] | |
val_loss = history.history['val_loss'] | |
epochs = range(len(acc)) | |
fig = plt.figure(figsize = (15,5)) |
This file contains hidden or 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
class myCallback(tf.keras.callbacks.Callback): | |
def on_epoch_end(self, epoch, logs={}): | |
if logs.get('accuracy') is not None and logs.get('val_accuracy') > 0.85: | |
print("\nReached 85% validation accuracy so cancelling training!") | |
self.model.stop_training = True | |
callback = myCallback() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 | |
from bs4 import BeautifulSoup as soup | |
import os | |
# Define Website to Download pdf | |
url = 'website to download pdfs' | |
# Get Website content | |
r = requests.get(url) |
This file contains hidden or 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
gpu_info = !nvidia-smi | |
gpu_info = '\n'.join(gpu_info) | |
if gpu_info.find('failed') >= 0: | |
print('Not connected to a GPU') | |
else: | |
print(gpu_info) | |
from psutil import virtual_memory | |
ram_gb = virtual_memory().total / 1e9 | |
print('Your runtime has {:.1f} gigabytes of available RAM\n'.format(ram_gb)) |
OlderNewer