├── data
├── 実践vim.jpg
├── hello_world.gif
└── test2valid.gif
├── design
├── enjoy-vim.png
├── enjoy-vim.gvdesign
├── enjoy-vim.png.back
└── enjoy-vim.gvdesign.back
├── enjoy
├── 004_20210421
│ ├── live_coding
│ │ ├── config.yml
│ │ └── iris.py
│ ├── e05.py
│ ├── e01_hello_world.py
│ ├── e04_sharp.py
│ ├── e03_log.py
│ ├── e06_indent.py
│ └── e02_valid.py
├── 000_20210217
│ ├── e01_hello_world.py
│ ├── e03_log.py
│ └── e02_valid.py
├── 005_20210731
│ ├── e02.py
│ ├── e01_hello_world.py
│ ├── e04_sharp.py
│ ├── live_coding
│ │ ├── keeper.py
│ │ ├── animals.py
│ │ └── zoo.py
│ ├── e05_log.py
│ ├── e06_indent.py
│ └── e03_valid.py
├── 001_20210224
│ ├── live_coding
│ │ ├── config.yml
│ │ ├── func.py
│ │ └── iris.py
│ ├── e01_hello_world.py
│ ├── e07_print.py
│ ├── e04_sharp.py
│ ├── e05_column.py
│ ├── e03_log.py
│ ├── e06_indent.py
│ └── e02_valid.py
├── 003_20210307
│ ├── live_coding
│ │ ├── config.yml
│ │ ├── func.py
│ │ └── iris.py
│ ├── e01_hello_world.py
│ ├── e04_sharp.py
│ ├── e05_column.py
│ ├── e03_log.py
│ ├── e06_indent.py
│ └── e02_valid.py
├── 002_20210228
│ ├── e01_hello_world.py
│ ├── e07_print.py
│ ├── e04_sharp.py
│ ├── live_coding
│ │ ├── func.py
│ │ └── iris.py
│ ├── e05_column.py
│ ├── e03_log.py
│ ├── e06_indent.py
│ └── e02_valid.py
└── bkup
│ ├── e01_indent.py
│ └── e03_def.py
├── LICENSE
├── README.md
└── .gitignore
/data/実践vim.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkubota/enjoy-Vim/HEAD/data/実践vim.jpg
--------------------------------------------------------------------------------
/data/hello_world.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkubota/enjoy-Vim/HEAD/data/hello_world.gif
--------------------------------------------------------------------------------
/data/test2valid.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkubota/enjoy-Vim/HEAD/data/test2valid.gif
--------------------------------------------------------------------------------
/design/enjoy-vim.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkubota/enjoy-Vim/HEAD/design/enjoy-vim.png
--------------------------------------------------------------------------------
/enjoy/004_20210421/live_coding/config.yml:
--------------------------------------------------------------------------------
1 | globals:
2 | seed: 43
3 | test_size: 0.5
4 |
--------------------------------------------------------------------------------
/design/enjoy-vim.gvdesign:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkubota/enjoy-Vim/HEAD/design/enjoy-vim.gvdesign
--------------------------------------------------------------------------------
/design/enjoy-vim.png.back:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkubota/enjoy-Vim/HEAD/design/enjoy-vim.png.back
--------------------------------------------------------------------------------
/enjoy/000_20210217/e01_hello_world.py:
--------------------------------------------------------------------------------
1 | '''
2 | hoge を hello world にして
3 | '''
4 |
5 | print('hoge')
6 |
--------------------------------------------------------------------------------
/enjoy/004_20210421/e05.py:
--------------------------------------------------------------------------------
1 | '''
2 | 'b': (3, 4) を 'c': 5に
3 | '''
4 |
5 | func('hoge', **{'b': (3, 4)})
6 |
--------------------------------------------------------------------------------
/enjoy/005_20210731/e02.py:
--------------------------------------------------------------------------------
1 | '''
2 | 'b': (3, 4) を 'c': 5に
3 | '''
4 |
5 | func('hoge', **{'b': (3, 4)})
6 |
--------------------------------------------------------------------------------
/design/enjoy-vim.gvdesign.back:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fkubota/enjoy-Vim/HEAD/design/enjoy-vim.gvdesign.back
--------------------------------------------------------------------------------
/enjoy/001_20210224/live_coding/config.yml:
--------------------------------------------------------------------------------
1 | model:
2 | params:
3 | max_depth: 2
4 | min_samples_split: 5
5 |
--------------------------------------------------------------------------------
/enjoy/003_20210307/live_coding/config.yml:
--------------------------------------------------------------------------------
1 | model:
2 | params:
3 | max_depth: 2
4 | min_samples_split: 10
5 |
--------------------------------------------------------------------------------
/enjoy/004_20210421/e01_hello_world.py:
--------------------------------------------------------------------------------
1 | '''
2 | hoge を hello world にして
3 | '''
4 |
5 | print('hoge', 'aaa', "bbb")
6 |
--------------------------------------------------------------------------------
/enjoy/005_20210731/e01_hello_world.py:
--------------------------------------------------------------------------------
1 | '''
2 | hoge を hello world にして
3 | '''
4 |
5 | print('hoge', 'aaa', "bbb")
6 |
--------------------------------------------------------------------------------
/enjoy/001_20210224/e01_hello_world.py:
--------------------------------------------------------------------------------
1 | '''
2 | hoge を hello world にして
3 | '''
4 |
5 | print('hoge', 'hoge1', "hoge2")
6 |
--------------------------------------------------------------------------------
/enjoy/002_20210228/e01_hello_world.py:
--------------------------------------------------------------------------------
1 | '''
2 | hoge を hello world にして
3 | '''
4 |
5 | print('hoge', 'hoge1', "hoge2")
6 |
--------------------------------------------------------------------------------
/enjoy/003_20210307/e01_hello_world.py:
--------------------------------------------------------------------------------
1 | '''
2 | hoge を hello world にして
3 | '''
4 |
5 | print('hoge', 'hoge1', "hoge2")
6 |
--------------------------------------------------------------------------------
/enjoy/001_20210224/e07_print.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓にしろ
3 |
4 | print('hoge2')
5 | print('hoge1')
6 | '''
7 |
8 | print('hoge1')
9 | print('hoge2')
10 |
--------------------------------------------------------------------------------
/enjoy/002_20210228/e07_print.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓にしろ
3 |
4 | print('hoge2')
5 | print('hoge1')
6 | '''
7 |
8 | print('hoge1')
9 | print('hoge2')
10 |
--------------------------------------------------------------------------------
/enjoy/001_20210224/e04_sharp.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓ を書け
3 |
4 | ###############
5 | # hello world #
6 | ###############
7 | '''
8 |
9 | # hello world
10 |
--------------------------------------------------------------------------------
/enjoy/002_20210228/e04_sharp.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓ を書け
3 |
4 | ###############
5 | # hello world #
6 | ###############
7 | '''
8 |
9 | # hello world
10 |
--------------------------------------------------------------------------------
/enjoy/003_20210307/e04_sharp.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓ を書け
3 |
4 | ###############
5 | # hello world #
6 | ###############
7 | '''
8 |
9 | # hello world
10 |
--------------------------------------------------------------------------------
/enjoy/004_20210421/e04_sharp.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓ を書け
3 |
4 | ###############
5 | # hello world #
6 | ###############
7 | '''
8 |
9 | # hello world
10 |
--------------------------------------------------------------------------------
/enjoy/005_20210731/e04_sharp.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓ を書け
3 |
4 | ###############
5 | # hello world #
6 | ###############
7 | '''
8 |
9 | # hello world
10 |
--------------------------------------------------------------------------------
/enjoy/002_20210228/live_coding/func.py:
--------------------------------------------------------------------------------
1 | from ipdb import set_trace as st
2 | from sklearn.datasets import load_iris
3 |
4 |
5 | def load_dataset():
6 | iris = load_iris()
7 | return iris.data, iris.target
8 |
--------------------------------------------------------------------------------
/enjoy/003_20210307/live_coding/func.py:
--------------------------------------------------------------------------------
1 | from sklearn.datasets import load_iris
2 | import matplotlib.pyplot as plt
3 |
4 |
5 | def load_dataset():
6 | iris = load_iris()
7 |
8 | return iris.data, iris.target
9 |
--------------------------------------------------------------------------------
/enjoy/000_20210217/e03_log.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓を書け
3 | n_epoch = 30
4 |
5 | for epoch in range(n_epoch):
6 | print(f'train_loss: {epoch*1}')
7 | print(f'valid_loss: {epoch*2}')
8 | print(f'end epoch {epoch}')
9 | '''
10 |
--------------------------------------------------------------------------------
/enjoy/001_20210224/e05_column.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓にしろ
3 |
4 | |col1 | col2|
5 | |--- | ---|
6 | |a | AAAA|
7 | |b | BBB|
8 | |c | CCCCCCCC|
9 | '''
10 |
11 | col1 | col2
12 | --- | ---
13 | a | AAAA
14 | b | BBB
15 | c | CCCCCCCC
16 |
--------------------------------------------------------------------------------
/enjoy/002_20210228/e05_column.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓にしろ
3 |
4 | |col1 | col2|
5 | |--- | ---|
6 | |a | AAAA|
7 | |b | BBB|
8 | |c | CCCCCCCC|
9 | '''
10 |
11 | col1 | col2
12 | --- | ---
13 | a | AAAA
14 | b | BBB
15 | c | CCCCCCCC
16 |
--------------------------------------------------------------------------------
/enjoy/003_20210307/e05_column.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓にしろ
3 |
4 | |col1 | col2|
5 | |--- | ---|
6 | |a | AAAA|
7 | |b | BBB|
8 | |c | CCCCCCCC|
9 | '''
10 |
11 | col1 | col2
12 | --- | ---
13 | a | AAAA
14 | b | BBB
15 | c | CCCCCCCC
16 |
--------------------------------------------------------------------------------
/enjoy/001_20210224/e03_log.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓を書け
3 |
4 | n_epoch = 30
5 |
6 | for epoch in range(n_epoch):
7 | print(f'train_loss: {epoch*1}')
8 | print(f'valid_loss: {epoch*2}')
9 | print(f'end epoch {epoch}')
10 | '''
11 |
--------------------------------------------------------------------------------
/enjoy/005_20210731/live_coding/keeper.py:
--------------------------------------------------------------------------------
1 | class keeper:
2 | def __init__(self, name):
3 | self.name = name
4 |
5 | def bark(self):
6 | print(f'({self.name})nya-n!!')
7 |
8 | def feed(self, animal):
9 | animal.genki += 1
10 |
--------------------------------------------------------------------------------
/enjoy/bkup/e01_indent.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓にしろ
3 |
4 | for i in range(10):
5 | for j in range(10):
6 | print(i, j)
7 | print(i+10, j+10)
8 | '''
9 |
10 | for i in range(10):
11 | for j in range(10):
12 | print(i, j)
13 | print(i+10, j+10)
14 |
--------------------------------------------------------------------------------
/enjoy/003_20210307/e03_log.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓を書け
3 |
4 | n_epoch = 30
5 |
6 | for epoch in range(n_epoch):
7 | print(f'train_loss: {epoch*1}')
8 | print(f'valid_loss: {epoch*2}')
9 | '''
10 |
11 | n_epoch = 30
12 |
13 | for epoch in range(n_epoch):
14 | print(f'train_loss: {epoch*1}')
15 |
--------------------------------------------------------------------------------
/enjoy/004_20210421/e03_log.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓を書け
3 |
4 | n_epoch = 30
5 |
6 | for epoch in range(n_epoch):
7 | print(f'train_loss: {epoch*1}')
8 | print(f'valid_loss: {epoch*2}')
9 | '''
10 |
11 | n_epoch = 30
12 |
13 | for epoch in range(n_epoch):
14 | print(f'train_loss: {epoch*1}')
15 |
--------------------------------------------------------------------------------
/enjoy/005_20210731/e05_log.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓を書け
3 |
4 | n_epoch = 30
5 |
6 | for epoch in range(n_epoch):
7 | print(f'train_loss: {epoch*1}')
8 | print(f'valid_loss: {epoch*2}')
9 | '''
10 |
11 | n_epoch = 30
12 |
13 | for epoch in range(n_epoch):
14 | print(f'train_loss: {epoch*1}')
15 |
--------------------------------------------------------------------------------
/enjoy/002_20210228/e03_log.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓を書け
3 |
4 | n_epoch = 30
5 |
6 | for epoch in range(n_epoch):
7 | print(f'train_loss: {epoch*1}')
8 | print(f'valid_loss: {epoch*2}')
9 | print(f'end epoch {epoch}')
10 | '''
11 |
12 | n_epoch = 30
13 |
14 | for epoch in range(n_epoch):
15 | print(f'train_loss: {epoch*1}')
16 |
--------------------------------------------------------------------------------
/enjoy/001_20210224/live_coding/func.py:
--------------------------------------------------------------------------------
1 | import pandas as pd
2 | from sklearn.datasets import load_iris
3 |
4 |
5 | def get_datasets():
6 | iris = load_iris()
7 | data = iris.data
8 | feature_names = iris.feature_names
9 | target = iris.target
10 | df = pd.DataFrame(data, columns=feature_names)
11 |
12 | return df, target
13 |
--------------------------------------------------------------------------------
/enjoy/002_20210228/e06_indent.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓にしろ
3 |
4 | def hoge(
5 | hoge1,
6 | hoge2,
7 | hoge3,
8 | hoge4,
9 | hoge5,
10 | ):
11 | '''
12 |
13 | def hoge(
14 | hoge1,
15 | hoge2,
16 | hoge3,
17 | hoge4,
18 | hoge5,
19 | ):
20 |
--------------------------------------------------------------------------------
/enjoy/003_20210307/e06_indent.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓にしろ
3 |
4 | def hoge(
5 | hoge1,
6 | hoge2,
7 | hoge3,
8 | hoge4,
9 | hoge5,
10 | ):
11 | '''
12 |
13 | def hoge(
14 | hoge1,
15 | hoge2,
16 | hoge3,
17 | hoge4,
18 | hoge5,
19 | ):
20 |
--------------------------------------------------------------------------------
/enjoy/004_20210421/e06_indent.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓にしろ
3 |
4 | def hoge(
5 | hoge1,
6 | hoge2,
7 | hoge3,
8 | hoge4,
9 | hoge5,
10 | ):
11 | '''
12 |
13 | def hoge(
14 | hoge1,
15 | hoge2,
16 | hoge3,
17 | hoge4,
18 | hoge5,
19 | ):
20 |
--------------------------------------------------------------------------------
/enjoy/005_20210731/e06_indent.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓にしろ
3 |
4 | def hoge(
5 | hoge1,
6 | hoge2,
7 | hoge3,
8 | hoge4,
9 | hoge5,
10 | ):
11 | '''
12 |
13 | def hoge(
14 | hoge1,
15 | hoge2,
16 | hoge3,
17 | hoge4,
18 | hoge5,
19 | ):
20 |
--------------------------------------------------------------------------------
/enjoy/001_20210224/e06_indent.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓にしろ
3 |
4 | def hoge(
5 | hoge1,
6 | hoge2,
7 | hoge3,
8 | hoge4,
9 | hoge5,
10 | ):
11 | '''
12 |
13 | def hoge(
14 | hoge1,
15 | hoge2,
16 | hoge3,
17 | hoge4,
18 | hoge5,
19 | ):
20 |
--------------------------------------------------------------------------------
/enjoy/000_20210217/e02_valid.py:
--------------------------------------------------------------------------------
1 | '''
2 | test を valid にして
3 |
4 | * :%s などの置換コマンドは禁止!
5 | '''
6 |
7 | from sklearn.model_selection import KFold
8 | kf = KFold(n_splits=5, shuffle=True)
9 | for fold_i, (train_idx, test_idx) in enumerate(kf.split(X)):
10 | X_train, X_test = X.values[train_idx, :], X.values[test_idx, :]
11 | y_train, y_test = y[train_idx], y[test_idx]
12 |
--------------------------------------------------------------------------------
/enjoy/001_20210224/e02_valid.py:
--------------------------------------------------------------------------------
1 | '''
2 | test を valid にして
3 |
4 | * :%s などの置換コマンドは禁止!
5 | '''
6 |
7 | from sklearn.model_selection import KFold
8 | kf = KFold(n_splits=5, shuffle=True)
9 | for fold_i, (train_idx, test_idx) in enumerate(kf.split(X)):
10 | X_train, X_test = X.values[train_idx, :], X.values[test_idx, :]
11 | y_train, y_test = y[train_idx], y[test_idx]
12 |
13 |
--------------------------------------------------------------------------------
/enjoy/002_20210228/e02_valid.py:
--------------------------------------------------------------------------------
1 | '''
2 | test を valid にして
3 |
4 | * :%s などの置換コマンドは禁止!
5 | '''
6 |
7 | from sklearn.model_selection import KFold
8 | kf = KFold(n_splits=5, shuffle=True)
9 | for fold_i, (train_idx, test_idx) in enumerate(kf.split(X)):
10 | X_train, X_test = X.values[train_idx, :], X.values[test_idx, :]
11 | y_train, y_test = y[train_idx], y[test_idx]
12 |
13 |
--------------------------------------------------------------------------------
/enjoy/003_20210307/e02_valid.py:
--------------------------------------------------------------------------------
1 | '''
2 | test を valid にして
3 |
4 | * :%s などの置換コマンドは禁止!
5 | '''
6 |
7 | from sklearn.model_selection import KFold
8 | kf = KFold(n_splits=5, shuffle=True)
9 | for fold_i, (train_idx, test_idx) in enumerate(kf.split(X)):
10 | X_train, X_test = X.values[train_idx, :], X.values[test_idx, :]
11 | y_train, y_test = y[train_idx], y[test_idx]
12 |
13 |
--------------------------------------------------------------------------------
/enjoy/004_20210421/e02_valid.py:
--------------------------------------------------------------------------------
1 | '''
2 | test を valid にして
3 |
4 | * :%s などの置換コマンドは禁止!
5 | '''
6 |
7 | from sklearn.model_selection import KFold
8 | kf = KFold(n_splits=5, shuffle=True)
9 | for fold_i, (train_idx, test_idx) in enumerate(kf.split(X)):
10 | X_train, X_test = X.values[train_idx, :], X.values[test_idx, :]
11 | y_train, y_test = y[train_idx], y[test_idx]
12 |
13 |
--------------------------------------------------------------------------------
/enjoy/005_20210731/e03_valid.py:
--------------------------------------------------------------------------------
1 | '''
2 | test を valid にして
3 |
4 | * :%s などの置換コマンドは禁止!
5 | '''
6 |
7 | from sklearn.model_selection import KFold
8 | kf = KFold(n_splits=5, shuffle=True)
9 | for fold_i, (train_idx, test_idx) in enumerate(kf.split(X)):
10 | X_train, X_test = X.values[train_idx, :], X.values[test_idx, :]
11 | y_train, y_test = y[train_idx], y[test_idx]
12 |
13 |
--------------------------------------------------------------------------------
/enjoy/005_20210731/live_coding/animals.py:
--------------------------------------------------------------------------------
1 | class dog:
2 | def __init__(self, name):
3 | self.name = name
4 | self.genki = 0
5 |
6 | def bark(self):
7 | print(f'({self.name})wan{"!"*self.genki}')
8 |
9 |
10 | class cat:
11 | def __init__(self, name):
12 | self.name = name
13 | self.genki = 0
14 |
15 | def bark(self):
16 | print(f'({self.name})miaw{"!"*self.genki}')
17 |
--------------------------------------------------------------------------------
/enjoy/bkup/e03_def.py:
--------------------------------------------------------------------------------
1 | '''
2 | ↓にしろ(カッコにa,b,c,dがないので入れろ)
3 |
4 | def hoge_a(a):
5 | ...
6 |
7 | def hoge_b(b):
8 | ...
9 |
10 | def hoge_c(c):
11 | ...
12 |
13 | def hoge_d(d):
14 | ...
15 | '''
16 |
17 | def hoge_a():
18 | print(a)
19 | print(a)
20 | print(a)
21 |
22 | print('hoge')
23 | print('hoge')
24 | print('hoge')
25 |
26 | def hoge_b():
27 | print(b)
28 | print(b)
29 | print(b)
30 |
31 | print('hoge')
32 | print('hoge')
33 | print('hoge')
34 | print('hoge')
35 |
36 | def hoge_c():
37 | print(c)
38 | print(c)
39 | print(c)
40 |
41 | print('hoge')
42 | print('hoge')
43 |
44 | def hoge_d():
45 | print(d)
46 | print(d)
47 | print(d)
48 |
--------------------------------------------------------------------------------
/enjoy/002_20210228/live_coding/iris.py:
--------------------------------------------------------------------------------
1 | from sklearn.metrics import accuracy_score
2 | from sklearn.tree import DecisionTreeClassifier
3 | from sklearn.model_selection import train_test_split
4 | from ipdb import set_trace as st
5 | from func import load_dataset
6 | import pandas as pd
7 | import time
8 |
9 |
10 | def main():
11 | print(f'start {time.ctime()}')
12 | data, target = load_dataset()
13 |
14 | X_train, X_test, y_train, y_test = train_test_split(data, target, test_size=0.33, random_state=42)
15 |
16 |
17 | # model
18 | model = DecisionTreeClassifier(max_depth=2)
19 | model.fit(X_train, y_train)
20 | y_test_pred = model.predict(X_test)
21 |
22 | # eval
23 | acc_test = accuracy_score(y_test, y_test_pred)
24 |
25 | print(f'acc_test = {acc_test}')
26 |
27 |
28 |
29 |
30 |
31 | if __name__ == '__main__':
32 | main()
33 |
--------------------------------------------------------------------------------
/enjoy/003_20210307/live_coding/iris.py:
--------------------------------------------------------------------------------
1 | import yaml
2 | import matplotlib.pyplot as plt
3 | from sklearn.metrics import accuracy_score
4 | from sklearn.tree import DecisionTreeClassifier
5 | from sklearn.model_selection import train_test_split
6 | import time
7 | import func
8 |
9 |
10 | def main():
11 | print(f'start {time.ctime()}')
12 | # config
13 |
14 | with open('config.yml') as file:
15 | config = yaml.safe_load(file)
16 |
17 | data, target = func.load_dataset()
18 |
19 | X_train, X_test, y_train, y_test = train_test_split(data, target, test_size=0.33, random_state=42)
20 |
21 | # model
22 | model = DecisionTreeClassifier(**config['model']['params'])
23 | model.fit(X_train, y_train)
24 |
25 | # pred
26 | y_test_pred = model.predict(X_test)
27 |
28 | # eval
29 | acc_test = accuracy_score(y_test, y_test_pred)
30 |
31 | print(f'acc_test: {acc_test}')
32 | print(f'end {time.ctime()}')
33 |
34 |
35 | if __name__ == '__main__':
36 | main()
37 |
--------------------------------------------------------------------------------
/enjoy/001_20210224/live_coding/iris.py:
--------------------------------------------------------------------------------
1 | from ipdb import set_trace as st
2 | import pandas as pd
3 | import yaml
4 | import time
5 | from sklearn.model_selection import train_test_split
6 | from sklearn.tree import DecisionTreeClassifier
7 | from sklearn.metrics import accuracy_score
8 | import func as F
9 |
10 |
11 | def main():
12 | print(f'start at {time.ctime()}')
13 | with open('config.yml') as file:
14 | config = yaml.safe_load(file)
15 | model_params = config['model']['params']
16 |
17 | df, target = F.get_datasets()
18 | X_train, X_test, y_train, y_test = train_test_split(df, target, test_size=0.33, random_state=42)
19 |
20 | # model
21 | model = DecisionTreeClassifier(**model_params)
22 | model.fit(X_train, y_train)
23 |
24 | # pred
25 | y_test_pred = model.predict(X_test)
26 |
27 | # eval
28 | acc_test = accuracy_score(y_test, y_test_pred)
29 |
30 | print(f'acc_test: {acc_test}')
31 | print(f'end at {time.ctime()}')
32 |
33 |
34 | if __name__ == '__main__':
35 | main()
36 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 fkubota
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/enjoy/005_20210731/live_coding/zoo.py:
--------------------------------------------------------------------------------
1 | import animals as a
2 | import keeper as k
3 |
4 | dict_animals = {
5 | 'classes': [k.keeper, a.dog, a.cat],
6 | 'names': ['taro', 'pochi', 'mike']
7 | }
8 |
9 |
10 | def feed_time(animals):
11 | keeper = animals[0]
12 | keeper.feed(animals[1])
13 | keeper.feed(animals[1])
14 | keeper.feed(animals[1])
15 | keeper.feed(animals[1])
16 | keeper.feed(animals[1])
17 | keeper.feed(animals[1])
18 | keeper.feed(animals[1])
19 | keeper.feed(animals[1])
20 | keeper.feed(animals[1])
21 | keeper.feed(animals[1])
22 | keeper.feed(animals[1])
23 | keeper.feed(animals[2])
24 | keeper.feed(animals[2])
25 |
26 |
27 | def bark_party(animals):
28 | for animal in animals:
29 | animal.bark()
30 |
31 |
32 | def main():
33 | print('this is zoo')
34 |
35 | animals = []
36 | for class_, name in zip(dict_animals['classes'], dict_animals['names']):
37 | animals.append(class_(name))
38 |
39 | # esaやり
40 | feed_time(animals)
41 |
42 | # party
43 | bark_party(animals)
44 |
45 |
46 | if __name__ == '__main__':
47 | main()
48 |
--------------------------------------------------------------------------------
/enjoy/004_20210421/live_coding/iris.py:
--------------------------------------------------------------------------------
1 | import yaml
2 | from ipdb import set_trace as st
3 | import numpy as np
4 | import pandas as pd
5 | from sklearn.metrics import accuracy_score
6 | from sklearn.tree import DecisionTreeClassifier
7 | from sklearn.datasets import load_iris
8 | from sklearn.model_selection import train_test_split
9 |
10 |
11 | def get_datasets():
12 | iris = load_iris()
13 | data = iris.data
14 | target = iris.target
15 | feature_names = iris.feature_names
16 |
17 | df = pd.DataFrame(data, columns=feature_names)
18 |
19 | return df, target
20 |
21 |
22 | def get_config():
23 | with open('config.yml') as file:
24 | config = yaml.safe_load(file)
25 | return config
26 |
27 |
28 | def main():
29 | print('hello vim')
30 | config = get_config()
31 | seed = config['globals']['seed']
32 | test_size = config['globals']['test_size']
33 | df, target = get_datasets()
34 |
35 | # train test split
36 | X_train, X_test, y_train, y_test = train_test_split(
37 | df, target, test_size=test_size, random_state=seed)
38 | # model
39 | model = DecisionTreeClassifier(random_state=seed)
40 | model.fit(X_train, y_train)
41 |
42 | # eval
43 | y_test_pred = model.predict(X_test)
44 | acc = accuracy_score(y_test, y_test_pred)
45 |
46 | print(f'accuracy_test: {acc:.4f}')
47 |
48 |
49 | if __name__ == '__main__':
50 | main()
51 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # enjoy-Vim
4 | 初心者向けvimmer勉強会用リポジトリ。
5 | 参加者はスター押してくれるとうれしいな!!!
6 | 初心者4人、経験者1~2人程度の初心者中心の会。
7 | twitterのハッシュタグは [\#enjoy_vim](https://twitter.com/search?q=enjoy_vim&src=typed_query&f=live) でやってもらえると嬉しい。
8 |
9 | ↓ 問題例
10 |
11 |
12 |
13 |
14 |
15 | ## やりたいこと
16 | - 初心者と経験者をつなげたい
17 | - 初心者が恥ずかしいと思わず気軽に質問できる雰囲気づくり
18 | - vimの可能性、伸びしろを感じる
19 | - プラグインは使わず、vim本来の力を学ぶ
20 |
21 | ## 参加対象者イメージ
22 | - vim 使い方わかるけど、惰性でやってる(矢印キー連打、バックスペース連打)のをやめたい
23 | - vimを普段使いにできるレベルになったら使いたいけどなかなかそんな日が訪れない
24 | - vim 興味あるけど一人じゃ続かない!!
25 |
26 | ## Must
27 | - [vimtutor](https://www.superusers.jp/su-camp-door/003.html)を3回ぐらいやった経験。 <--すぐ終わります
28 |
29 | ## やらないこと
30 | - マウント
31 | - vim教への勧誘
32 | - イケイケvimプラグインの説明
33 | - vimrc輪読会
34 |
35 |
36 | ## 勉強会の中身
37 | 1.5~2h 程度を想定
38 |
39 | 1. 問題演習1
40 | 1. 簡単な問題を全員の前で解いてもらう(これが恥ずかしくない雰囲気を絶対作る。間違えて当たり前。)
41 | - 例: [e02_valid.py](https://github.com/fkubota/enjoy-Vim/blob/main/enjoy/001_20210224/e02_valid.py)
42 | 1. 他の参加者からアドバイスや質問(ワイワイやる)
43 | 1. 経験者からのアドバイス(ワイワイやる)
44 | 1. 1~3を数問やる
45 |
46 | 2. ライブコーディング(10~20min程度)
47 | - 経験者が実際に作業してる風景を眺めます
48 | - 質疑応答いつでもOK
49 | - vimの可能性を感じてもらう
50 | 3. 問題演習2
51 | - 問題演習1と同様
52 | 4. 時間が余れば適当に潰す
53 |
54 |
55 | ## おすすめ書籍
56 | 僕はこの本でしか勉強してないです。
57 | **実践vim**
58 |
59 |
60 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 | *.swp
6 |
7 | # C extensions
8 | *.so
9 |
10 | # Distribution / packaging
11 | .Python
12 | build/
13 | develop-eggs/
14 | dist/
15 | downloads/
16 | eggs/
17 | .eggs/
18 | lib/
19 | lib64/
20 | parts/
21 | sdist/
22 | var/
23 | wheels/
24 | pip-wheel-metadata/
25 | share/python-wheels/
26 | *.egg-info/
27 | .installed.cfg
28 | *.egg
29 | MANIFEST
30 |
31 | # PyInstaller
32 | # Usually these files are written by a python script from a template
33 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
34 | *.manifest
35 | *.spec
36 |
37 | # Installer logs
38 | pip-log.txt
39 | pip-delete-this-directory.txt
40 |
41 | # Unit test / coverage reports
42 | htmlcov/
43 | .tox/
44 | .nox/
45 | .coverage
46 | .coverage.*
47 | .cache
48 | nosetests.xml
49 | coverage.xml
50 | *.cover
51 | *.py,cover
52 | .hypothesis/
53 | .pytest_cache/
54 |
55 | # Translations
56 | *.mo
57 | *.pot
58 |
59 | # Django stuff:
60 | *.log
61 | local_settings.py
62 | db.sqlite3
63 | db.sqlite3-journal
64 |
65 | # Flask stuff:
66 | instance/
67 | .webassets-cache
68 |
69 | # Scrapy stuff:
70 | .scrapy
71 |
72 | # Sphinx documentation
73 | docs/_build/
74 |
75 | # PyBuilder
76 | target/
77 |
78 | # Jupyter Notebook
79 | .ipynb_checkpoints
80 |
81 | # IPython
82 | profile_default/
83 | ipython_config.py
84 |
85 | # pyenv
86 | .python-version
87 |
88 | # pipenv
89 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
90 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
91 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
92 | # install all needed dependencies.
93 | #Pipfile.lock
94 |
95 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
96 | __pypackages__/
97 |
98 | # Celery stuff
99 | celerybeat-schedule
100 | celerybeat.pid
101 |
102 | # SageMath parsed files
103 | *.sage.py
104 |
105 | # Environments
106 | .env
107 | .venv
108 | env/
109 | venv/
110 | ENV/
111 | env.bak/
112 | venv.bak/
113 |
114 | # Spyder project settings
115 | .spyderproject
116 | .spyproject
117 |
118 | # Rope project settings
119 | .ropeproject
120 |
121 | # mkdocs documentation
122 | /site
123 |
124 | # mypy
125 | .mypy_cache/
126 | .dmypy.json
127 | dmypy.json
128 |
129 | # Pyre type checker
130 | .pyre/
131 |
--------------------------------------------------------------------------------