A compact and interpretable deep learning framework for predicting cancer immunotherapy response from pre-treatment bulk RNA-seq profiles by

# Metabolic Causal Planner A compact and interpretable deep learning framework for predicting cancer immunotherapy response from pre-treatment bulk RNA-seq profiles by integrating computational immunology, metabolic representation learning, and uncertainty-aware prediction. ## Overview **Metabolic Causal Planner** is designed for supervised patient-level cancer immunotherapy response prediction. Given a pre-treatment tumor bulk RNA-seq expression profile, the model predicts whether a patient is likely to respond to immune checkpoint blockade therapy. The framework integrates three coordinated modules: 1. **Counterfactual Metabolic Adjuster** Learns a latent biological state from transcriptomic profiles and estimates response-relevant metabolic perturbations in the latent space. 2. **Agent-driven Immune Response Mapper** Maps the adjusted molecular representation into an immune-response embedding to capture immune–metabolic interactions. 3. **Uncertainty-guided Response Predictor** Performs stochastic response prediction and estimates patient-level predictive uncertainty for robust decision making. An additional **Uncertainty-aware Refinement** strategy is used to regularize the final decision representation and reduce unstable or over-confident predictions. ## Key Features - Prediction from pre-treatment tumor bulk RNA-seq profiles - Immune–metabolic representation learning - Counterfactual latent metabolic adjustment - Stochastic uncertainty-aware response prediction - Entropy-guided refinement for robust classification - Internal evaluation on IMvigor210 - External validation on Hugo/GSE78220 - Comparison with classical machine learning, gradient boosting, neural, and immunotherapy-specific baselines ## Task The task is formulated as binary classification: - **Responder**: complete response or partial response - **Non-responder**: stable disease or progressive disease Given a normalized gene-expression vector, the model outputs a responder probability between 0 and 1. ## Datasets This project uses two public immune checkpoint blockade cohorts: | Dataset | Cancer Type | Treatment | Role | |---|---|---|---| | IMvigor210 | Metastatic urothelial carcinoma | Atezolizumab / anti-PD-L1 | Development cohort | | Hugo / GSE78220 | Metastatic melanoma | Anti-PD-1 | External test cohort | The IMvigor210 cohort is used for training, validation, and internal testing. Hugo/GSE78220 is used only for independent external validation. ## Model Architecture The overall framework follows the pipeline below: ```text Pre-treatment bulk RNA-seq | v Counterfactual Metabolic Adjuster | v Adjusted latent biological state | v Agent-driven Immune Response Mapper | v Immune-response embedding | v Uncertainty-guided Response Predictor | v Responder probability + predictive uncertainty Method Counterfactual Metabolic Adjuster The input RNA-seq vector is encoded into a compact latent biological state. A perturbation network estimates a counterfactual adjustment vector, which is added to the latent state to obtain an adjusted immune–metabolic representation. Agent-driven Immune Response Mapper The adjusted representation is transformed into an immune-response embedding using a neural mapping module with nonlinear activation, layer normalization, and dropout. Uncertainty-guided Response Predictor The predictor performs multiple stochastic forward passes using Monte Carlo dropout. The final responder probability is computed as the average prediction, while predictive uncertainty is estimated from the variance across stochastic predictions. Uncertainty-aware Refinement The model applies entropy-guided regularization and gradient-based feedback updates to refine the response decision representation before final classification. Evaluation Metrics The model is evaluated using: AUROC AUPRC Balanced Accuracy Macro-F1 Number of trainable parameters FLOPs per patient-level inference Confidence intervals, calibration analysis, Brier score, expected calibration error, and decision curve analysis may also be used for clinical AI reliability evaluation. Baselines The proposed method is compared with: Logistic Regression Random Forest XGBoost Multi-Layer Perceptron TIDE LightGBM All baselines use the same preprocessed RNA-seq input, label definition, data split protocol, and evaluation metrics. Installation git clone https://github.com/your-username/Metabolic-Causal-Planner.git cd Metabolic-Causal-Planner conda create -n mcp python=3.10 conda activate mcp pip install -r requirements.txt Requirements Recommended environment: Python 3.10 PyTorch 2.1.0 CUDA 11.8 NumPy 1.24.4 pandas 2.0.3 scikit-learn 1.3.2 SciPy 1.10.1 LightGBM 4.1.0 XGBoost Repository Structure Metabolic-Causal-Planner/ ├── configs/ │ └── default.yaml ├── data/ │ ├── raw/ │ └── processed/ ├── src/ │ ├── preprocessing.py │ ├── model.py │ ├── train.py │ ├── evaluate.py │ └── utils.py ├── scripts/ │ ├── run_train.sh │ ├── run_eval.sh │ └── run_ablation.sh ├── results/ ├── checkpoints/ ├── requirements.txt └── README.md Usage Data Preprocessing python src/preprocessing.py \ --config configs/default.yaml Training python src/train.py \ --config configs/default.yaml \ --seed 13 Evaluation python src/evaluate.py \ --config configs/default.yaml \ --checkpoint checkpoints/best_model_seed13.pt Repeated Runs for seed in 13 21 34 55 89 do python src/train.py --config configs/default.yaml --seed $seed python src/evaluate.py --config configs/default.yaml --seed $seed done Reproducibility The experimental protocol uses five random seeds: 13, 21, 34, 55, 89 For each run, IMvigor210 is split at the patient level into training, validation, and internal test subsets using an 8:1:1 stratified ratio. Hugo/GSE78220 is reserved as an independent external test cohort and is not used for training, validation, normalization fitting, hyperparameter tuning, or early stopping. Data Availability The raw datasets are obtained from public immunotherapy cohort resources. Due to data-access requirements, raw patient-level data are not redistributed in this repository. Scripts are provided to reproduce the processed matrices from the original public sources, subject to the corresponding data-access terms. Model Availability Trained model checkpoints, prediction files, split identifiers, and evaluation outputs can be deposited in an archival repository such as Zenodo after release. Citation If you use this repository or find this work useful, please cite: @article{fang2025metaboliccausalplanner, title={Integrating Computational Immunology and Metabolic Profiling for Cancer Immunotherapy Response Prediction from Pre-treatment Bulk RNA-seq Profiles}, author={Fang, Xuan}, journal={}, year={2025} } License This project is released for academic and research use. Please check the repository license file for details.
"""
model.py

Implementation of the Metabolic Causal Planner for cancer immunotherapy
response prediction from pre-treatment bulk RNA-seq profiles.

The framework contains four main components:

1. CounterfactualMetabolicAdjuster
2. AgentDrivenImmuneResponseMapper
3. UncertaintyGuidedResponsePredictor
4. MetabolicCausalPlanner

Author: Xuan Fang
"""

