yarn add redux react-redux redux-thunk redux-devtools-extension redux-logger immutable redux-immutable node-sass-chokidar
rm src/App* src/logo*
// ./src/store.js
import { createStore, applyMiddleware, compose } from 'redux'
alias irbg='irb -I ./lib -r ./lib/*.rb' |
git config --global alias.co checkout | |
git config --global alias.br branch | |
git config --global alias.ci commit | |
git config --global alias.st status | |
git config --global alias.ust 'reset HEAD --' |
data = np.array([1,2,3,4,5]) | |
np.pad(data, (2, 3), 'constant', constant_values=9) | |
# [9,9,1,2,3,4,5,9,9,9] | |
np.pad(data, (0, 3), 'constant', constant_values=9) | |
# [1,2,3,4,5,9,9,9] | |
np.pad(data, (2, 0), 'constant', constant_values=9) | |
# [9,9,1,2,3,4,5] |
# count the number of expected result | |
sum(record.outcome == 1 for record in data.records) | |
# Count the values | |
df.column_name.value_counts() | |
# or | |
df.groupby('column_name').count() |
from sklearn.learning_curve import learning_curve | |
import numpy as np | |
import matplotlib.pyplot as plt | |
N, train_lc, val_lc = learning_curve(svc_clf, X_train, y_train, cv=7, train_sizes=np.linspace(0.3, 1, 25)) | |
plt.plot(N, np.mean(train_lc, 1), color='blue', label='training score') | |
plt.plot(N, np.mean(val_lc, 1), color='red', label='validation score') | |
plt.hlines(np.mean([train_lc[-1], val_lc[-1]]), N[0], N[-1], color='gray', linestyle='dashed') | |
plt.set_ylim(0, 1) |
// SAGA | |
export const disconnectPage = function*(pageId) { | |
const accessToken = yield call(ensureAccessTokenSaga) | |
const { success, data, error } = yield call(disconnectFacebookPage(pageId), accessToken) | |
if(success === true) { | |
yield put(dataRequest({ | |
key: 'facebook_page_settings:pages', | |
fetcher: fetchFacebookPages, | |
})) |
const randomColor = () => '#'+(Math.random()*0xFFFFFF<<0).toString(16) |
import numpy as np | |
X = np.array([ | |
[2.31, 4.58], | |
[1.56,4.27], | |
[5.48,5.61], | |
[0.03,1.49], | |
[6.13,6.07], | |
[2.36,4.75], | |
[2.14,4.3], |