-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dev] sample and save exported data to npz, better progress
- Loading branch information
1 parent
b24f363
commit 2fb0c1e
Showing
6 changed files
with
190 additions
and
74 deletions.
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
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,24 +1,45 @@ | ||
cell: | ||
r: | ||
init: 0.00000003 | ||
max: 0.00000032 | ||
min: 0.0000001 | ||
step: 0.00000003 | ||
hudu: | ||
init: 0.001 | ||
max: 180 | ||
min: 5 | ||
step: 20 | ||
zeta: | ||
init: 0.0005 | ||
init: 0.001 | ||
max: 180 | ||
min: 0 | ||
step: 30 | ||
rr: | ||
step: 20 | ||
g: | ||
init: 0.001 | ||
max: 0.0045 | ||
min: 0.0035 | ||
step: 0.0005 | ||
rrr: | ||
max: 0.0000006 | ||
min: 0.0000001 | ||
step: 0.0000001 | ||
rr: | ||
init: 0.001 | ||
max: 0.003 | ||
min: 0.001 | ||
step: 0.001 | ||
max: 0.00000003 | ||
min: 0.000000005 | ||
step: 0.000000005 | ||
|
||
export: | ||
# 导出的目录 | ||
dir: "exports/0" | ||
# 哪些导出关键字要进行采样压缩,只要含有关键字的导出标签都会被计算,请写成列表形式,注意 - 和 " 之间有空格 | ||
sample_keys: | ||
- "flied" | ||
# - "bd" | ||
# - "export_foo" | ||
# - "..." | ||
|
||
train: | ||
epoch: 200 | ||
epoch: 500 | ||
batch_size: 16 | ||
lr: 0.001 | ||
lr: 0.0001 | ||
early_stop: 30 | ||
|
||
dataset: | ||
sampler: four_points # six_points, four_points | ||
sampler: six_points # six_points, four_points |
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,33 @@ | ||
from pathlib import Path | ||
|
||
import numpy as np | ||
import pandas as pd | ||
|
||
|
||
def sample_cood(csv_path: Path, frac: float = 0.1): | ||
# 读取整个文件 | ||
with open(csv_path, "r", encoding="utf-8") as f: | ||
lines = f.readlines() | ||
|
||
# 找到最后一个以%开头的行 | ||
last_comment_line = 0 | ||
for i, line in enumerate(lines): | ||
if line.startswith("%"): | ||
last_comment_line = i | ||
df = pd.read_csv( | ||
csv_path, | ||
skiprows=last_comment_line + 1, | ||
header=None, | ||
names=lines[last_comment_line].strip("%\n").split(","), | ||
) | ||
df = df.sample(frac=0.1) | ||
|
||
arr = df.values | ||
return arr | ||
|
||
|
||
def compress_save(arr: np.ndarray, save_path: Path): | ||
np.savez_compressed(save_path, arr) | ||
|
||
|
||
def grid_avg(csv_path: Path): ... |
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