Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/LeMo-CtRes/CtRes
/ functions
Functions
89 in github.com/LeMo-CtRes/CtRes
⨍
Functions
89
◇
Types & classes
6
↓ 7 callers
Function
configure_reproducibility
(seed: int)
ctres.py:40
↓ 7 callers
Method
fit
( self, x_irregular: np.ndarray, timestamps: np.ndarray, y: np.ndarray,
ctres.py:245
↓ 6 callers
Function
_get_first
(data: np.lib.npyio.NpzFile, names: Sequence[str])
run.py:64
↓ 6 callers
Function
_validate_irregular_inputs
(x_irregular: np.ndarray, timestamps: np.ndarray)
ctres.py:100
↓ 5 callers
Function
_rotate_2d
(emb: np.ndarray, theta: float)
utils/utils_tsne.py:176
↓ 5 callers
Method
extract_features
(self, x_irregular: np.ndarray, timestamps: np.ndarray)
ctres.py:195
↓ 4 callers
Function
_fisher_score_1d
(x: np.ndarray, y: np.ndarray)
utils/utils_tsne.py:159
↓ 4 callers
Function
_validate_inputs
(x: np.ndarray, y: np.ndarray)
ctres.py:88
↓ 2 callers
Function
_as_float3
(name: str, value: np.ndarray)
run.py:73
↓ 2 callers
Function
_as_int2
(name: str, value: np.ndarray)
run.py:80
↓ 2 callers
Function
_as_labels
(name: str, value: np.ndarray)
run.py:87
↓ 2 callers
Function
_canonicalize_pair
( emb_train: np.ndarray, emb_test: np.ndarray, labels_train: np.ndarray, )
utils/utils_tsne.py:181
↓ 2 callers
Function
compute_hermite_coeffs_multiprocess
多进程计算Hermite系数 Args: x_norm: numpy array [N, T, D] num_workers: 进程数,None表示自动选择 chunk_size: 每个进程一次处理的样本数
utils/utils_speed.py:49
↓ 2 callers
Function
compute_hermite_coeffs_ultra_safe_v2
改进的安全顺序计算,支持断点续算
utils/utils_speed.py:225
↓ 2 callers
Method
extract_features_from_coeffs
( self, coeffs: np.ndarray, x_irregular: np.ndarray, timestamps: np.ndarray,
ctres.py:207
↓ 2 callers
Method
fit_from_features
( self, features: np.ndarray, y: np.ndarray, *, test_size: float = 0.2
ctres.py:276
↓ 2 callers
Function
load_split_npz
(npz_path: Path)
run.py:94
↓ 2 callers
Function
normalize_per_sample_observed
(x_irregular: np.ndarray)
ctres.py:47
↓ 2 callers
Function
params_for_task
(task_code: str)
utils/utils_tsne.py:73
↓ 2 callers
Function
plot_best_1x5
( task_plot_data: dict[str, dict[str, np.ndarray]], *, show: bool = True, save_path: Optional[
utils/utils_tsne.py:380
↓ 2 callers
Function
plot_single_task_tsne
( x_train: np.ndarray, y_train: np.ndarray, x_test: np.ndarray, y_test: np.ndarray, *,
utils/utils_tsne.py:408
↓ 2 callers
Function
run
( npz_path: Optional[Path] = None, *, task_code: str | None = None, dataset_dir: Path = WIND_T
run.py:147
↓ 2 callers
Function
standardize
(z: np.ndarray)
utils/utils_tsne.py:258
↓ 1 callers
Method
__init__
(self, config: Optional[CtResConfig] = None)
ctres.py:189
↓ 1 callers
Function
_batch_extract_readout_weights
( coeffs_batch: torch.Tensor, x_miss_batch: torch.Tensor, ts_batch: torch.LongTensor, W_in: to
ctres.py:152
↓ 1 callers
Function
_build_reservoir_weights
(input_dim: int, config: CtResConfig)
ctres.py:125
↓ 1 callers
Function
_compute_tsne
( x: np.ndarray, *, seed: int, perplexity: float, learning_rate: float, early_exaggera
utils/utils_tsne.py:87
↓ 1 callers
Function
_enhance_class_separation_linear
( emb_train: np.ndarray, emb_test: np.ndarray, labels_train: np.ndarray, strength: float, )
utils/utils_tsne.py:222
↓ 1 callers
Function
_find_valid_pairs
(ts_batch: torch.LongTensor, n_forget_points: int)
ctres.py:136
↓ 1 callers
Function
_get_class_colors
(labels: np.ndarray)
utils/utils_tsne.py:282
↓ 1 callers
Function
_optimize_rotation_2d
( emb_train: np.ndarray, emb_test: np.ndarray, labels_train: np.ndarray, steps: int, )
utils/utils_tsne.py:199
↓ 1 callers
Function
_plot_task_panel
(fig, subplot_spec, task_code: str, labels: np.ndarray, emb_final: np.ndarray)
utils/utils_tsne.py:286
↓ 1 callers
Function
_prepare_scaled_pca
( x_train: np.ndarray, x_test: np.ndarray, *, seed: int, pca_cap: int = 60, )
utils/utils_tsne.py:121
↓ 1 callers
Function
_validate_coeffs_inputs
(coeffs: np.ndarray, x_irregular: np.ndarray)
ctres.py:114
↓ 1 callers
Function
build_config
( *, batch_size: int | None = None, num_workers: int | None = None, device: str | None = None,
run.py:37
↓ 1 callers
Function
compute_hermite_coeffs_chunked_multiprocess
分块多进程计算Hermite系数 - 更保守的内存管理策略 Args: x_norm: numpy array [N, T, D] num_workers: 进程数 chunk_size: 每块的样本数 ve
utils/utils_speed.py:124
↓ 1 callers
Function
compute_hermite_coeffs_robust
鲁棒的Hermite系数计算 - 自动选择最佳策略 Args: x_norm: numpy array [N, T, D] strategy: 'auto', 'multiprocess', 'chunked', 'sequential'
utils/utils_speed.py:177
↓ 1 callers
Function
find_continue_idx
ts: 1D 张量,长度 M, 是“非 NaN”点对应的原始时间戳(已升序,无重复)。 nForgetPoints: wash-out 个数。 返回 origin_idx, target_idx: - origin_idx 中的 i 表示:第 i 个 ts 点
utils/utils_ode.py:159
↓ 1 callers
Function
load_wind_turbine_task
( task_code: str, dataset_dir: Path = WIND_TURBINE_DATASET_DIR, )
run.py:133
↓ 1 callers
Function
main
()
run.py:291
↓ 1 callers
Function
parse_args
()
run.py:268
↓ 1 callers
Function
run_selected_wind_turbine_tasks
( *, task_codes: Sequence[str] = VALID_TASKS, dataset_dir: Path = WIND_TURBINE_DATASET_DIR, ba
run.py:227
↓ 1 callers
Function
run_tsne_from_features
( x_train: np.ndarray, x_test: np.ndarray, params: TsnePlotParams, *, seed: int = SEED,
utils/utils_tsne.py:136
↓ 1 callers
Function
seed_everything
(seed)
utils/utils_data.py:21
↓ 1 callers
Method
set_spline
(self, spline: torchcde.CubicSpline)
ctres.py:79
↓ 1 callers
Method
set_spline
(self, cubic_spline)
utils/utils_speed.py:300
↓ 1 callers
Method
set_weights
(self, W_in: torch.Tensor, W_res: torch.Tensor)
ctres.py:75
↓ 1 callers
Method
set_weights
载入外部计算好的 numpy 权重
utils/utils_speed.py:295
Method
__init__
(self, input_dim: int, n_reservoir: int, leaky: float, activation=torch.tanh)
ctres.py:67
Method
__init__
(self, input_dim, n_reservoir, leaky, activation=torch.tanh)
utils/utils_speed.py:282
Function
_worker_run_ode
args: (coeff_np, x_miss_np, ts_np, W_in_np, W_res_np, leaky, method, rtol, atol, alpha) 返回: W_out_np, shape [n_reservoir, input_
utils/utils_speed.py:309
Function
batch_find_continue_idx
返回 origin_idx_mat, target_idx_mat, mask_mat - origin_idx_mat, target_idx_mat: [bs, L_max],存的是在 ts 维度上的 idx - mask_mat: [bs, L_max],Tr
utils/utils_data.py:158
Function
compute_single_hermite
单个样本的Hermite系数计算 - 进程池worker函数 Args: args: (sample_data, sample_idx) sample_data: numpy array [T, D]
utils/utils_speed.py:16
Function
evaluate_classifiers_and_tsne_from_npz
从 .npz 文件中读取 W_all、y_all、Ntr, 分别用 RandomForest、SVM、KNN 三种分类器做分类并输出评估结果到 CSV, 并对全部样本做 t-SNE 降维,绘制 2D 散点图保存为 PNG。 参数: npz_path
utils/utils_ode.py:262
Function
evaluate_classifiers_and_tsne_from_npz
Enhanced version with spectral_radius parameter for better file organization
utils/utils_data.py:303
Function
evaluate_feature
(x_train, y_train, x_test, y_test)
utils/utils_ode.py:643
Function
evaluate_feature
(x_train, y_train, x_test, y_test)
utils/utils_data.py:655
Function
find_continue_idx
ts: 1D 张量,长度 M,ts 中存的是原始整数时间戳 (0,1,2,…); nForgetPoints: wash-out 个数。 返回 origin_idx: - origin_idx 中的 i 表示用 Z[i] 做回归; - origin
utils/utils_data.py:140
Method
fit_from_coeffs
( self, coeffs: np.ndarray, x_irregular: np.ndarray, timestamps: np.ndarray,
ctres.py:260
Method
fit_with_split
( self, x_train_irregular: np.ndarray, ts_train: np.ndarray, y_train: np.ndarr
ctres.py:329
Method
forward
(self, t: torch.Tensor, z: torch.Tensor)
ctres.py:82
Method
forward
(self, t, z)
utils/utils_speed.py:303
Function
get_data
(dataset)
utils/utils_ode.py:91
Function
get_data
(dataset)
utils/utils_data.py:73
Function
get_data_mat
(data_path, input_scaling=1)
utils/utils_ode.py:113
Function
get_data_mat
(data_path, input_scaling=1)
utils/utils_data.py:95
Function
normalize
对数据进行 Z-score 归一化 参数: data: 张量,形状为 [num_of_data, time_len, input_size] 返回: 归一化后的数据
utils/utils_ode.py:57
Function
normalize
对数据进行 Z-score 归一化 参数: data: 张量,形状为 [num_of_data, time_len, input_size] 返回: 归一化后的数据
utils/utils_data.py:39
Function
normalize_meanmax
使用最大值进行归一化: (data - mean) / max_abs_val 参数: data: 张量,形状为 [num_of_data, time_len, input_size] 返回: 归一化后的数据
utils/utils_ode.py:41
Function
plot_complete_overview
创建完整的总览图
utils/utils_ode.py:565
Function
plot_complete_overview
创建完整的总览图
utils/utils_data.py:577
Function
plot_from_csv_new
(csv_path, rpm_name, smooth_window=5)
utils/utils_ode.py:350
Function
plot_loss_accuracy
(file_path='loss.txt')
utils/utils_ode.py:605
Function
plot_loss_accuracy
(file_path='loss.txt')
utils/utils_data.py:616
Function
plot_retain_rate_comparison
绘制不同retain_rate的对比图
utils/utils_ode.py:535
Function
plot_retain_rate_comparison
绘制不同retain_rate的对比图
utils/utils_data.py:475
Function
plot_spectral_radius_comparison
绘制单个数据集、单个retain_rate下不同spectral_radius的性能对比
utils/utils_data.py:401
Function
plot_sr
(results, file_name="rho_vs_acc.png", dir_path=str)
utils/utils_ode.py:442
Function
plot_sr
(results, file_name="rho_vs_acc.png", dir_path=str)
utils/utils_data.py:279
Function
plot_sr_plus
绘制增强的结果图,包含多个指标: 1. 准确率(训练 & 测试) 2. 精确率 & F1 分数 3. 平均 ODE 积分时间 4. 分类器拟合 & 预测时间
utils/utils_ode.py:468
Function
run_neuralESN_parallel
Inputs: - W_in_np: numpy [D_in, R] - W_res_np: numpy [R, R] - coeffs: numpy array [N, T, D_in, C] - x_miss:
utils/utils_speed.py:369
Function
sample_data_with_nans
对时间序列数据进行随机缺失采样,使用NaNs填充缺失部分,保留原始张量形状。 参数: data : torch.Tensor 时间序列数据,维度为 [series_num, length, dim]。 retain_
utils/utils_ode.py:184
Function
sample_data_with_nans
对时间序列数据进行随机缺失采样,使用NaNs填充缺失部分,保留原始张量形状。 参数: data : torch.Tensor 时间序列数据,维度为 [series_num, length, dim]。 retain_rate
utils/utils_data.py:200
Function
save_results_to_csv
将所有结果保存到CSV文件
utils/utils_data.py:526
Function
save_results_to_csv_whu
将所有结果保存到CSV文件
utils/utils_data.py:552
Function
scipy_cubicspline
使用 scipy 的 CubicSpline 对 sampled_data 进行插值,返回 time_stamp 上的插值结果。 Parameters: - sampled_data (Tensor): 输入的采样数据,形状为 [batch, sampled_len, i
utils/utils_ode.py:654
Function
scipy_cubicspline
使用 scipy 的 CubicSpline 对 sampled_data 进行插值,返回 time_stamp 上的插值结果。 Parameters: - sampled_data (Tensor): 输入的采样数据,形状为 [batch, sampled_len, i
utils/utils_data.py:665
Function
seed_everything
(seed)
utils/utils_ode.py:23
Method
tsne_embedding
(self, features: Optional[np.ndarray] = None, random_state: Optional[int] = None)
ctres.py:373