MCPcopy Create free account

hub / github.com/NewT123-WM/tnlearn / functions

Functions330 in github.com/NewT123-WM/tnlearn

↓ 53 callersMethodfit
Train the RL agent to discover the best vectorized symbolic expression. Parameters ---------- X : np.ndarray, shape
tnlearn/rl_regressor.py:289
↓ 44 callersMethodscore
(self)
tnlearn/drsr/buffer.py:71
↓ 29 callersMethodpredict
r"""Use a trained model to make predictions. Args: X (torch.Tensor): Data that needs to be predicted. Returns:
tnlearn/mlpregressor.py:290
↓ 18 callersMethodfit_transform
r"""Fit to data, then transform it. Args: X (array-like of shape (n_samples, n_features)): Input samples. y (array-li
tnlearn/preprocessing.py:55
↓ 8 callersMethodload
r"""Load a model from the specified path with the given filename. Args: path: The location of the trained model. file
tnlearn/base.py:63
↓ 7 callersMethod__init__
(self, in_channels, out_channels, kernel_size, stride=1, padding=0, symbolic_expression='x',
tnlearn/modules/TNconv.py:193
↓ 7 callersMethod__init__
(self, input_size: int, hidden_size: int, num_layers: int = 1, nonlinearity: str = 'tanh', bi
tnlearn/modules/TNrnn.py:251
↓ 7 callersFunctionrandom_seed
r"""Set the random seed for reproducibility of experiments. Args: seed: Random seed.
tnlearn/seeds.py:21
↓ 6 callersFunctiontest_save_load
Test model saving and loading. Args: model: The model to test. input_args: Input tensor(s) to pass to forward. hx_ar
tests/test_tnrnn.py:22
↓ 6 callersMethodupdate
r"""Update the plots for loss and accuracy across epochs. Args: epoch: Epochs during training. loss: Loss value durin
tnlearn/visualize.py:150
↓ 5 callersMethod__init__
初始化 LLM 客户端。 :param api_key: API 密钥 :param model: 模型名称 :param base_url: API 的基础 URL :param verbose: 控制输出详细程度
tnlearn/drsr/llm.py:53
↓ 5 callersMethod_ntuple
(self, n)
tnlearn/modules/TNconv.py:325
↓ 5 callersFunctiontest_model_save_load
Generic save-load test. Args: model: The model to test. args: Positional arguments to pass to forward. kwargs: Keyw
tests/test_tntransformer.py:25
↓ 4 callersMethod__init__
( self, d_model: int = 512, nhead: int = 8, num_encoder_layers
tnlearn/modules/TNtransformer.py:596
↓ 4 callersMethod_make_layer
make resnet layers(by layer i didnt mean this 'layer' was the same as a neuron netowork layer, ex. conv layer), one layer may contain
benchmark/image_benchmark_polyregressor/TC_Resnet.py:115
↓ 4 callersMethod_make_stage
(self, block, num, out_channels, stride)
benchmark/image_benchmark_polyregressor/TC_senet.py:151
↓ 4 callersMethod_ntuple
Return a function that converts input to a tuple of length n.
tnlearn/modules/TNconv.py:100
↓ 4 callersMethodbuild_model
r"""Constructs the neural network model based on the specified architecture. Args: input_dim: The input dimension of the network.
tnlearn/mlpregressor.py:144
↓ 4 callersFunctionsanitize_code_text
Clean up control characters in LLM output that would cause the Python parser to crash directly.
tnlearn/drsr/code_manipulation.py:37
↓ 4 callersMethodsave
r"""Save the current model to the specified path with the given filename. Args: path: The path where the model weights are saved.
tnlearn/base.py:49
↓ 4 callersMethodtransform
r"""Perform standardization by centering and scaling. Args: X ({array-like, sparse matrix} of shape (n_samples, n_features)): The
tnlearn/preprocessing.py:67
↓ 3 callersMethod_build_content
(self, programs: code_manipulation.Function)
tnlearn/drsr/profile.py:82
↓ 3 callersMethod_register_program_in_island
( self, program: str, island_id: int, scores_per_test: ScoresPerTest,
tnlearn/drsr/buffer.py:190
↓ 3 callersMethodanalyse
( self, sample: str, island_id: Optional[int], version_generated: Optional[int
tnlearn/drsr/evaluator.py:179
↓ 3 callersMethodselect_random_node
r"""Method to select a random node within a given tree structure. Args: selected: The selected node. parent: The pare
tnlearn/regressor.py:154
↓ 2 callersMethod__init__
(self, block, block_num, class_num=100)
benchmark/image_benchmark_polyregressor/TC_senet.py:116
↓ 2 callersMethod__init__
(self, block, nblocks, growth_rate=12, reduction=0.5, num_class=100)
benchmark/image_benchmark_polyregressor/TC_densenet.py:69
↓ 2 callersMethod__init__
(self, block, num_block, num_classes=100)
benchmark/image_benchmark_polyregressor/TC_Resnet.py:96
↓ 2 callersMethod_compute_iteration_index
(self, sample_order: int | None)
tnlearn/drsr/profile.py:75
↓ 2 callersFunction_detect_is_causal_mask
( mask: Optional[Tensor], is_causal: Optional[bool] = None, size: Optional[int] = None
tnlearn/modules/TNtransformer.py:70
↓ 2 callersMethod_eval_func
Safely evaluate a basis function on a 1D torch tensor. Returns a numpy array of shape (n_samples,).
tnlearn/rl_regressor.py:160
↓ 2 callersMethod_ff_block
(self, x)
tnlearn/modules/TNtransformer.py:279
↓ 2 callersMethod_ff_block
(self, x)
tnlearn/modules/TNtransformer.py:386
↓ 2 callersFunction_generate_square_subsequent_mask
( sz: int, device: torch.device = torch.device(torch._C._get_default_device()), dtype:
tnlearn/modules/TNtransformer.py:35
↓ 2 callersFunction_get_activation_fn
(activation: str)
tnlearn/modules/TNtransformer.py:62
↓ 2 callersFunction_get_clones
(module, N)
tnlearn/modules/TNtransformer.py:58
↓ 2 callersFunction_get_seq_len
(src: Tensor, batch_first: bool)
tnlearn/modules/TNtransformer.py:46
↓ 2 callersMethod_make_dense_layers
(self, block, in_channels, nblocks)
benchmark/image_benchmark_polyregressor/TC_densenet.py:114
↓ 2 callersMethod_mha_block
(self, x, mem, attn_mask, key_padding_mask, is_causal)
tnlearn/modules/TNtransformer.py:378
↓ 2 callersFunction_parse_expression
Parses a symbolic expression and returns a list of callable basis functions. The expression is split at the top‑level '+' and '-' operators
tnlearn/modules/TNrnn.py:40
↓ 2 callersFunction_reduce_score
(scores_per_test: ScoresPerTest)
tnlearn/drsr/buffer.py:48
↓ 2 callersMethod_sa_block
(self, x, attn_mask, key_padding_mask, is_causal)
tnlearn/modules/TNtransformer.py:271
↓ 2 callersMethod_sa_block
(self, x, attn_mask, key_padding_mask, is_causal)
tnlearn/modules/TNtransformer.py:370
↓ 2 callersMethod_save_best_history_sample
(self, programs: code_manipulation.Function, sample_orders: int)
tnlearn/drsr/profile.py:158
↓ 2 callersFunction_softmax
(logits: np.ndarray, temperature: float)
tnlearn/drsr/buffer.py:36
↓ 2 callersFunction_yield_token_and_is_call
Yield each token with a bool indicating whether it is a function call.
tnlearn/drsr/code_manipulation.py:217
↓ 2 callersMethodbuild_model
r"""Constructs the neural network model based on the specified architecture. Args: input_dim: The input dimension of the network.
tnlearn/mlpclassifier.py:147
↓ 2 callersMethodchat
(self, messages: List[Dict[str, str]])
tnlearn/drsr/llm.py:108
↓ 2 callersMethodevaluate
r"""Method to evaluate an expression using input data. Args: expr: Symbolic expression. x_data: Input data for evalua
tnlearn/regressor.py:107
↓ 2 callersMethodforward
(self, X)
tnlearn/poly_regressor.py:124
↓ 2 callersFunctionget_activation_function
r"""Get the corresponding PyTorch activation function by name. Args: name: A string name of the activation function. Returns:
tnlearn/activation_function.py:19
↓ 2 callersFunctionget_loss_function
r"""Get the corresponding PyTorch loss function by name. Args: name: A string name of the loss function. Returns: The corres
tnlearn/loss_function.py:19
↓ 2 callersMethodget_neuron_formula
(self)
tnlearn/drsr/agent.py:292
↓ 2 callersFunctionget_optimizer
r"""Get the corresponding PyTorch optimizer by name. Args: name: The name of the optimizer (e.g., 'adam', 'sgd'). parameters: The
tnlearn/optimizer.py:18
↓ 2 callersMethodget_prompt
(self)
tnlearn/drsr/buffer.py:110
↓ 2 callersMethodget_random_parent
r"""Method to select a random parent from a population based on fitness. Args: popu: Total population. fitne: Fitness
tnlearn/regressor.py:208
↓ 2 callersMethodget_significant_polynomial
(self)
tnlearn/poly_regressor.py:218
↓ 2 callersMethodparse
(x)
tnlearn/modules/TNconv.py:102
↓ 2 callersMethodrand_w
r"""Generate a random coefficient within a specified range.
tnlearn/regressor.py:132
↓ 2 callersMethodrandom_prog
r"""Method to generate a random program/tree structure. Returns: A symbol tree structure.
tnlearn/regressor.py:136
↓ 2 callersMethodregister_program
(self, program: str, scores_per_test: ScoresPerTest)
tnlearn/drsr/buffer.py:101
↓ 2 callersMethodsavefigure
r"""Update the plots for loss and accuracy across epochs. Args: loss: Loss value during training.
tnlearn/visualize.py:171
↓ 2 callersMethodsimp
r"""Method to simplify a tree-based expression into a string. Uses sympify and expand functions to simplify and convert the expression.
tnlearn/regressor.py:95
↓ 1 callersMethod__init__
(self, input_channels, n1x1, n3x3_reduce, n3x3, n5x5_reduce, n5x5, pool_proj)
benchmark/image_benchmark_polyregressor/TC_Googlenet.py:19
↓ 1 callersMethod__init__
( self, basis_mode: str = 'trigonometric', max_terms: int = 3, max_power: int
tnlearn/rl_regressor.py:99
↓ 1 callersMethod__init__
(self, samples_per_prompt: int)
tnlearn/drsr/sampler.py:30
↓ 1 callersMethod__setstate__
(self, state)
tnlearn/modules/TNtransformer.py:163
↓ 1 callersMethod_augment
Augments the input by applying all basis functions and concatenating.
tnlearn/modules/TNrnn.py:182
↓ 1 callersMethod_build_enhanced_prompt
(self, prompt: str, best_score: float, progress: float)
tnlearn/drsr/sampler.py:52
↓ 1 callersMethod_build_expr
Build a human‑readable expression string in the format: intercept + c1@phi1 + c2@phi2 + ... where phi_k are the basis fun
tnlearn/rl_regressor.py:240
↓ 1 callersMethod_build_specification
(self)
tnlearn/drsr/agent.py:75
↓ 1 callersMethod_conv_forward
Subclasses override this method to call the corresponding F.conv1d/2d/3d.
tnlearn/modules/TNconv.py:186
↓ 1 callersMethod_conv_forward
Subclasses override this method to call the corresponding F.conv_transpose1d/2d/3d.
tnlearn/modules/TNconv.py:394
↓ 1 callersMethod_draw_samples_client
(self, prompt: str)
tnlearn/drsr/sampler.py:78
↓ 1 callersMethod_evaluate_selection
Evaluate a set of selected basis functions in a vectorized (homogeneous) way. For each selected basis function phi_k, we compute:
tnlearn/rl_regressor.py:174
↓ 1 callersFunction_extract_function_names
(specification: str)
tnlearn/drsr/pipeline.py:30
↓ 1 callersMethod_extract_var_exprs
从原始符号表达式中提取所有 '@' 之后的变量表达式(丢弃系数)。 例如 "2@x**3 + 3@torch.sin(x) + x" -> ['x**3', 'torch.sin(x)', 'x']
tnlearn/neurons.py:72
↓ 1 callersMethod_generate_prompt
(self, implementations: Sequence[str])
tnlearn/drsr/buffer.py:146
↓ 1 callersMethod_get_best_from_database
从内存中的 database 获取最佳方程体(用于 save=False 时)
tnlearn/drsr/agent.py:110
↓ 1 callersMethod_get_global_sample_nums
(self)
tnlearn/drsr/sampler.py:178
↓ 1 callersMethod_get_results
(self, queue)
tnlearn/drsr/evaluator.py:103
↓ 1 callersFunction_get_signature
(scores_per_test: ScoresPerTest)
tnlearn/drsr/buffer.py:53
↓ 1 callersMethod_global_sample_nums_plus_one
(self)
tnlearn/drsr/sampler.py:184
↓ 1 callersMethod_parse_expression
Parse a symbolic expression to extract polynomial and sine terms.
tnlearn/TN_base.py:36
↓ 1 callersMethod_parse_expression
(self, expr: str)
tnlearn/modules/TNconv.py:140
↓ 1 callersMethod_parse_expression
(self, expr: str)
tnlearn/modules/TNconv.py:364
↓ 1 callersMethod_parse_expression
Extract all sub‑expressions containing 'x', ignoring pure constant terms.
tnlearn/modules/TNlinear.py:114
↓ 1 callersMethod_prepare_dataset
(self, X: np.ndarray, y: np.ndarray)
tnlearn/drsr/agent.py:107
↓ 1 callersMethod_print_evaluation_details
(self, program, results, **kwargs)
tnlearn/drsr/evaluator.py:110
↓ 1 callersMethod_provider_name
(self)
tnlearn/drsr/llm.py:91
↓ 1 callersMethod_record_and_verbose
(self, sample_orders: int)
tnlearn/drsr/profile.py:222
↓ 1 callersMethod_reset_parameters
(self)
tnlearn/modules/TNtransformer.py:685
↓ 1 callersMethod_select_action
Sample up to max_terms basis functions (with replacement) and remove duplicates.
tnlearn/rl_regressor.py:276
↓ 1 callersMethod_split_terms
按顶层加减号分割表达式,正确保留括号内的符号。
tnlearn/neurons.py:95
↓ 1 callersMethod_split_terms
(self, expr: str)
tnlearn/modules/TNconv.py:122
↓ 1 callersMethod_split_terms
(self, expr: str)
tnlearn/modules/TNconv.py:346
↓ 1 callersMethod_split_terms
Split expression by top-level '+' and '-' while respecting parentheses.
tnlearn/modules/TNlinear.py:95
↓ 1 callersFunction_tokenize
Transform `code` into Python tokens.
tnlearn/drsr/code_manipulation.py:201
↓ 1 callersFunction_untokenize
Transform a list of Python tokens into code.
tnlearn/drsr/code_manipulation.py:210
↓ 1 callersMethod_update_iteration_progress
(self, sample_orders: int)
tnlearn/drsr/profile.py:167
next →1–100 of 330, ranked by callers