Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions ctgan/synthesizers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,13 @@ def __setstate__(self, state):
state['random_states'] = (current_numpy_state, current_torch_state)

self.__dict__ = state
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# Prioritize CUDA if available, then MPSCUDA, finally CPU
if torch.cuda.is_available():
device = torch.device('cuda:0')
elif torch.backends.mps.is_available():
device = torch.device('mps')
else:
device = torch.device('cpu')
self.set_device(device)

def save(self, path):
Expand All @@ -118,11 +124,33 @@ def save(self, path):
@classmethod
def load(cls, path):
"""Load the model stored in the passed `path`."""
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# Prioritize CUDA if available, then MPS, finally CPU
if torch.cuda.is_available():
device = torch.device('cuda:0')
elif torch.backends.mps.is_available():
device = torch.device('mps')
else:
device = torch.device('cpu')
model = torch.load(path)
model.set_device(device)
return model

def set_device(self, device):
"""Set the `device` to be used ('GPU' or 'CPU')."""
self._device = device
if device.type == 'cuda':
# For CUDA, move the generator to the appropriate device
if self._generator is not None:
self._generator.to(self._device)
elif device.type == 'mps':
# For MPS, move module parameters and buffers to the MPS device
if self._generator is not None:
self._generator.to(self._device)
for parameter in self._generator.parameters():
parameter.data = parameter.data.to(self._device)
for buffer in self._generator.buffers():
buffer.data = buffer.data.to(self._device)

def set_random_state(self, random_state):
"""Set the random state.

Expand All @@ -148,4 +176,4 @@ def set_random_state(self, random_state):
raise TypeError(
f'`random_state` {random_state} expected to be an int or a tuple of '
'(`np.random.RandomState`, `torch.Generator`)'
)
)
13 changes: 11 additions & 2 deletions ctgan/synthesizers/ctgan.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ class CTGAN(BaseSynthesizer):
Whether to attempt to use cuda for GPU computation.
If this is False or CUDA is not available, CPU will be used.
Defaults to ``True``.
mps (bool):
Whether to attempt to use mps for GPU computation.
If this is False or MPS is not available, CPU will be used.
Defaults to ``False``.
"""

