Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"| from csv import reader | |
| from hashlib import sha512 | |
| import sys | |
| # Simple merkle tree example | |
| # Invoke the script by calling "python merkle_sample.py "file1.csv" "file2.csv" to compare two merkle trees | |
| class Merkle: | |
| def __init__(self, file): | |
| self.file = file |
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| from keras.callbacks import EarlyStopping, ModelCheckpoint | |
| save_early_callback = EarlyStopping(monitor='val_loss', patience=5) | |
| save_best_callback = \ | |
| ModelCheckpoint('/content/model-{epoch:02d}-{val_accuracy:.2f}.f5' | |
| , save_best_only=True, save_weights_only=True) | |
| model.fit( |
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| from keras.callbacks import EarlyStopping | |
| save_early_callback = EarlyStopping(monitor='val_loss', min_delta=0, | |
| patience=3, verbose=1, | |
| restore_best_weights=True) | |
| model.fit( | |
| X_train, | |
| y_train, | |
| batch_size=64, |
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| save_best_callback = tf.keras.callbacks.ModelCheckpoint( | |
| 'content/model-{epoch:02d}-{val_acc:.2f}.f5', | |
| monitor='val_accuracy', | |
| verbose=1, | |
| save_best_only=True, | |
| save_weights_only=False, | |
| save_freq=100, | |
| ) |
| # bully algorithm sample /no sockets | |
| import random | |
| def resurrect(x): | |
| if running[x] == 1: | |
| print("Leader is running") | |
| return | |
| print("node ", x, " back to life") | |
| running[x] = 1 |
| #%% | |
| import numpy as np | |
| import pandas as pd | |
| data = pd.read_csv("preprocessed_data.csv") | |
| data = data.sample(frac=1) | |
| train_size = int(0.8 * len(data)) | |
| features = data.drop(columns=["Price"]) | |
| targets= data["Price"] | |
| X_train, X_test = features.values[:train_size, :], features.values[train_size:,:] |