from typing import Dict, Optional, Tuple

import torch
import torch.nn as nn
import torch.nn.functional as F


class MLPBloc

api keys ubuntu

HF_TOKEN="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"
NVIDIA_NIM_API_KEY="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"

hostinger agents mail api key

101ac64a64683982b1866936c5d6471c39300fa1cd1a9e5d7ad12cad3d504652

3737. Count Subarrays With Majority Element I

You are given an integer array nums and an integer target. Return the number of subarrays of nums in which target is the majority element. The majority element of a subarray is the element that appears strictly more than half of the times in that subarray.
/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number}
 */
var countMajoritySubarrays = function(nums, target) {
    let n = nums.length;
    let ans = 0;    // total number of valid subarrays

    // Fix the starting index of the subarray
    for (let i = 0; i < n; i++) {

        // Track how many times `target` appears in the current subarray
        let countTarget = 0;

        // Expand the subarray to the right (i → j)
        for (let j = i; j < n; j++) {

          

ascend build sample jun 24 2026

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap');

/*===============================
--------- CSS Custom Properties -------
===============================*/
:root {
  --h1-font-family: "DM Sans", sans-serif;
  --h2-font-family: "DM Sans", sans-serif;
  --h3-font-family: "DM Sans", sans-serif;
  --h4-font-family: "DM Sans", sans-serif;
  --body-font-family: "DM Sans", sans-serif;
  --link-font-family: "DM Sans", sans

ascend build sample jun 24 2026

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap');

/*===============================
--------- CSS Custom Properties -------
===============================*/
:root {
  --h1-font-family: "DM Sans", sans-serif;
  --h2-font-family: "DM Sans", sans-serif;
  --h3-font-family: "DM Sans", sans-serif;
  --h4-font-family: "DM Sans", sans-serif;
  --body-font-family: "DM Sans", sans-serif;
  --link-font-family: "DM Sans", sans

3700. Number of ZigZag Arrays II

You are given three integers n, l, and r. A ZigZag array of length n is defined as follows: Each element lies in the range [l, r]. No two adjacent elements are equal. No three consecutive elements form a strictly increasing or strictly decreasing sequence. Return the total number of valid ZigZag arrays. Since the answer may be large, return it modulo 109 + 7. A sequence is said to be strictly increasing if each element is strictly greater than its previous one (if exists). A sequence is said to be strictly decreasing if each element is strictly smaller than its previous one (if exists).
/**
 * @param {number} n
 * @param {number} l
 * @param {number} r
 * @return {number}
 */
var zigZagArrays = function(n, l, r) {
    const MOD = 1_000_000_007n;

    const m = r - l + 1;   // number of possible values
    const S = 2 * m;       // total states: value × direction

    // Create an S×S zero matrix of BigInt
    function zeroMatrix() {
        return Array.from({ length: S }, () =>
            Array(S).fill(0n)
        );
    }

    // Multiply two S×S matrices (BigInt)
    functi

決済実装時の注意事項

# 単体決済 設計チェックリスト

1 回の購入に対して 1 回課金する機能の設計・実装・レビューで使用する。
各項目に実装内容、保存先、判定条件またはテスト結果を記入する。
対象外の項目には、対象外と判断した理由を記入する。

## 0. 使い方

各項目へ次の優先度を付ける。

- `必須`: 初回リリースまでに決定・実装・テストする
- `条件付き`: 採用する商品、決済手段、返金運用に該当する場合だけ対応する
- `将来対応`: 初回リリースの対象外とし、未対応時の制約と代替運用を記録する

この文書は抜け漏れ防止用のチェックリストとして使用し、実装開始前に少なくとも次の成果物を別表または「15. 実装記録」へ確定する。

- 注文、決済、商品提供、返金、異議申立ての状態変換表
- 各状態を分離して保存するDBスキーマ
- 処理する非同期通知イベントと処理内容の一覧
- 注文作成、決済、売上確定、返金ごとの冪等性方式
- 初回リリースで対応しない項目と代替運用

## 1. 契約条件

- 販売主体:
- 決済明細・領収書の発行主体:
- 商品またはサービス:
- 購入者を識別

Locale settings are sometime missing in a brand new image; this is the fix

Locale settings are sometime missing in a brand new image; this is the fix
# Raspberry Pi Locale Fix (en_US.UTF-8)

When locale settings set in **Raspberry Pi Imager** don't carry over after first boot,
all `LC_*` values come up `(unset)` and you'll see errors like:

```
perl: warning: Setting locale failed.
locale: Cannot set LC_CTYPE to default locale: No such file or directory
```

---

## Confirm the Problem

```bash
locale
```

Broken output looks like this — every value is `(unset)` or stuck on `en_GB.UTF-8`:

```
LANG=en_GB.UTF-8
LC_CTYPE=(unset)
LC_ALL=(unset)

Jump, Crash, Repeat, Smile – Why Geometry Dash Is the Perfect Rhythmic Challenge


There's a special kind of magic in a game that lets you fail a hundred times and still come back grinning. <a href="https://geometrydash-pc.com/">Geometry Dash</a> fits that description perfectly. If you haven't tried it yet—or if you tried it once, got frustrated, and swore it off—let me convince you to give it another spin. Available right now to play in your browser at Geometry Dash, this rhythm-based platformer is deceptively simple, wildly addictive, and surprisingly rewarding once you ge

Weighted Particle Lifespan

If you want the math behind it you can check wikipedia here https://en.wikipedia.org/wiki/Weibull_distribution Basically you have two parameters -the shape parameter (k), it represents the slope of the line, if it's exponential or logarithmic * k<1: decreasing death rate (infant mortality), early deaths are more likely * k = 1 : constant death (so same as the default life from Houdini) * k>1 : increasing death rate, death becomes more likely over time -the scale parameter (b), determines the location of the distribution, influences how quickly the death rate increases or decreases (e.g. a larger scale would shift distribution to the right, so longer life)
// weibull distribution function
float pweibull(float x, k, b)
{
    float r = 1 - exp(-b * pow(x, k));
    return r;
}
 
float seed = chf('seed');
float k = chf('k');
float b = chf('b');
float r = rand(seed + i@id);
float p = pweibull(f@age, k, b);
if (p > r)
{
    f@life = f@age;
    i@dead = 1;
}

3699. Number of ZigZag Arrays I

You are given three integers n, l, and r. A ZigZag array of length n is defined as follows: Each element lies in the range [l, r]. No two adjacent elements are equal. No three consecutive elements form a strictly increasing or strictly decreasing sequence. Return the total number of valid ZigZag arrays. Since the answer may be large, return it modulo 109 + 7. A sequence is said to be strictly increasing if each element is strictly greater than its previous one (if exists). A sequence is said to be strictly decreasing if each element is strictly smaller than its previous one (if exists).
/**
 * @param {number} n
 * @param {number} l
 * @param {number} r
 * @return {number}
 */
var zigZagArrays = function(n, l, r) {
    const MOD = 1_000_000_007;
    const m = r - l + 1;

    // dp[dir][x] where x is shifted to [0..m-1]
    let dpUp = new Array(m).fill(1);   // next must go up
    let dpDown = new Array(m).fill(1); // next must go down

    for (let i = 2; i <= n; i++) {
        // prefix sums for dpUp
        let pref = new Array(m).fill(0);
        pref[0] = dpUp[0];
        fo

SR/SYNA Convert date format

(function transformRow(source, target, map, log, isUpdate) {

    function convertDate(value) {
        if (gs.nil(value)) {
            return "";
        }

        var raw = value.toString().trim();

        if (raw === "") {
            return "";
        }

        var gd = new GlideDate();
        gd.setDisplayValue(raw, "dd/MM/yyyy");

        return gd.getValue(); // yyyy-MM-dd
    }

    function convertDateTime(value) {
        if (gs.nil(value)) {
            retu

1189. Maximum Number of Balloons

Given a string text, you want to use the characters of text to form as many instances of the word "balloon" as possible. You can use each character in text at most once. Return the maximum number of instances that can be formed.
/**
 * @param {string} text
 * @return {number}
 */
var maxNumberOfBalloons = function(text) {
    const freq = { b:0, a:0, l:0, o:0, n:0};

    for (const ch of text) {
        if (freq.hasOwnProperty(ch)) freq[ch]++;
    }

    // l and o are needed twice
    freq.l = Math.floor(freq.l / 2);
    freq.o = Math.floor(freq.o / 2);

    return Math.min(freq.b, freq.a, freq.l, freq.o, freq.n);
};

PROD NESTED

{
  "collapsible": false,
  "key": "panel",
  "type": "panel",
  "label": "Panel",
  "input": false,
  "tableView": false,
  "components": [
    {
      "label": "Columns",
      "columns": [
        {
          "components": [
            {
              "label": "Init helpers",
              "key": "_init_helpers",
              "type": "hidden",
              "input": true,
              "persistent": false,
              "calculateValue": "if (!window._catastoHelpers) {\n  window._catastoHel

1833. Maximum Ice Cream Bars

It is a sweltering summer day, and a boy wants to buy some ice cream bars. At the store, there are n ice cream bars. You are given an array costs of length n, where costs[i] is the price of the ith ice cream bar in coins. The boy initially has coins coins to spend, and he wants to buy as many ice cream bars as possible. Note: The boy can buy the ice cream bars in any order. Return the maximum number of ice cream bars the boy can buy with coins coins. You must solve the problem by counting sort.
/**
 * @param {number[]} costs
 * @param {number} coins
 * @return {number}
 */
var maxIceCream = function(costs, coins) {
    // Find the maximum cost so we know how large our frequency array must be.
    // This avoids sorting and lets us count how many bars exist at each price.
    const maxCost = Math.max(...costs);

    // Frequency array where freq[p] = number of bars that cost 'p' coins.
    const freq = new Array(maxCost + 1).fill(0);

    // Count how many bars exist at each price.