{{ message }}

Instantly share code, notes, and snippets.

# Apara Venkat AparaV

🌴
On vacation
Created Nov 27, 2019
View SIRSimulationsTestSuite.ipynb
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Last active Jan 8, 2018
Companion code for my Number Guessing Game article - https://aparav.github.io/2018/01/08/the-number-guessing-game/
View number-guessing-game.py
 ''' Author: Aparajithan Venkateswaran Companion Article: https://aparav.github.io/2018/01/08/the-number-guessing-game/ ''' from scipy.special import comb def conditional_prob(i, k, n, m): ''' Calculates the probability of event C conditioned on Ri
Last active Aug 12, 2017
View nn_housing.py
 import os import csv import numpy as np import pandas as pd import tensorflow as tf train_size = np.shape(x_train) valid_size = np.shape(x_valid) test_size = np.shape(x_test) num_features = np.shape(x_train)
Last active Jul 31, 2017
View regression_housing_3.py
 import tensorflow as tf import numpy as np def accuracy(prediction, labels): return 0.5 * np.sqrt(((prediction - labels) ** 2).mean(axis=None)) train_size = np.shape(x_train) valid_size = np.shape(x_valid) test_size = np.shape(x_test) num_features = np.shape(x_train)
Last active Jan 3, 2018
View regression_housing_2.py
 def split(train_dataset): ''' Shuffle data and split into 3 datasets 1. Training - 60% 2. Validation - 20% 3. Testing - 20% ''' # Shuffle data train_dataset = train_dataset.sample(frac=1)
Created Jul 29, 2017
View regression_housing_1.py
 import csv import random import numpy as np import pandas as pd def cleanup(df): ''' Cleans data 1. Creates new features:
Last active Apr 8, 2017
Compare the runtime of the sieve against vectors and bool arrays
View sieve-eratosthenes-runtime-comparison.cpp
 #include #include #include using namespace std; bool* boolPrimeSieveMemset(int64_t size) { bool* prime = new bool[size + 1]; memset(prime, true, size + 1); //faster than loops and vectors prime = false;
Last active Jul 22, 2021
Using the tweepy library to stream tweets has a catch. There is no built-in feature that allows you to stop streaming after a fixed time. To avoid manually terminating the stream, this code proposes a simple solution without any (complex) multi-threading.
View streamer.py
 import os import time import tweepy from tweepy import OAuthHandler from tweepy import Stream from tweepy import StreamListener def authenticate():