### Run FuxiCTR Demo Examples Source: https://github.com/reczoo/fuxictr/blob/main/README.md Execute the provided demo scripts to understand basic FuxiCTR usage and workflow. Navigate to the demo directory and run the Python scripts. ```bash cd demo python example1_build_dataset_to_parquet.py python example2_DeepFM_with_parquet_input.py ``` -------------------------------- ### Install Requirements Source: https://github.com/reczoo/fuxictr/blob/main/model_zoo/FinalNet/README.md Install the necessary Python packages for FinalNet by running this command. ```bash pip install -r requirements.txt ``` -------------------------------- ### Run a Model on Tiny Data (DCN Example) Source: https://github.com/reczoo/fuxictr/blob/main/README.md Demonstrates how to run a specific model, DCN, on a small dataset. Users can adapt this by changing the model name and modifying configuration files for custom datasets or hyperparameters. Refer to the model's specific README for more details. ```bash cd model_zoo/DCN/DCN_torch python run_expid.py --expid DCN_test --gpu 0 ``` ```bash # Change `MODEL` according to the target model name cd model_zoo/MODEL python run_expid.py --expid MODEL_test --gpu 0 ``` -------------------------------- ### Tune Hyper-parameters with Multiple GPUs Source: https://github.com/reczoo/fuxictr/blob/main/README.md Utilize FuxiCTR's fast grid search functionality for hyper-parameter tuning across multiple GPUs. This example shows setting up 8 experiments using 4 GPUs. ```bash cd experiment python run_param_tuner.py --config config/DCN_tiny_parquet_tuner_config.yaml --gpu 0 1 2 3 0 1 2 3 ``` -------------------------------- ### Optional Regularization Examples Source: https://github.com/reczoo/fuxictr/blob/main/model_zoo/FinalNet/README.md Illustrates how to specify different types of regularization for embedding matrices and network parameters. Supports L2, L1, and combined L1_L2 regularization with custom weights. ```text embedding_regularizer: "l2(1.e-3)" # or embedding_regularizer: "l1(1.e-3)" # or embedding_regularizer: "l1_l2(1.e-3, 1.e-3)" ``` ```text net_regularizer: "l2(1.e-3)" # or net_regularizer: "l1(1.e-3)" # or net_regularizer: "l1_l2(1.e-3, 1.e-3)" ``` -------------------------------- ### Model Configuration Parameters Source: https://github.com/reczoo/fuxictr/blob/main/model_zoo/FinalMLP/README.md Configuration settings for initializing and training FuxiCTR models. ```APIDOC ## Configuration Parameters ### Description Defines the hyperparameters and training settings for the FuxiCTR model. ### Parameters #### Request Body - **fs_hidden_units** (list) - Optional - Hidden units of fs gates (default: [64]) - **fs1_context** (list) - Optional - Conditional features for feature gating in stream 1 (default: []) - **fs2_context** (list) - Optional - Conditional features for feature gating in stream 2 (default: []) - **num_heads** (int) - Optional - Number of heads used for bilinear fusion (default: 1) - **epochs** (int) - Optional - Max number of epochs for training (default: 100) - **shuffle** (bool) - Optional - Whether to shuffle data samples (default: True) - **seed** (int) - Optional - Random seed for reproducibility (default: 2021) - **monitor** (str/dict) - Optional - Metrics for early stopping (default: 'AUC') - **monitor_mode** (str) - Optional - 'max' or 'min' for monitor metric (default: 'max') - **model_root** (str) - Optional - Directory to save checkpoints and logs (default: './checkpoints/') - **early_stop_patience** (int) - Optional - Patience for early stopping (default: 2) - **save_best_only** (bool) - Optional - Whether to save only the best model (default: True) - **eval_steps** (int/None) - Optional - Evaluation interval (default: None) ``` -------------------------------- ### Run Experiment with ShareBottom Model Source: https://github.com/reczoo/fuxictr/blob/main/model_zoo/multitask/ShareBottom/README.md Execute the ShareBottom model test using the run_expid.py script. Specify the experiment ID and GPU to use. ```bash python run_expid.py --expid ShareBottom_test --gpu 0 ``` -------------------------------- ### Run Experiment Command Source: https://github.com/reczoo/fuxictr/blob/main/model_zoo/multitask/PLE/README.md Use this command to execute an experiment with a specified experiment ID and GPU. ```bash python run_expid.py --expid PLE_test --gpu 0 ``` -------------------------------- ### FuxiCTR Model Configuration Parameters Source: https://github.com/reczoo/fuxictr/blob/main/model_zoo/multitask/PLE/README.md Detailed list of parameters for configuring FuxiCTR models. ```APIDOC ## FuxiCTR Model Configuration Parameters ### Description This section details the various parameters available for configuring FuxiCTR models, including network architecture, training settings, and model saving options. ### Parameters #### Network Architecture - **expert_hidden_units** (list) - Default: `[512, 256, 128]` - Hidden units in expert networks. - **gate_hidden_units** (list) - Default: `[128, 64]` - Hidden units in gating networks. - **tower_hidden_units** (list) - Default: `[128, 64]` - Hidden units in tower networks. - **hidden_activations** (str/list) - Default: `"relu"` - Activation function in DNN. Layer-wise activations can be specified as a list, e.g., `["relu", "leakyrelu", "sigmoid"]`. - **net_dropout** (float) - Default: `0` - Dropout rate in DNN. - **batch_norm** (bool) - Default: `False` - Whether to use Batch Normalization in DNN. #### Training Settings - **epochs** (int) - Default: `50` - The maximum number of epochs for training, with early stopping based on monitor metrics. - **shuffle** (bool) - Default: `True` - Whether to shuffle the data samples for each epoch of training. - **seed** (int) - Default: `2023` - The random seed used for reproducibility. - **monitor** (str/dict) - Default: `'AUC'` - The monitor metric for early stopping. Supports a single metric (e.g., `"AUC"`) or multiple metrics using a dict (e.g., `{"AUC": 2, "logloss": -1}` which represents `2*AUC - logloss`). - **monitor_mode** (str) - Default: `'max'` - `'max'` means higher is better, while `'min'` denotes lower is better. - **num_workers** (int) - Default: `3` - The number of workers for the data loader. - **verbose** (int) - Default: `1` - `0` for silent logging, `1` for verbose logging with `tqdm`. - **early_stop_patience** (int) - Default: `2` - Training is stopped when the monitor metric fails to improve for `early_stop_patience` consecutive evaluation intervals. #### Model Saving - **model_root** (str) - Default: `'./checkpoints/'` - The directory to save model checkpoints and running logs. - **pickle_feature_encoder** (bool) - Default: `True` - Whether to pickle the feature encoder during preprocessing. Used when `data_format="csv"`. - **save_best_only** (bool) - Default: `True` - Whether to save only the best model checkpoint. ### Request Example ```json { "expert_hidden_units": [512, 256, 128], "gate_hidden_units": [128, 64], "tower_hidden_units": [128, 64], "hidden_activations": "relu", "net_dropout": 0.0, "batch_norm": false, "epochs": 50, "shuffle": true, "seed": 2023, "monitor": "AUC", "monitor_mode": "max", "model_root": "./checkpoints/", "num_workers": 3, "verbose": 1, "early_stop_patience": 2, "pickle_feature_encoder": true, "save_best_only": true } ``` ### Response #### Success Response (200) - **message** (str) - A confirmation message indicating successful configuration or training start. #### Response Example ```json { "message": "Model configuration applied successfully." } ``` ``` -------------------------------- ### Execute Model Experiment Source: https://github.com/reczoo/fuxictr/blob/main/model_zoo/GDCN/README.md Command to run the model using the specified experiment ID and GPU device. ```bash python run_expid.py --expid GDCNP_test --gpu 0 ``` -------------------------------- ### Run FuxiCTR Experiment Source: https://github.com/reczoo/fuxictr/blob/main/model_zoo/multitask/MMoE/README.md Command to execute an experiment using the FuxiCTR run script. Specify the experiment ID and the GPU to use. ```bash python run_expid.py --expid MMoE_test --gpu 0 ``` -------------------------------- ### Project Directory Structure Source: https://github.com/reczoo/fuxictr/blob/main/model_zoo/GDCN/README.md Visual representation of the project file hierarchy. ```text ├── config # 配置文件夹 │ ├── dataset_config.yaml # 数据集配置文件 │ └── model_config.yaml # 模型配置文件 ├── src # 模型代码文件夹 │ └── GDCN.py # 模型代码 ├── fuxictr_version.py # fuxictr加载及版本检查文件 ├── README.md # 使用说明 ├── requirements.txt # 依赖文件 └── run_expid.py # 执行脚本文件 ``` -------------------------------- ### QNN Model Configuration Parameters Source: https://github.com/reczoo/fuxictr/blob/main/model_zoo/QNN/README.md Defines the configuration parameters for the QNN model. These include settings for the model name, dataset, loss function, metrics, task type, optimizer, learning rate, regularization, batch size, embedding dimensions, and network architecture. ```python model: str = "QNN_alpha" dataset_id: str = "TBD" loss: str = "binary_crossentropy" metrics: list = ['logloss', 'AUC'] task: str = "binary_classification" optimizer: str = "adam" learning_rate: float = 1.0e-3 embedding_regularizer: float | str = 0 net_regularizer: float | str = 0 batch_size: int = 10000 embedding_dim: int = 32 num_layers: int = 3 num_row: int = 3 net_dropout: float = 0 batch_norm: bool = False num_heads: int = 1 ``` -------------------------------- ### FuxiCTR Project Directory Structure Source: https://github.com/reczoo/fuxictr/blob/main/model_zoo/multitask/MMoE/README.md Overview of the FuxiCTR project's file and directory organization. This structure helps in understanding where different components like configurations, model code, and execution scripts are located. ```text ├── config # 配置文件夹 │ ├── dataset_config.yaml # 数据集配置文件 │ └── model_config.yaml # 模型配置文件 ├── src # 模型代码文件夹 │ └── MMoE.py # 模型代码 ├── fuxictr_version.py # fuxictr加载及版本检查文件 ├── README.md # 使用说明 └── run_expid.py # 执行脚本文件 ``` -------------------------------- ### FinalNet Configuration Parameters Source: https://github.com/reczoo/fuxictr/blob/main/model_zoo/FinalNet/README.md Defines the configuration options for the FinalNet model. This includes settings for dataset, loss, metrics, task type, optimizer, regularization, batch size, embedding dimensions, and network block specifics. ```text model: "FinalNet" dataset_id: "TBD" loss: "binary_crossentropy" metrics: ['logloss', 'AUC'] task: "binary_classification" optimizer: "adam" learning_rate: 1.0e-3 embedding_regularizer: 0 net_regularizer: 0 batch_size: 10000 embedding_dim: 32 block1_hidden_units: [64, 64, 64] block1_hidden_activations: "relu" block2_hidden_units: [64, 64, 64] block2_hidden_activations: "relu" block1_dropout: 0 block2_dropout: 0 ``` -------------------------------- ### Model Configuration (Base and Specific) Source: https://github.com/reczoo/fuxictr/blob/main/docs/configurations.md Defines model parameters, including shared base settings and experiment-specific configurations like DeepFM. Base settings can be overridden by expid settings. ```yaml # model_config.yaml Base: model_root: '../checkpoints/' workers: 3 verbose: 1 patience: 2 pickle_feature_encoder: True use_hdf5: True save_best_only: True every_x_epochs: 1 debug: False partition_block_size: -1 DeepFM_test: model: DeepFM dataset_id: taobao_tiny_data # each expid corresponds to a dataset_id loss: 'binary_crossentropy' metrics: ['logloss', 'AUC'] task: binary_classification optimizer: adam hidden_units: [64, 32] hidden_activations: relu net_regularizer: 0 embedding_regularizer: 1.e-8 learning_rate: 1.e-3 batch_norm: False net_dropout: 0 batch_size: 128 embedding_dim: 4 epochs: 1 shuffle: True seed: 2019 monitor: 'AUC' monitor_mode: 'max' ``` -------------------------------- ### Run DCN Experiment Source: https://github.com/reczoo/fuxictr/blob/main/model_zoo/DCN/DCN_torch/README.md Execute the DCN model experiment using the provided script. Specify the experiment ID and the GPU to use. ```python python run_expid.py --expid DCN_test --gpu 0 ``` -------------------------------- ### Dataset Configuration (Compact) Source: https://github.com/reczoo/fuxictr/blob/main/docs/configurations.md Defines dataset parameters including data paths, format, and feature columns. Multiple features can be grouped with shared settings for compactness. ```yaml # dataset_config.yaml taubao_tiny: # dataset_id data_root: ../data/ data_format: csv train_data: ../data/tiny_data/train_sample.csv valid_data: ../data/tiny_data/valid_sample.csv test_data: ../data/tiny_data/test_sample.csv min_categr_count: 1 feature_cols: - {name: ["userid","adgroup_id","pid","cate_id","campaign_id","customer","brand","cms_segid", "cms_group_id","final_gender_code","age_level","pvalue_level","shopping_level","occupation"], active: True, dtype: str, type: categorical} label_col: {name: clk, dtype: float} ``` -------------------------------- ### Dataset Configuration (Expanded) Source: https://github.com/reczoo/fuxictr/blob/main/docs/configurations.md Defines dataset parameters with each feature column explicitly listed. This format is more verbose but can be clearer for individual feature settings. ```yaml taobao_tiny: data_root: ../data/ data_format: csv train_data: ../data/tiny_data/train_sample.csv valid_data: ../data/tiny_data/valid_sample.csv test_data: ../data/tiny_data/test_sample.csv min_categr_count: 1 feature_cols: [{name: "userid", active: True, dtype: str, type: categorical}, {name: "adgroup_id", active: True, dtype: str, type: categorical}, {name: "pid", active: True, dtype: str, type: categorical}, {name: "cate_id", active: True, dtype: str, type: categorical}, {name: "campaign_id", active: True, dtype: str, type: categorical}, {name: "customer", active: True, dtype: str, type: categorical}, {name: "brand", active: True, dtype: str, type: categorical}, {name: "cms_segid", active: True, dtype: str, type: categorical}, {name: "cms_group_id", active: True, dtype: str, type: categorical}, {name: "final_gender_code", active: True, dtype: str, type: categorical}, {name: "age_level", active: True, dtype: str, type: categorical}, {name: "pvalue_level", active: True, dtype: str, type: categorical}, {name: "shopping_level", active: True, dtype: str, type: categorical}, {name: "occupation", active: True, dtype: str, type: categorical}] label_col: {name: clk, dtype: float} ``` -------------------------------- ### Python Requirements for QNN Source: https://github.com/reczoo/fuxictr/blob/main/model_zoo/QNN/README.md Specifies the required Python version, PyTorch version, and fuxictr library version for running the QNN model. ```python python: 3.8 pytorch: 1.10 fuxictr: 2.0.1 ``` -------------------------------- ### Layer-wise Activation Specification Source: https://github.com/reczoo/fuxictr/blob/main/model_zoo/FinalNet/README.md Shows how to define layer-specific activation functions within network blocks. Activations can be a single string for all layers or a list for individual layer assignments. ```text block1_hidden_activations: ["relu", "leakyrelu", "sigmoid"] ``` ```text block2_hidden_activations: ["relu", "leakyrelu", "sigmoid"] ``` -------------------------------- ### FinalMLP Requirements Source: https://github.com/reczoo/fuxictr/blob/main/model_zoo/FinalMLP/README.md Specifies the required versions for Python, PyTorch, and fuxictr to run the FinalMLP model. ```python python: 3.6/3.7 pytorch: 1.0/1.11 fuxictr: 2.0.1 ``` -------------------------------- ### DeepFM Model Configuration Source: https://github.com/reczoo/fuxictr/blob/main/docs/configurations.md This configuration block defines parameters for training a DeepFM model. It includes settings for model architecture, dataset, training process, and optimization. ```yaml DeepFM_test: model_root: '../checkpoints/' workers: 3 verbose: 1 patience: 2 pickle_feature_encoder: True use_hdf5: True save_best_only: True every_x_epochs: 1 debug: False partition_block_size: -1 model: DeepFM dataset_id: taobao_tiny_data loss: 'binary_crossentropy' metrics: ['logloss', 'AUC'] task: binary_classification optimizer: adam hidden_units: [64, 32] hidden_activations: relu net_regularizer: 0 embedding_regularizer: 1.e-8 learning_rate: 1.e-3 batch_norm: False net_dropout: 0 batch_size: 128 embedding_dim: 4 epochs: 1 shuffle: True seed: 2019 monitor: 'AUC' monitor_mode: 'max' ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.