-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from sakasa/master
Update
- Loading branch information
Showing
6 changed files
with
152 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# 乱数シード値の固定 | ||
参考:https://qiita.com/sugulu/items/c0e8a5e6b177bfe05e99 | ||
```python | ||
import os | ||
import random | ||
import numpy as np | ||
import torch | ||
|
||
SEED_VALUE = 1234 # これはなんでも良い | ||
os.environ['PYTHONHASHSEED'] = str(SEED_VALUE) | ||
random.seed(SEED_VALUE) | ||
np.random.seed(SEED_VALUE) | ||
torch.manual_seed(SEED_VALUE) # PyTorchを使う場合 | ||
|
||
# PyTorchでGPUを使用する場合 | ||
torch.backends.cudnn.deterministic = True | ||
torch.backends.cudnn.benchmark = False | ||
``` | ||
- scikit-learnの場合は各アルゴリズムで乱数シードを受けつる部分もある | ||
```python | ||
from sklearn.linear_model import LogisticRegression | ||
|
||
SEED_VALUE = 1234 # これはなんでも良い | ||
clf = LogisticRegression(random_state=SEED_VALUE) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,20 @@ | ||
## 改行なしで `print` する | ||
# 改行なしで `print` する | ||
```python | ||
print("HOGE", end="") | ||
``` | ||
|
||
# 関数の型ヒント | ||
```python | ||
def func(x: int, y: str) -> str: | ||
""" | ||
Parameters | ||
---------- | ||
x : int | ||
y : str | ||
Returns | ||
------- | ||
z : str | ||
""" | ||
``` | ||
※ヒントなの実際の型が異なっていてもエラーにならない |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# メール配信テスト | ||
|
||
## mailcatcher | ||
- https://mailcatcher.me/ | ||
- ローカルでメール配信テストをする際にメールサーバの設定をmailcatcherにして、メールの確認を行える | ||
|
||
### インストール | ||
```bash | ||
gem install mailcatcher | ||
``` | ||
|
||
### 起動 | ||
```bash | ||
mailmatcher [--ip 0.0.0.0] [-f] | ||
``` | ||
オプションは任意 | ||
|
||
### メール設定 | ||
メールサーバを `localhost` にして、ポートを `1025` (ユーザー、パスワードはなしでOK) | ||
|
||
### メール確認 | ||
ブラウザで `http://localhost:1080` にアクセス | ||
|
||
※メール設定、メール確認のポートは起動オプションで変更可能 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
## ページ内の文字列を指定してアンカーにする | ||
https://www.suzukikenichi.com/blog/chrome-directly-scrolls-to-text-fragments-on-a-page-and-highlights-the-text/ | ||
- `#:~:text={文字列}` をURL末尾に付与 | ||
- ex. https://example.com#:~:text=見出し1 |