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)"
# 1. Download and install the latest Anaconda distribution from https://www.continuum.io/downloads#macos | |
# 2. Create a new Python environment. Make sure you choose python 3.5 as your python version for the virtual environment: | |
conda create -n myenv python=3.5 | |
# 3. Activate the new environment using: | |
source activate myenv |
#!/usr/bin/env python | |
from datetime import datetime | |
from time import time | |
from lxml import html, etree | |
import requests, re | |
import os, sys | |
import unicodecsv as csv | |
import argparse | |
#%% | |
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:,:] |
# 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 |
#!/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, | |
) |
#!/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 -*- | |
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( |