Skip to content

DCPanelSolver - autorank #20

@fedemolina

Description

@fedemolina

Hi!

I’ve been experimenting with the spectrum_cut parameter, which is set to 0.002 by default. If I understand correctly, this acts as a form of regularization since the suggested rank is determined by accumulating singular values until they exceed the 1 - spectrum_cut threshold. Essentially, it’s like analyzing the singular value curve, applying a cutoff at a specific threshold, and using that rank to solve the problem.

In other words, we’re defining an energy retention threshold, ensuring that a certain proportion of the total energy is preserved when selecting the rank. That approach seems standard, but I’m curious—why specifically 0.002?

I get that a higher cutoff (e.g., 0.01, keeping 99% of the energy) might discard small but meaningful variations in structured data, though the optimal value could depend on the dataset. On the other hand, a very low cutoff (e.g., 0.0001) might retain too much information, potentially introducing noise or leading to overfitting in treatment periods.

Is there a specific rationale or reference for choosing 0.002? I remember reading that Tibshirani proposed a method for selecting the cutoff, which isn’t the elbow method—does that apply here? (I'm going to look for that paper)

I read in the paper that:
The hyperparameters for all algorithms were tuned using rank 𝑟 ∼ 70 (estimated via cross validation). A test set Ω consisting of 20% of the treated entires is ran- domly sampled and hidden. The test error is then calculated by ‖𝑃Ω(𝑀 + 𝜏𝑍 − 𝑂)‖2 /‖𝑃Ω(𝑂 − 𝑂 ̄)‖2 where 𝑂 ̄ is the mean-value of 𝑂.

But in the code, spectrum_cut is set to a fixed value. Am I missing a theoretical justification for this in the paper?

I looked into it a bit, and it seems like 0.002 might be a commonly used value in the literature. Is that the case?

I experimented with adjusting this parameter because I noticed that the DC method produces strong results, but it also seems to overfit the rows of the outcome matrix.

The first plot displays a denser grid of values, while the last two plots use fewer values.

The final plot specifically shows the mean difference between the observed matrix and the counterfactual matrix. Unlike the previous plots, it does not use multiple Z matrices—just a single one. The calculation follows this approach: tau_vec = np.sum((Y - M) * Z, axis=1) / np.sum(Z, axis=1)

Image Image Image

and just to show an individual row of the outcome matrix we can see that by default (maybe not the best colors!) the real curve and the estimated curve are pretty close almost identical sometimes!!

Image

Would it be a good idea to implement an automatic selection method for spectrum_cut? If you agree, I can work on a solution and submit a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions