Skip to content

Instantly share code, notes, and snippets.

" The default vimrc file.
"
" Maintainer: Bram Moolenaar <[email protected]>
" Last change: 2017 Jun 13
"
" This is loaded if no vimrc file was found.
" Except when Vim is run with "-u NONE" or "-C".
" Individual settings can be reverted with ":set option&".
" Other commands can be reverted as mentioned below.
@watermouth
watermouth / memos_on_pandas.md
Last active April 13, 2019 11:21
pandas.DataFrame: Indexing and Selecting Data

Indexing and Selecting Data についてのメモ

ソース

http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html

Indexing and Selecting Data

Visual Studio Code (VS Code) の各種設定・使用法

  • OS: Windows 10

使用方法

基本コマンド

  • Ctrl + shift + p: vs code 上のコマンドプロンプトを開ける.
  • Ctrl + p: エディタ上での操作コマンドプロンプトを選択できる. ファイルを開くこともできる.

Python環境構築 anaconda tensorflow-gpu

# 環境を作る
conda create -y -n env名 tensorflow-gpu keras ipykernel pandas matplotlib scikit-learn seaborn
conda install -y -c conda-forge category_encoders
# jupyter-notebookを起動可能にする  
conda activate env名
python -m ipykernel install --user --name env名
@watermouth
watermouth / python_tensorflow_reprodubile.md
Created July 15, 2019 07:52
Kerasでreproducible 再現可能 gpu

Keras (tensorflow backend) で 再現可能なNN (Neural Network) model.fitの実行

事前に以下実行でOKだった. 記事 https://qiita.com/okotaku/items/8d682a11d8f2370684c9 と違うのは、randomそのものの部分の設定.

import os
import numpy as np
import keras.backend as K
import tensorflow as tf
@watermouth
watermouth / list_memory_usage.R
Created July 31, 2019 06:13
R メモリ使用量調査用便利関数
# utility functions
Msize <- function(x)
as.integer(object.size(x)) / 1e6
listMsize <-
function(v)
sort(sapply(v, function(x)
Msize(get(x))), decreasing = T)
# listMsize(ls()) などとする
@watermouth
watermouth / R_dplyr_memo.md
Created August 7, 2019 04:45
dplyr: summarise_at not working on data.table

error message

data.table(iris) %>% group_by(Species) %>% summarise_at(vars(starts_with("Sepal")), funs(sum))
Error in !funs : invalid argument type

workaround

convert the data type data.table to data.frame.

@watermouth
watermouth / tips.R
Created October 15, 2019 06:40
取りうる値のうち存在しない値についてもカウントなどする
# x
# A tibble: 6 x 7
CNumber Year Month Side TekiyouCode Amount eDate
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <date>
1 XXX 2012 6 1 0 100000. 2012-06-30
2 XXX 2012 6 1 11 99999. 2012-06-30
3 XXX 2012 6 1 12 100001. 2012-06-30
4 XXX 2012 6 1 15 100001. 2012-06-30
5 XXX 2012 6 8 0 100002. 2012-06-30
6 XXX 2012 6 8 11 100001. 2012-06-30
@watermouth
watermouth / R_dplyr_memo.md
Created October 19, 2019 00:10
dplyr を vector に適用する...ことはできないが似たことはできる