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)"
Function | Command | |
---|---|---|
Get a list of all your environments | conda env list | |
Get a list of all the packages installed in your current active environment | conda list | |
Create an environment called [ENV_NAME] | conda create --name [ENV_NAME] | |
Create an environment called [ENV_NAME] and install pandas and numpy | conda create --name [ENV_NAME] pandas numpy | |
Activate an environment called [ENV_NAME] | conda activate [ENV_NAME] | |
Create an environment folder called env in the current working directory (e.g. /Users/Daniel/project_1/) and install pandas and numpy | conda create --prefix ./env pandas numpy | |
Activate an environment stored in a folder called env which is located within /Users/Daniel/project_1/ | conda activate /Users/daniel/project_1/env | |
Deactivate an environment | conda deactivate | |
Export your current active environment to a YAML file called environment (see why below) | conda env export > environment.yaml |
@RunWith(PowerMockRunner.class) – Tell Junit that run this test using PowerMockRunner | |
@PrepareForTest(A.class) – This is needed when we need to test static methods of A class | |
AService mock = PowerMockito.mock(A.class) – Creating a mock for A class | |
PowerMockito.when(mock.mockedMethod()).thenReturn(value) – When mockedMethod is called in the code, then return the value specified here. |
Picking the right architecture = Picking the right battles + Managing trade-offs
from bayes_opt import BayesianOptimization | |
from sklearn.cross_validation import KFold | |
import xgboost as xgb | |
def xgbCv(train, features, numRounds, eta, gamma, maxDepth, minChildWeight, subsample, colSample): | |
# prepare xgb parameters | |
params = { | |
"objective": "reg:linear", | |
"booster" : "gbtree", | |
"eval_metric": "mae", |
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.