Skip to content

Commit

Permalink
Standardise variable names in the docs (#338)
Browse files Browse the repository at this point in the history
* selected_columns -> feature_column_names

* change reference and analysis to reference_df and analysis_df

* Merged with main

---------

Co-authored-by: Niels Nuyttens <niels@nannyml.com>
  • Loading branch information
santiviquez and nnansters authored Nov 16, 2023
1 parent 38eaa2a commit 51105c7
Show file tree
Hide file tree
Showing 141 changed files with 92,900 additions and 92,678 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ import pandas as pd
from IPython.display import display

# Load real-world data:
df_reference, df_analysis, _ = nml.load_us_census_ma_employment_data()
display(df_reference.head())
display(df_analysis.head())
reference_df, analysis_df, _ = nml.load_us_census_ma_employment_data()
display(reference_df.head())
display(analysis_df.head())

# Choose a chunker or set a chunk size:
chunk_size = 5000
Expand All @@ -175,8 +175,8 @@ estimator = nml.CBPE(
metrics=['roc_auc'],
chunk_size=chunk_size,
)
estimator = estimator.fit(df_reference)
estimated_performance = estimator.estimate(df_analysis)
estimator = estimator.fit(reference_df)
estimated_performance = estimator.estimate(analysis_df)

# Show results:
figure = estimated_performance.plot()
Expand All @@ -192,8 +192,8 @@ univariate_calculator = nml.UnivariateDriftCalculator(
chunk_size=chunk_size
)

univariate_calculator.fit(df_reference)
univariate_drift = univariate_calculator.calculate(df_analysis)
univariate_calculator.fit(reference_df)
univariate_drift = univariate_calculator.calculate(analysis_df)

# Get features that drift the most with count-based ranker:
alert_count_ranker = nml.AlertCountRanker()
Expand All @@ -214,10 +214,10 @@ figure = univariate_drift.filter(period='analysis', column_names=['RELP','AGEP',
figure.show()

# Get target data, calculate, plot and compare realized performance with estimated performance:
_, _, analysis_targets = nml.load_us_census_ma_employment_data()
_, _, analysis_targets_df = nml.load_us_census_ma_employment_data()

df_analysis_with_targets = pd.concat([df_analysis, analysis_targets], axis=1)
display(df_analysis_with_targets.head())
analysis_with_targets_df = pd.concat([analysis_df, analysis_targets_df], axis=1)
display(analysis_with_targets_df.head())

performance_calculator = nml.PerformanceCalculator(
problem_type='classification_binary',
Expand All @@ -227,8 +227,8 @@ performance_calculator = nml.PerformanceCalculator(
metrics=['roc_auc'],
chunk_size=chunk_size)

performance_calculator.fit(df_reference)
calculated_performance = performance_calculator.calculate(df_analysis_with_targets)
performance_calculator.fit(reference_df)
calculated_performance = performance_calculator.calculate(analysis_with_targets_df)

figure = estimated_performance.filter(period='analysis').compare(calculated_performance).plot()
figure.show()
Expand Down
2 changes: 1 addition & 1 deletion docs/_static/butterfly-multivariate-drift.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12,118 changes: 6,059 additions & 6,059 deletions docs/_static/butterfly-scatterplot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/_static/butterfly-univariate-drift-distributions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14,680 changes: 7,340 additions & 7,340 deletions docs/_static/example_california_latitude_longitude_scatter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/_static/example_california_performance.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 33 additions & 33 deletions docs/_static/example_california_performance_estimation_tmp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/_static/example_green_taxi_all_udc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/_static/example_green_taxi_dle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/_static/example_green_taxi_dle_vs_realized.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 51105c7

Please sign in to comment.