This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ bash | |
# VAR1=$1 | |
# VAR2=$2 | |
# VAR3=$3 | |
python example.py ${VAR1} ${VAR1} ${VAR1} | |
------------------------------------------------------------------------------------ | |
Inside the python file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --------------------------------------------------------- | |
# library imports. | |
import numpy as np | |
import pandas as pd | |
from matplotlib import pyplot as plt | |
from matplotlib.dates import DateFormatter, DayLocator, HourLocator | |
# ********************************************************* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
cout << "Hello World" << endl; | |
count << "Does is sync" << endl; | |
return 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
cout << "Hello World" << endl; | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Without policy class.. | |
Optimize(arma::mat& iterate){ | |
arma::mat v = arma::zeros<arma::mat>(iterate.n_rows, iterate.n_cols); | |
for(;;){ | |
v = momentum*v - stepSize * gradient; | |
iterate += v; | |
} |