Skip to content

Instantly share code, notes, and snippets.

View arunreddy's full-sized avatar
🎯
Focusing

Arun Reddy arunreddy

🎯
Focusing
View GitHub Profile
#The below 2 sections are commented, they control the default sound card to use
#This set up is for a Pi with an I2S microphone attached using the guide
#from adafruit at
# https://learn.adafruit.com/adafruit-i2s-mems-microphone-breakout
#Uncomment and the I2S will be your default card (assuming same setup)
#but you won't get audio playback because both recording and playback will be
#defaulted
#TODO - Figure out how to set default for recording separately
#To adjust use aplay -l to work out the devices you have and their card number
#For recording devices use arecord -l
@arunreddy
arunreddy / example.sh
Last active July 27, 2017 01:24
example.sh
#!/bin/ bash
# VAR1=$1
# VAR2=$2
# VAR3=$3
python example.py ${VAR1} ${VAR1} ${VAR1}
------------------------------------------------------------------------------------
Inside the python file.
@arunreddy
arunreddy / power_plots.py
Last active January 13, 2023 16:37
power_plots.py
# ---------------------------------------------------------
# library imports.
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from matplotlib.dates import DateFormatter, DayLocator, HourLocator
# *********************************************************
@arunreddy
arunreddy / multiple.py
Last active July 25, 2017 14:44
multiple.py
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from matplotlib.dates import DateFormatter
from datetime import timedelta, date
def datetime(x):
return np.array(x, dtype = np.datetime64)
@arunreddy
arunreddy / RTD_ZONAL_LBMP.py
Last active July 24, 2017 00:13
RTD_ZONAL_LBMP.py
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from matplotlib.dates import DateFormatter, MinuteLocator, MonthLocator
def datetime(x):
return np.array(x, dtype = np.datetime64)
@arunreddy
arunreddy / policy_class.cpp
Last active March 6, 2017 21:31
policy_class
// SGD with variadic templates for policy type class.
template<typename DecomposableFunctionType, typename ... PolicyType>
class SGD{
}
// Use alias to declare most frequently used combinations.
using StandardSGD = SGD<FunctionType, EmptyUpdate, NoDecay>;
using SGD2 = SGD<FunctionType, MomentumUpdate, NoDecay>;
using SGD3 = SGD<FunctionType, NesterovUpdate, ExponentialDecay>;
@arunreddy
arunreddy / policy_types.cpp.cpp
Created March 6, 2017 05:47
policy_types.cpp created by arunreddy - https://repl.it/GIX8/1
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World" << endl;
count << "Does is sync" << endl;
return 0;
@arunreddy
arunreddy / policy_types.cpp.cpp
Created March 6, 2017 05:46
policy_types.cpp created by arunreddy - https://repl.it/GIX8/0
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World" << endl;
return 0;
}
@arunreddy
arunreddy / logistic_regression_mlplack.cpp
Last active March 5, 2017 23:27
Logistic Regression MLPACK.
// logistic_regression_test.cpp Lines[504-512]
// Very simple fake dataset.
arma::mat data("1 2 3;"
"1 2 3");
arma::Row<size_t> responses("1 1 0");
// Create a logistic regression object using a custom SGD object with a much
// smaller tolerance.
LogisticRegressionFunction<> lrf(data, responses, 0.001);
StandardSGD <LogisticRegressionFunction<>> sgdOpt(lrf);
sgdOpt.MaxIterations() = maxIterations;
sgdOpt.Tolerance() = tolerance;
sgdOpt.StepSize() = stepSize;
Log::Info << "Training model with SGD optimizer." << endl;
// This will train the model.
model.Train(sgdOpt);