Skip to content

Conversation

@luizhsuperti
Copy link

@luizhsuperti luizhsuperti commented Mar 23, 2025

Proposal for Documentation Reorganization

linked issue
I was thinking about reorganizing the documentation to improve clarity and usability. Here’s the proposed structure:

Home (README)

Quickstart (Installation + Package Overview: Splitter, Perturbator, and Analysis classes)
Documentation (APIs, details on classes and methods)
Usage Examples (Notebooks with practical examples)
Contribution (Guidelines for contributing)
In my fork,
👉 [I revamped the README to be more appealing to a broader audience
I also modified the Quickstart section to align with this idea

I’d love your feedback on whether the Quickstart section information is accurate—I’m still new to the package, so there might be some errors in definitions or concepts. (The Python notebooks currently in the docs are safe and should still be included in some form.)

For inspiration, I looked at the documentation structures of:

Ambrosia
pysurvival

Why This Change?

Makes it easier for new users to navigate and understand the package.
Provides a clearer structure for future contributors.
The examples section can be refined over time for better clarity and accuracy.
In the future, we could also add a "Stats 101" section for foundational concepts.
Let me know what you think!

@luizhsuperti
Copy link
Author

Probably is worth to add Experiment analysis scorecards

Copy link
Owner

@david26694 david26694 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @luizhsuperti , thanks for the PR! I've had a quick read, let me know what you think

README.md Outdated
- 🏢 **Cluster randomization**
- 🔄 **Switchback experiments**

### 🛠 **Data Preprocessing**
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove this section, I don't think the pandas integration is very relevant nor there are tools for data preparation in the lib

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see 1st comment

README.md Outdated
- Seamlessly integrates with **Pandas** for streamlined workflows

### 📊 **Comprehensive Experiment Analysis**
##### **✅ Metrics**
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd drop the metrics one for now since it looks like we have a bug (see last issue)

README.md Outdated
- 📌 **Generalized Estimating Equations (GEE)**
- 📌 **Mixed Linear Models** for robust inference
- 📌 **Ordinary Least Squares (OLS)** and **Clustered OLS** with covariates
- 📌 **T-tests** with variance reduction techniques (**CUPED, CUPAC**)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd merge this and the one above, and not mention t-tests since mostly its OLS with covariates, cuped, cupac

README.md Outdated
pip install cluster-experiments
=======
# MDE calculation
mde = npw.mde(df, power=0.8)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the MDE example, I have to asks: needs to be reproducible (so dataframe needs to be created), and show the methods power_analysis, mde, power_line and mde_line. wdyt?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely what we should do. I'm thinking that, for a 1st time user, we should show the MDE calculation process and scorecard. wdyt?
The other question is where this example should be, in Readme (Home) or quickstart.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely what we should do. I'm thinking that, for a 1st time user, we should show the MDE calculation process and scorecard. wdyt?

yes! in the simplest set-up but yes.

The other question is where this example should be, in Readme (Home) or quickstart.

I really think there's value in a reproducible hello-world example in what all the users see, which is the readme

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the variance reduction example can go to quickstart instead of readme

```

!!! info "Python Version Support"
**Cluster Experiments** requires **Python 3.9 or higher**. Make sure your environment meets this requirement before proceeding with the installation.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's 3.8 I think

README.md Outdated
## Quick Start

### Power Analysis Example
**`cluster experiments`** is a comprehensive Python library for end-to-end A/B testing workflows, designed for seamless integration with Pandas in production environments.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

designed for seamless integration with Pandas in production environments.
I'd remove any production mention, I don't think it's fair to call this production. "seamless integration" sounds generated by an LLM, do you have a more natural equivalent?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Finally had time to return. Thank you for the feedback! I'm adding the answers of the other suggestions you made in the Readme file. I modified the following as suggested:

i.I added at the beginning the simulation based / normal approximation support.
ii.For support of complex experimental designs, I kept as it is; I'd keep Variance Reduction Techniques under statistical methods of analysis, to clarify the diff between experimental design and how we evaluate effects.
iii. Deleted t-tests
iv. Deleted metrics
v. Added Scorecards feature, it's a neat feature that it's definitely a plus
vi. Removed pre-processing

vii. Droped the why used it? section (How did you know it was LLM adjusted? :D )

  • the readme section should be already clear with the examples

It's been a while so the pkg got updated let me know of additional changes

Designing and analyzing experiments can feel overwhelming at times. After formulating a testable hypothesis,
you're faced with a series of routine tasks. From collecting and transforming raw data to measuring the statistical significance of your experiment results and constructing confidence intervals,
it can quickly become a repetitive and error-prone process.
*Cluster Experiments* is here to change that. Built on top of well-known packages like `pandas`, `numpy`, `scipy` and `statsmodels`, it automates the core steps of an experiment, streamlining your workflow, saving you time and effort, while maintaining statistical rigor.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd make the paragraph shorter and stress what it automates: being MDE/power calculation and inference scorecards

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given the next examples, I think it's worth mentioning that you're describing the simulaiton-based power analysis, and there are other pipelines like power analysis based on normal approximation and scorecard generation

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the explanation style, maybe you could write a similar thing for NormalPowerAnalysis and AnalysisPlan

```python
from cluster_experiments import TTestClusteredAnalysis

analysis = TTestClusteredAnalysis(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use ClusteredOLS, I think this analysis method is a bit weird

@david26694 david26694 linked an issue Mar 26, 2025 that may be closed by this pull request
@david26694
Copy link
Owner

Hey @luizhsuperti, I was playing with this and found an issue, all examples are under switchback, whenever you can have a look please :)
imagen

Copy link
Author

@luizhsuperti luizhsuperti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Added comments on the suggestions in the Review doc. After that I'm jumping in the QuickStart and finally in the Examples we should have in the pkg

README.md Outdated
## Quick Start

### Power Analysis Example
**`cluster experiments`** is a comprehensive Python library for end-to-end A/B testing workflows, designed for seamless integration with Pandas in production environments.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Finally had time to return. Thank you for the feedback! I'm adding the answers of the other suggestions you made in the Readme file. I modified the following as suggested:

i.I added at the beginning the simulation based / normal approximation support.
ii.For support of complex experimental designs, I kept as it is; I'd keep Variance Reduction Techniques under statistical methods of analysis, to clarify the diff between experimental design and how we evaluate effects.
iii. Deleted t-tests
iv. Deleted metrics
v. Added Scorecards feature, it's a neat feature that it's definitely a plus
vi. Removed pre-processing

vii. Droped the why used it? section (How did you know it was LLM adjusted? :D )

  • the readme section should be already clear with the examples

It's been a while so the pkg got updated let me know of additional changes

README.md Outdated
- 🏢 **Cluster randomization**
- 🔄 **Switchback experiments**

### 🛠 **Data Preprocessing**
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see 1st comment

README.md Outdated
pip install cluster-experiments
=======
# MDE calculation
mde = npw.mde(df, power=0.8)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely what we should do. I'm thinking that, for a 1st time user, we should show the MDE calculation process and scorecard. wdyt?
The other question is where this example should be, in Readme (Home) or quickstart.

@david26694
Copy link
Owner

thanks @luizhsuperti , I'll have a look later! be careful with the conflict of mkdocs.yml, you'll need to resolve them

Copy link
Owner

@david26694 david26694 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asked for a general iteration. Keep in mind about the conflicts with main branch!

README.md Outdated
power_line_normal = npw.power_line(df, average_effects=[0.1, 0.2, 0.3])
### 📌 Experiment Design & Planning
- **Power analysis** and **Minimal Detectable Effect (MDE)** estimation
- **Normal Approximation (CLT-based)**: Fast, analytical formulas assuming approximate normality
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to add more spaces to render inside of the above, or asterisks

Uploading image.png…

README.md Outdated
- **Normal Approximation (CLT-based)**: Fast, analytical formulas assuming approximate normality
- Best for large sample sizes and standard A/B tests
- **Monte Carlo Simulation**: Empirically estimate power or MDE by simulating many experiments
- Ideal for complex or non-standard designs (e.g., clustering, non-normal outcomes)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Ideal for complex or non-standard designs (e.g., clustering, non-normal outcomes)
- Ideal for complex or non-standard designs (e.g., small samples, complex effect distribution)

README.md Outdated

`cluster experiments` empowers analysts and data scientists with **scalable, reproducible, and statistically robust** A/B testing workflows.

🔗 **Get Started:** [Documentation Link]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing a link?

README.md Outdated
pip install cluster-experiments
=======
# MDE calculation
mde = npw.mde(df, power=0.8)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely what we should do. I'm thinking that, for a 1st time user, we should show the MDE calculation process and scorecard. wdyt?

yes! in the simplest set-up but yes.

The other question is where this example should be, in Readme (Home) or quickstart.

I really think there's value in a reproducible hello-world example in what all the users see, which is the readme

README.md Outdated
pip install cluster-experiments
=======
# MDE calculation
mde = npw.mde(df, power=0.8)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the variance reduction example can go to quickstart instead of readme

mkdocs.yml Outdated
- Dimension: api/dimension.md
- Hypothesis Test: api/hypothesis_test.md
- Analysis Plan: api/analysis_plan.md
- Home: ../README.md
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

not found, let's revert to index.md


You can install **Cluster Experiments** via pip:

```bash
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend adding simpler examples, like dictionary-based inputs in the quickstart. Not saying that we should remove what we have, but I'd also add the simplest use of the library

mkdocs.yml Outdated
- Pre experiment outcome model: api/cupac_model.md
- Power config: api/power_config.md
- Power analysis: api/power_analysis.md
- Washover: api/washover.md
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this move into switchback?

mkdocs.yml Outdated
- Power config: api/power_config.md
- Power analysis: api/power_analysis.md
- Washover: api/washover.md
- Metric: api/metric.md
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you group all of these into experiment analysis?

mkdocs.yml Outdated
- Synthetic control: synthetic_control.ipynb
- Delta Method Analysis: delta_method.ipynb
- Experiment analysis workflow: experiment_analysis.ipynb
- Contribute:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either we create this docs or we remove this, right?

@luizhsuperti
Copy link
Author

@david26694 changed readme and quickstart (it's in .md, but maybe a notebook is better?) notebooks are in the docs but maybe should move to docs/examples and then we rework them there.

Reformulate the home and quickstart, as well as the examples and API reference (Examples will probably need to be evaluated case by case)
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.51%. Comparing base (ca58612) to head (601ec18).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #232   +/-   ##
=======================================
  Coverage   96.51%   96.51%           
=======================================
  Files          17       17           
  Lines        1809     1809           
=======================================
  Hits         1746     1746           
  Misses         63       63           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Owner

@david26694 david26694 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks good, requested some last changes

- Hypothesis Test: api/hypothesis_test.md
- Analysis Plan: api/analysis_plan.md

- Contributing: CONTRIBUTING.md
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when executing in local, found a broken link in here

- **Power Analysis & Sample Size Calculation**
- Simulation-based (Monte Carlo) for any design complexity
- Analytical, (CLT-based) for standard designs
- Minimal Detectable Effect (MDE) estimation
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Minimal Detectable Effect (MDE) estimation
- Minimum Detectable Effect (MDE) estimation


print(power, power_line_normal, power_normal, mde, mde_timeline)
### **Experiment Design**
- **Power Analysis & Sample Size Calculation**
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not rendering well, it's just highlighting, I think you need more line breaks


- **Variance Reduction Techniques**
- CUPED (Controlled-experiment Using Pre-Experiment Data)
- CUPAC (CUPED with Pre-experiment Aggregations)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CUPAC is Control Using Predictions As Covariates

)
print(power_curve)
# Tip: You can plot this using matplotlib:
# plt.plot(power_curve['average_effect'], power_curve['power'])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps you can do it without matplotlib, like power_curve.plot(), would that work and have less dependencies?

historical_data,
average_effects=[2.0, 4.0, 6.0, 8.0, 10.0]
)
print(power_curve)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you print with less decimals?


```python
analysis_plan = AnalysisPlan.from_metrics_dict({
'metrics': [...],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are your thoughts on having code that will run in here? perhaps more verbose but better if user needs to copy/paste


### 2.1. MDE

Calculate the Minimum Detectable Effect (MDE) for a given sample size ($), $/alpha$ and $\beta$. parameters.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alpha and beta are not rendering well

})

mde = power_analysis.mde(historical_data, power=0.8)
print(f"Minimum Detectable Effect: {mde}")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wdyt about less decimals?


```python
power = power_analysis.power_analysis(historical_data, average_effect=3.5)
print(f"Power: {power}")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wdyt about less decimals?

@david26694
Copy link
Owner

another thing: let's add all your .md files in test_docs.py, this way we have tests for more docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reorg docs

3 participants