Android Asynchronous Http Client

Gradle Dependency

dependencies {
    ...
    implementation 'com.loopj.android:android-async-http:1.4.9'
}

AsyncClient

AsyncHttpClient client = new AsyncHttpClient();
client.get(URL, params, new JsonHttpResponseHandler(){
    @Override
    public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
        super.onSuccess(statusCode, headers, response);
    }
});

Build Request Params

RequestParams params = new RequestParams();
params.put("lat", latitude);
params.put("lon", longitude);
params.put("appid", APP_ID);

k-fold crossvalidation with sklearn

from sklearn.model_selection import KFold

kf = KFold(n_splits=2)

kf.split(df_train)

step = 0 # set counter to 0
for train_index, val_index in kf.split(df_train): # for each fold
    step = step + 1 # update counter

    print('Step ', step)

    features_fold_train = df_train.iloc[train_index, [4, 5]] # features matrix of training data (of this step)
    features_fold_val = df_train.iloc[val_index, [4, 5]] # features matrix of validation data (of this step) 

    target_fold_train = df_train.iloc[train_index, 6] # target vector of training data (of this step)
    target_fold_val = df_train.iloc[val_index, 6] # target vector of validation data (of this step) 

    print("VALIDATE:", val_index)
    print('Dimensions features matrix for validation: ', features_fold_val.shape)
    print("TRAIN:", train_index)
    print('Dimensions features matrix for training: ',features_fold_train.shape, '\n')

Data Science Pipeline

Learning Data Science can be grueling and overwhelming sometimes. When I feel too overwhelmed it’s time to draw a picture. This my current overview of what a data scientist has to do:

Joint account for couples

Living single

As long as you are single or in a partnership with no common household everything is easy money wise: you spend your money,
your partner spends his or her money. Done!

But wait! What happens, when you eat in a restaurant together? Do you split the bill or do you pay this time and your partner will pay
the next time? What happens when your partner just earns less than you do? Or the other way around?
Do you pay two times in a row and then your partner will take his/her turn? Pretty dull, huh?

Moving in together

Say you are in a long term relationship and you finally make the move and move in together.
In terms of money it gets even more complicated: you pay rent, fill your fridge together, use you cars together.
How do you split it up now? “You pay the rent and I pay the gas? You pay the insurance and I the pay for the food?”
Or do you split the rent and wire it half and half to the landlord?
How do you keep track of the overall splitting thing? Do you write it down? What happens when you have to drive more or gas gets expensive?

Joint Account

Continue reading “Joint account for couples”