paddlets.models.anomaly.dl.vae
- class stack(in_chunk_dim: int, hidden_config: ~typing.List[int], feature_dim: int, is_encoder: bool = True, base_nn: str = 'MLP', use_bn: bool = True, use_drop: bool = True, dropout_rate: float = 0.5, kernel_size: int = 1, rnn_num_layers: int = 1, direction: str = 'forward', activation: ~typing.Callable[[...], ~paddle.Tensor] = <class 'paddle.nn.layer.activation.ReLU6'>, last_layer_activation: ~typing.Callable[[...], ~paddle.Tensor] = <class 'paddle.nn.layer.activation.ReLU6'>)[源代码]
基类:
Layer堆积网络架构。
- 参数
in_chunk_dim (int) – 模型输入的时间序列长度。
hidden_config (List[int]) – 第i个元素表示第i个隐藏层神经元的数量。
feature_dim (int) – 特征数量。
is_encoder (bool) – 编码层或者解码层。
base_nn (str) – 用于堆积的基础网络。
use_bn (bool) – 是否使用批次归一化。
use_drop (bool) – 是否使用dropout。
dropout_rate (float) – 元素为0的概率。
kernel_size (int) – 卷积核大小。
rnn_num_layers (int) – 递归网络层数量。
direction (str) – 如果为True,则为双向LSTM网络,默认为:False。
activation (Callable[..., paddle.Tensor]) – 隐藏层网络的激活函数。
last_layer_activation (Callable[..., paddle.Tensor]) – 最后一层网络的激活函数。
- _nn
动态网络图层结构。
- 类型
paddle.nn.Sequential
- class VAE(in_chunk_len: int, sampling_stride: int = 1, loss_fn: ~typing.Callable[[...], ~paddle.Tensor] = <function smooth_l1_loss_vae>, optimizer_fn: ~typing.Callable[[...], ~paddle.optimizer.optimizer.Optimizer] = <class 'paddle.optimizer.adam.Adam'>, threshold_fn: ~typing.Callable[[...], float] = <function percentile>, threshold: ~typing.Optional[float] = None, threshold_coeff: float = 1.0, anomaly_score_fn: ~typing.Optional[~typing.Callable[[...], ~typing.List[float]]] = None, pred_adjust: bool = False, pred_adjust_fn: ~typing.Callable[[...], ~numpy.ndarray] = <function result_adjust>, optimizer_params: ~typing.Dict[str, ~typing.Any] = {'learning_rate': 0.0001}, eval_metrics: ~typing.List[str] = [], callbacks: ~typing.List[~paddlets.models.common.callbacks.callbacks.Callback] = [], batch_size: int = 32, max_epochs: int = 100, verbose: int = 1, patience: int = 10, seed: ~typing.Union[None, int] = None, hidden_config: ~typing.List[int] = [32, 16], base_en: str = 'MLP', base_de: str = 'MLP', use_bn: bool = True, use_drop: bool = True, dropout_rate: float = 0.5, kernel_size: int = 1, rnn_num_layers: int = 1, direction: str = 'forward', activation: ~typing.Callable[[...], ~paddle.Tensor] = <class 'paddle.nn.layer.activation.ReLU6'>, last_layer_activation: ~typing.Callable[[...], ~paddle.Tensor] = <class 'paddle.nn.layer.activation.ReLU6'>, stdev: float = 0.1)[源代码]
-
异常检测VAE网络模型。
- 参数
in_chunk_len (int) – 模型输入的时间序列长度。
sampling_stride (int) – 两个相邻样本之间的数据采集间隔。
loss_fn (Callable[..., paddle.Tensor]) – 损失函数。
optimizer_fn (Callable[..., Optimizer]) – 优化算法。
threshold_fn (Callable[..., float]|None) – 计算阈值点的方法。
threshold_coeff (float) – 阈值系数。
threshold (float|None) – 阈值,用于判别是否异常。
anomaly_score_fn (Callable[..., List[float]]|None) – 计算异常分数的方法。
pred_adjust (bool) – 是否根据实际标签调整预测结果。
pred_adjust_fn (Callable[..., np.ndarray]|None) – 调整预测结果的方法。
optimizer_params (Dict[str, Any]) – 优化器参数。
eval_metrics (List[str]) – 模型评估指标。
callbacks (List[Callback]) – 自定义回调函数。
batch_size (int) – 每个批次的样本数量。
max_epochs (int) – 训练过程中的最大迭代次数。
verbose (int) – 详细模式。
patience (int) – 模型训练过程中, 当评估指标超过一定轮数不再变优,模型提前停止训练。
seed (int|None) – 全局随机数种子, 注: 保证每次模型参数初始化一致。
hidden_config (List[int]|None) – 第i个元素表示第i个隐藏层神经元的数量。
base_en (str) – 编解码器的类型。
base_de (str) – 解码器的类型。
use_bn – 是否使用批次归一化。
use_drop – 是否使用dropout。
dropout_rate (float) – 元素为0的概率。
kernel_size (int) – 卷积核大小。
rnn_num_layers (int) – 递归网络层数量。
direction (str) – 如果为True,则为双向LSTM网络,默认为:False。
activation (Callable[..., paddle.Tensor]) – 隐藏层网络的激活函数。
last_layer_activation (Callable[..., paddle.Tensor]) – 最后一层网络的激活函数。
stdev (int) – 参数分布。
- _in_chunk_len
模型输入的时间序列长度。
- 类型
int
- _sampling_stride
两个相邻样本之间的数据采集间隔。
- 类型
int
- _loss_fn
损失函数。
- 类型
Callable[…, paddle.Tensor]
- _optimizer_fn
优化算法。
- 类型
Callable[…, Optimizer]
- _threshold_fn
计算阈值点的方法。
- 类型
Callable[…, float]|None
- _threshold_coeff
阈值系数。
- 类型
float
- _threshold
阈值,用于判别是否异常。
- 类型
float|None
- _anomaly_score_fn
计算异常分数的方法。
- 类型
Callable[…, List[float]]|None
- _pred_adjust
是否根据实际标签调整预测结果。
- 类型
bool
- _pred_adjust_fn
调整预测结果的方法。
- 类型
Callable[…, np.ndarray]|None
- _optimizer_params
优化器参数。
- 类型
Dict[str, Any]
- _eval_metrics
模型评估指标。
- 类型
List[str]
- _batch_size
每个批次的样本数量。
- 类型
int
- _max_epochs
训练过程中的最大迭代次数。
- 类型
int
- _verbose
详细模式。
- 类型
int
- _patience
模型训练过程中, 当评估指标超过一定轮数不再变优,模型提前停止训练。
- 类型
int
- _seed
全局随机数种子, 注: 保证每次模型参数初始化一致。
- 类型
int|None
- _stop_training
Training status.
- 类型
bool
第i个元素表示第i个隐藏层神经元的数量。
- 类型
List[int]|None
- _base_en
编解码器的类型。
- 类型
str
- _base_de
解码器的类型。
- 类型
str
- _use_bn
是否使用批次归一化。
- 类型
bool
- _use_drop
是否使用dropout。
- 类型
bool
- _dropout_rate
元素为0的概率。
- 类型
float
- _kernel_size
卷积核大小。
- 类型
int
- _rnn_num_layers
递归网络层数量。
- 类型
int
- _direction
如果为True,则为双向LSTM网络,默认为:False。
- 类型
str
- _activation
隐藏层网络的激活函数。
- 类型
Callable[…, paddle.Tensor]
- _last_layer_activation
最后一层网络的激活函数。
- 类型
Callable[…, paddle.Tensor]
- _stdev
参数分布。
- 类型
int