def __init__(
Expand All @@ -160,6 +164,7 @@ def __init__(
epochs=300,
pac=10,
cuda=True,
mps=False,
):
assert batch_size % 2 == 0

Expand All @@ -179,12 +184,16 @@ def __init__(
self._epochs = epochs
self.pac = pac

if not cuda or not torch.cuda.is_available():
if not cuda and not mps:
device = 'cpu'
elif mps and torch.backends.mps.is_available():
device = 'mps'
elif cuda and torch.cuda.is_available():
device = 'cuda'
elif isinstance(cuda, str):
device = cuda
else:
device = 'cuda'
device = 'cpu'

self._device = torch.device(device)

Expand Down
292 changes: 292 additions & 0 deletions gpdoc/DEA Differential Privacy ROI Report for COBI Use Case.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,292 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>DEA Differential Privacy ROI Report for COBI Use Case</title>

<style>

* { box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.6;
color: #1a1a1a;
background: #ffffff;
margin: 0;
padding: 0;
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 1.5em;
margin-bottom: 0.5em;
font-weight: 600;
line-height: 1.3;
color: #111111;
page-break-after: avoid;
}
h1 { font-size: 1.75em; border-bottom: 1px solid #d0d7de; padding-bottom: 0.3em; }
h2 { font-size: 1.5em; border-bottom: 1px solid #d0d7de; padding-bottom: 0.3em; }
h3 { font-size: 1.25em; }
p { margin: 0.8em 0; }
a { color: #0969da; text-decoration: none; }
code {
font-family: 'SF Mono', Menlo, Monaco, 'Courier New', monospace;
font-size: 0.9em;
background: #f6f8fa;
padding: 0.2em 0.4em;
border-radius: 4px;
}
pre {
background: #f6f8fa;
border: 1px solid #d0d7de;
border-radius: 8px;
padding: 12px 16px;
overflow-x: auto;
page-break-inside: avoid;
}
pre code {
background: none;
padding: 0;
}
blockquote {
margin: 1em 0;
padding: 0.5em 1em;
border-left: 4px solid #0969da;
background: #f6f8fa;
color: #656d76;
}
table {
border-collapse: collapse;
width: 100%;
margin: 1em 0;
page-break-inside: avoid;
}
th, td {
border: 1px solid #d0d7de;
padding: 8px 12px;
text-align: left;
}
th {
background: #f6f8fa;
font-weight: 600;
}
img {
max-width: 100%;
height: auto;
border-radius: 4px;
page-break-inside: avoid;
}
hr {
border: none;
border-top: 1px solid #d0d7de;
margin: 2em 0;
}
ul, ol { padding-left: 1.5em; }
li { margin: 0.25em 0; }


.gpdoc-embed {
border: 1px solid #d0d7de;
border-radius: 12px;
background: #ffffff;
margin: 1.25em 0;
overflow: hidden;
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
page-break-inside: avoid;
}
.gpdoc-embed-frame-wrapper {
background: #f6f8fa;
overflow-y: auto;
overflow-x: hidden;
}
.gpdoc-embed-frame {
padding: 14px 16px;
}
.gpdoc-embed .gpdoc-embed-frame h1:first-child,
.gpdoc-embed .gpdoc-embed-frame h2:first-child,
.gpdoc-embed .gpdoc-embed-frame h3:first-child {
margin-top: 0;
}
.gpdoc-embed-slide + .gpdoc-embed-slide {
margin-top: 14px;
padding-top: 14px;
border-top: 1px solid #d0d7de;
}
.gpdoc-embed-footer {
border-top: 1px solid #d0d7de;
padding: 8px 12px;
text-align: right;
font-size: 12px;
font-weight: 600;
color: #0969da;
background: #ffffff;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.gpdoc-embed-error {
border-style: dashed;
}
.gpdoc-embed-error-body {
padding: 12px 14px;
color: #656d76;
}
.gpdoc-embed-error-body p {
margin: 0.4em 0 0;
white-space: pre-wrap;
}
.mermaid {
margin: 1em 0;
overflow-x: auto;
border: 1px solid #d0d7de;
border-radius: 8px;
background: #f6f8fa;
padding: 8px;
page-break-inside: avoid;
}
.mermaid svg {
max-width: 100%;
height: auto;
display: block;
margin: 0 auto;
}
.mermaid-error {
background: #f6f8fa;
border: 1px solid #d0d7de;
border-radius: 8px;
padding: 12px;
color: #656d76;
font-family: 'SF Mono', Menlo, Monaco, 'Courier New', monospace;
white-space: pre-wrap;
overflow-wrap: anywhere;
}

.document-container { max-width: 100%; padding: 0 16px; }
.prose { font-size: 1em; line-height: 1.75; }
.prose h1 { font-size: 2em; margin-top: 0; }
.prose h2 { font-size: 1.6em; }
.prose h3 { font-size: 1.3em; }
@page { margin: 0.75in; size: letter; }
</style>

<script defer src="https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
if (!document.querySelector('.mermaid')) return;
var root = window.mermaid;
var mermaidApi = root && typeof root.initialize === 'function'
? root
: (root && root.default && typeof root.default.initialize === 'function' ? root.default : null);
if (!mermaidApi) return;
mermaidApi.initialize({
startOnLoad: true,
securityLevel: 'loose',
theme: 'default',
});
if (typeof mermaidApi.run === 'function') {
Promise.resolve(mermaidApi.run({ querySelector: '.mermaid' })).catch(function () {});
}
});
</script>


</head>
<body>
<div class="document-container prose"><h1>DEA Differential Privacy ROI Report for COBI Use Case</h1>
<h2>Introduction to COBI</h2>
<p>Commercial Business Intelligence (COBI) is Capital One&#39;s proprietary analytics platform designed to provide Commercial clients with actionable insights derived from consumer credit card transaction data. COBI helps businesses understand customer behavior, industry spending trends, brand wallet share, and macroeconomic modeling. By leveraging Capital One&#39;s extensive and unique transaction dataset, COBI delivers differentiated insights that position the bank as a strategic advisor and enhance client relationships significantly.</p>
<h2>Importance and Strategic Value of COBI</h2>
<p>COBI addresses critical business needs by enabling Capital One to:</p>
<ul>
<li><p>Offer unique, actionable insights not available from competitors.</p>
</li>
<li><p>Enhance client relationships and loyalty by providing differentiated, value-added analytics.</p>
</li>
<li><p>Support informed decision-making, fostering better outcomes across commercial sectors such as corporate banking, real estate, and broader market analytics.</p>
</li>
</ul>
<h2>Business Values Delivered by Differential Privacy (DP)</h2>
<ul>
<li><p>Enhanced Data Utility: Differential privacy techniques unlock detailed demographic insights safely, expanding analytical granularity significantly.</p>
</li>
<li><p>Competitive Advantage: Secure integration of sensitive demographic data, third-party data, and market insights strengthens Capital One&#39;s position relative to competitors who rely on less sophisticated anonymization methods.</p>
</li>
<li><p>Improved Decision Making: More precise, privacy-compliant insights drive superior business strategies, enabling targeted marketing, customer acquisition, and client retention.</p>
</li>
</ul>
<h2>Problems Solved by Differential Privacy</h2>
<ul>
<li><p>Privacy and Compliance Risks: Addresses significant gaps in COBI&#39;s original anonymization controls, reducing the likelihood of non-compliance with GDPR, CCPA, FCRA, and other privacy laws.</p>
</li>
<li><p>Data Sharing Restrictions: DP solves restrictions posed by traditional anonymization, allowing Capital One to use richer and more granular datasets.</p>
</li>
<li><p>Consumer Consent Management: Systematizes consent verification, ensuring that data use aligns strictly with consumer expectations and regulatory standards.</p>
</li>
</ul>
<h2>Key Risks Mitigated</h2>
<ul>
<li><p>Re-identification Risks: Differential privacy mathematically ensures that individual identities remain protected, effectively mitigating internal and external re-identification threats.</p>
</li>
<li><p>Regulatory Non-Compliance: Resolves existing ambiguities around aggregation and consent management, ensuring robust compliance.</p>
</li>
<li><p>Reputational Damage: Reduces the risk of privacy breaches significantly, thereby safeguarding Capital One&#39;s reputation and customer trust.</p>
</li>
</ul>
<h2>Quantitative ROI Analysis</h2>
<ul>
<li><p>Risk Avoidance Savings: Differential privacy implementation conservatively mitigates annual risks exceeding $10 million associated with potential fines, litigation, and reputational damage.</p>
</li>
<li><p>Increased Revenue from Enhanced Analytics: COBI&#39;s DP-enabled analytics project incremental revenue uplift ranging from 5-7% annually.</p>
</li>
<li><p>Operational Efficiency: Estimated annual operational savings of approximately $2 million through reduced manual processes and streamlined privacy governance.</p>
</li>
</ul>
<h3>ROI Calculation</h3>
<table>
<thead>
<tr>
<th>ROI Component</th>
<th>Annual Financial Impact</th>
</tr>
</thead>
<tbody><tr>
<td>Risk Avoidance (Fines/Compliance)</td>
<td>$10M+</td>
</tr>
<tr>
<td>Revenue Growth (Enhanced Insights)</td>
<td>5-7% incremental uplift</td>
</tr>
<tr>
<td>Operational Cost Savings</td>
<td>$2M</td>
</tr>
<tr>
<td>Total Estimated Annual ROI</td>
<td>$12M+ plus revenue uplift</td>
</tr>
</tbody></table>
<h2>Supporting Data and Evidence</h2>
<ul>
<li><p>Industry Benchmarks: Organizations like Visa, Mastercard, and fintech firms report substantial financial and competitive gains from DP investments.</p>
</li>
<li><p>Internal Pilot Results: COBI pilots utilizing DP have demonstrated a 30% increase in data granularity without compromising privacy.</p>
</li>
<li><p>Client Testimonials: Positive client feedback confirms differentiated value delivered through DP-enabled insights.</p>
</li>
</ul>
<h2>Future Expansion Opportunities</h2>
<ul>
<li><p>DP&#39;s success with COBI validates further applications in consumer banking, credit decisioning, fraud detection, and strategic market analysis.</p>
</li>
<li><p>Additional implementations promise cumulative benefits across Capital One&#39;s enterprise data capabilities.</p>
</li>
</ul>
<h2>Conclusion</h2>
<p>Deploying differential privacy within COBI delivers substantial, quantifiable returns, mitigates critical privacy and compliance risks, and positions Capital One as an industry leader in secure and innovative commercial data analytics. Continued investment in DP technology is recommended to fully leverage its comprehensive benefits and maintain competitive differentiation.</p>
</div>
</body>
</html>
Loading