hpipy.extensions.NeuralNetworkIndex#
- class hpipy.extensions.NeuralNetworkIndex(**kwargs)[source]
Bases:
HedonicIndex
Neural network house price index.
Estimates the relationship between independent variables and the dependent variable using a neural network model. The index can be derived from the model using two distinct approaches:
Residual Approach: This method extracts the house price index directly from the market pathway of the neural network. It isolates the temporal component of price changes by zeroing out all non-time features and examining the network’s output, effectively capturing the “residual” market trend.
Attributional Approach: This method derives the index by analyzing the explainability of both market and time components. It uses attribution techniques to decompose the network’s predictions and to assess the conditional marginal impact of each time period on price changes, which are converted into an index.
Both approaches aim to capture market trends, but differ in how they extract temporal information from the neural network’s learned representations.
Methods
Initialize base house price index.
Convert coefficients to an index.
Create the index.
Create a series from the index.
Create an index from a house price model.
Get hedonic transaction data.
Get a neural network house price model.
Smooth the index.
Apply smoothing to all indices.
Attributes
- Parameters:
kwargs (Any)
- static get_model()[source]
Get a neural network house price model.
- Return type:
type[BaseHousePriceModel]
- __init__(**kwargs)
Initialize base house price index.
- Parameters:
kwargs (Any)
- Return type:
None
- static coef_to_index(coef_df, log_dep, base_price=1)
Convert coefficients to an index.
- classmethod create_index(trans_data, prop_id=None, trans_id=None, price=None, seq_only=True, max_period=None, smooth=False, periodicity=None, min_date=None, max_date=None, adj_type=None, **kwargs)
Create the index.
- Parameters:
trans_data (TransactionData | PeriodTable | pd.DataFrame) – Input transaction data.
prop_id (str | None, optional) – Property identifier. Defaults to None.
trans_id (str | None, optional) – Transaction identifier. Defaults to None.
price (str | None, optional) – Price column name. Defaults to None.
seq_only (bool, optional) – Sequential only. Defaults to True.
max_period (int | None, optional) – Maximum index period. Defaults to None.
smooth (bool, optional) – Smooth the index. Defaults to False.
periodicity (str | None, optional) – Periodicity of the index. Defaults to None.
min_date (str | None, optional) – Minimum date for the index. Defaults to None.
max_date (str | None, optional) – Maximum date for the index. Defaults to None.
adj_type (str | None, optional) – Adjustment type. Defaults to None.
**kwargs – Additional keyword arguments.
- Returns:
Index object.
- Return type:
Self
- create_series(train_period=12, max_period=None, **kwargs)
Create a series from the index.
- classmethod from_model(model, trans_data=None, max_period=None, smooth=False, **kwargs)
Create an index from a house price model.
- Parameters:
model (BaseHousePriceModel) – House price model object.
trans_data (TransactionData | None, optional) – Transaction data object. Defaults to None.
max_period (int | None, optional) – Maximum period for the index. Defaults to None.
smooth (bool, optional) – Smooth the index. Defaults to False.
**kwargs – Additional keyword arguments.
- Returns:
Index object.
- Return type:
Self
- static get_data()
Get hedonic transaction data.
- Return type:
type[TransactionData]
- smooth_index(order=3, in_place=False)
Smooth the index.
- smooth_series(order=3)
Apply smoothing to all indices.
- Parameters:
order (int) – Defaults to 3.
- Returns:
Index object.
- Return type:
Self
- data: TransactionData
- model: BaseHousePriceModel
- name: pd.Series
- periods: pd.Series
- value: pd.Series
- index: Any
- imputed: np.ndarray
- smooth: Any
- accuracy: pd.DataFrame
- accuracy_smooth: pd.DataFrame
- volatility: pd.DataFrame
- volatility_smooth: pd.DataFrame
- revision: pd.DataFrame
- revision_smooth: pd.DataFrame