An ablation study tests whether a system depends on one input by switching it off and checking the effect on performance. In a portfolio-agent environment, a news switch lets you isolate the contribution of the news signal. section 12.4
Listing 12.2 The state: four feature blocks with a news switch
def _market_features(self, day):
lb = self.cfg.lookback
price_win = self.prices[day - lb + 1: day + 1] #A
...
return feats.reshape(-1)
def _news_features(self, day):
if not self.cfg.use_news or self.signal_matrix is None:
return np.zeros(self.news_dim) #B
return self.signal_matrix[day] #C
def _get_state(self) -> np.ndarray: #D
blocks = []
if self.cfg.include_market_features:
blocks.append(self._market_features(self.day))
blocks.append(self._news_features(self.day))
if self.cfg.include_portfolio_features:
blocks.append(self._portfolio_features())
if self.cfg.include_execution_features:
blocks.append(self._execution_features())
return np.concatenate(blocks).astype(np.float32) The state implementation shows how disabling news replaces its feature vector with zeros. section 12.4




