Skip to content

Instantly share code, notes, and snippets.

View vishwanath79's full-sized avatar

Vishwanath Subramanian vishwanath79

View GitHub Profile
@vishwanath79
vishwanath79 / MacOS_Install_OpenCV.py
Last active May 9, 2019 17:35
Install OpenCV on Mac OS Sierra on Python 3.5
# 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
@vishwanath79
vishwanath79 / tripadvisor_scraper.py
Last active June 5, 2017 04:36
Extract data from tripadvisor hotel
#!/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
@vishwanath79
vishwanath79 / installing_cassandra.md
Created March 8, 2018 07:16 — forked from hkhamm/installing_cassandra.md
Installing Cassandra on Mac OS X

Installing Cassandra on Mac OS X

Install Homebrew

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)"
#%%
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(
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.