Skip to content

Commit

Permalink
build based on 7b3b12c
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Jun 6, 2024
1 parent b2becc1 commit 1b50ea5
Show file tree
Hide file tree
Showing 289 changed files with 823 additions and 637 deletions.
2 changes: 1 addition & 1 deletion dev/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.3","generation_timestamp":"2024-05-22T04:53:38","documenter_version":"1.4.1"}}
{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-06-06T02:27:12","documenter_version":"1.4.1"}}
4 changes: 2 additions & 2 deletions dev/about_mlj/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/acceleration_and_parallelism/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/adding_models_for_general_use/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/api/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/benchmarking/index.html

Large diffs are not rendered by default.

72 changes: 37 additions & 35 deletions dev/common_mlj_workflows/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/composing_models/index.html

Large diffs are not rendered by default.

38 changes: 20 additions & 18 deletions dev/controlling_iterative_models/index.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dev/correcting_class_imbalance/index.html

Large diffs are not rendered by default.

54 changes: 27 additions & 27 deletions dev/evaluating_model_performance/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/frequently_asked_questions/index.html

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions dev/generating_synthetic_data/index.html

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions dev/getting_started/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/glossary/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/homogeneous_ensembles/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/internals/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/learning_curves/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/learning_mlj/index.html

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions dev/learning_networks/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/linear_pipelines/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/list_of_supported_models/index.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dev/loading_model_code/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/logging_workflows/index.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions dev/machines/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/mlj_cheatsheet/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/model_browser/index.html

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions dev/model_search/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/model_stacking/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/models/ABODDetector_OutlierDetectionNeighbors/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/models/ABODDetector_OutlierDetectionPython/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/models/ARDRegressor_MLJScikitLearnInterface/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/models/AdaBoostStumpClassifier_DecisionTree/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/models/AutoEncoder_BetaML/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/models/BM25Transformer_MLJText/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions dev/models/BalancedBaggingClassifier_MLJBalancing/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>BalancedBaggingClassifier · MLJ</title><meta name="title" content="BalancedBaggingClassifier · MLJ"/><meta property="og:title" content="BalancedBaggingClassifier · MLJ"/><meta property="twitter:title" content="BalancedBaggingClassifier · MLJ"/><meta name="description" content="Documentation for MLJ."/><meta property="og:description" content="Documentation for MLJ."/><meta property="twitter:description" content="Documentation for MLJ."/><script data-outdated-warner src="../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../../assets/documenter.js"></script><script src="../../search_index.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../../"><img src="../../assets/logo.svg" alt="MLJ logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../../">MLJ</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../../">Home</a></li><li><a class="tocitem" href="../../model_browser/">Model Browser</a></li><li><a class="tocitem" href="../../about_mlj/">About MLJ</a></li><li><a class="tocitem" href="../../learning_mlj/">Learning MLJ</a></li><li><span class="tocitem">Basics</span><ul><li><a class="tocitem" href="../../getting_started/">Getting Started</a></li><li><a class="tocitem" href="../../common_mlj_workflows/">Common MLJ Workflows</a></li><li><a class="tocitem" href="../../machines/">Machines</a></li><li><a class="tocitem" href="../../mlj_cheatsheet/">MLJ Cheatsheet</a></li></ul></li><li><span class="tocitem">Data</span><ul><li><a class="tocitem" href="../../working_with_categorical_data/">Working with Categorical Data</a></li><li><a class="tocitem" href="../../preparing_data/">Preparing Data</a></li><li><a class="tocitem" href="../../generating_synthetic_data/">Generating Synthetic Data</a></li><li><a class="tocitem" href="../../openml_integration/">OpenML Integration</a></li></ul></li><li><span class="tocitem">Model Basics</span><ul><li><a class="tocitem" href="../../model_search/">Model Search</a></li><li><a class="tocitem" href="../../loading_model_code/">Loading Model Code</a></li><li><a class="tocitem" href="../../transformers/">Transformers and Other Unsupervised models</a></li><li><a class="tocitem" href="../../list_of_supported_models/">List of Supported Models</a></li></ul></li><li><span class="tocitem">Meta-algorithms</span><ul><li><a class="tocitem" href="../../evaluating_model_performance/">Evaluating Model Performance</a></li><li><a class="tocitem" href="../../tuning_models/">Tuning Models</a></li><li><a class="tocitem" href="../../learning_curves/">Learning Curves</a></li><li><a class="tocitem" href="../../controlling_iterative_models/">Controlling Iterative Models</a></li><li><a class="tocitem" href="../../correcting_class_imbalance/">Correcting Class Imbalance</a></li><li><a class="tocitem" href="../../thresholding_probabilistic_predictors/">Thresholding Probabilistic Predictors</a></li><li><a class="tocitem" href="../../target_transformations/">Target Transformations</a></li><li><a class="tocitem" href="../../homogeneous_ensembles/">Homogeneous Ensembles</a></li></ul></li><li><span class="tocitem">Model Composition</span><ul><li><a class="tocitem" href="../../composing_models/">Composing Models</a></li><li><a class="tocitem" href="../../linear_pipelines/">Linear Pipelines</a></li><li><a class="tocitem" href="../../model_stacking/">Model Stacking</a></li><li><a class="tocitem" href="../../learning_networks/">Learning Networks</a></li></ul></li><li><span class="tocitem">Third Party Tools</span><ul><li><a class="tocitem" href="../../logging_workflows/">Logging Workflows using MLflow</a></li><li><a class="tocitem" href="../../third_party_packages/">Third Party Packages</a></li></ul></li><li><span class="tocitem">Customization and Extension</span><ul><li><a class="tocitem" href="../../simple_user_defined_models/">Simple User Defined Models</a></li><li><a class="tocitem" href="../../quick_start_guide_to_adding_models/">Quick-Start Guide to Adding Models</a></li><li><a class="tocitem" href="../../adding_models_for_general_use/">Adding Models for General Use</a></li><li><a class="tocitem" href="../../modifying_behavior/">Modifying Behavior</a></li><li><a class="tocitem" href="../../internals/">Internals</a></li></ul></li><li><span class="tocitem">Miscellaneous</span><ul><li><a class="tocitem" href="../../performance_measures/">Performance Measures</a></li><li><a class="tocitem" href="../../weights/">Weights</a></li><li><a class="tocitem" href="../../acceleration_and_parallelism/">Acceleration and Parallelism</a></li><li><a class="tocitem" href="../../glossary/">Glossary</a></li><li><a class="tocitem" href="../../frequently_asked_questions/">FAQ</a></li></ul></li><li><a class="tocitem" href="../../api/">Index of Methods</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>BalancedBaggingClassifier</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>BalancedBaggingClassifier</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/JuliaAI/MLJ.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/JuliaAI/MLJ.jl/blob/dev/docs/src/models/BalancedBaggingClassifier_MLJBalancing.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="BalancedBaggingClassifier_MLJBalancing"><a class="docs-heading-anchor" href="#BalancedBaggingClassifier_MLJBalancing">BalancedBaggingClassifier</a><a id="BalancedBaggingClassifier_MLJBalancing-1"></a><a class="docs-heading-anchor-permalink" href="#BalancedBaggingClassifier_MLJBalancing" title="Permalink"></a></h1><pre><code class="nohighlight hljs">BalancedBaggingClassifier</code></pre><p>A model type for constructing a balanced bagging classifier, based on <a href="https://github.com/JuliaAI/MLJBalancing">MLJBalancing.jl</a>.</p><p>From MLJ, the type can be imported using</p><p><code>BalancedBaggingClassifier = @load BalancedBaggingClassifier pkg=MLJBalancing</code></p><p>Construct an instance with default hyper-parameters using the syntax <code>bagging_model = BalancedBaggingClassifier(model=...)</code></p><p>Given a probablistic classifier.<code>BalancedBaggingClassifier</code> performs bagging by undersampling only majority data in each bag so that its includes as much samples as in the minority data. This is proposed with an Adaboost classifier where the output scores are averaged in the paper Xu-Ying Liu, Jianxin Wu, &amp; Zhi-Hua Zhou. (2009). Exploratory Undersampling for Class-Imbalance Learning. IEEE Transactions on Systems, Man, and Cybernetics, Part B (Cybernetics), 39 (2), 539–5501</p><h2 id="Training-data"><a class="docs-heading-anchor" href="#Training-data">Training data</a><a id="Training-data-1"></a><a class="docs-heading-anchor-permalink" href="#Training-data" title="Permalink"></a></h2><p>In MLJ or MLJBase, bind an instance <code>model</code> to data with</p><pre><code class="nohighlight hljs">mach = machine(model, X, y)</code></pre><p>where</p><ul><li><code>X</code>: input features of a form supported by the <code>model</code> being wrapped (typically a table, e.g., <code>DataFrame</code>, with <code>Continuous</code> columns will be supported, as a minimum)</li><li><code>y</code>: the binary target, which can be any <code>AbstractVector</code> where <code>length(unique(y)) == 2</code></li></ul><p>Train the machine with <code>fit!(mach, rows=...)</code>.</p><h2 id="Hyperparameters"><a class="docs-heading-anchor" href="#Hyperparameters">Hyperparameters</a><a id="Hyperparameters-1"></a><a class="docs-heading-anchor-permalink" href="#Hyperparameters" title="Permalink"></a></h2><ul><li><code>model::Probabilistic</code>: The classifier to use to train on each bag.</li><li><code>T::Integer=0</code>: The number of bags to be used in the ensemble. If not given, will be set as the ratio between the frequency of the majority and minority classes. Can be later found in <code>report(mach)</code>.</li><li><code>rng::Union{AbstractRNG, Integer}=default_rng()</code>: Either an <code>AbstractRNG</code> object or an <code>Integer</code> seed to be used with <code>Xoshiro</code> if Julia <code>VERSION&gt;=1.7</code>. Otherwise, uses MersenneTwister`.</li></ul><h2 id="Operations"><a class="docs-heading-anchor" href="#Operations">Operations</a><a id="Operations-1"></a><a class="docs-heading-anchor-permalink" href="#Operations" title="Permalink"></a></h2><ul><li><code>predict(mach, Xnew)</code>: return predictions of the target given</li></ul><p>features <code>Xnew</code> having the same scitype as <code>X</code> above. Predictions are probabilistic, but uncalibrated.</p><ul><li><code>predict_mode(mach, Xnew)</code>: return the mode of each prediction above</li></ul><h2 id="Example"><a class="docs-heading-anchor" href="#Example">Example</a><a id="Example-1"></a><a class="docs-heading-anchor-permalink" href="#Example" title="Permalink"></a></h2><pre><code class="language-julia hljs">using MLJ
using Imbalance

## Load base classifier and BalancedBaggingClassifier
BalancedBaggingClassifier = @load BalancedBaggingClassifier pkg=MLJBalancing
LogisticClassifier = @load LogisticClassifier pkg=MLJLinearModels verbosity=0

## Construct the base classifier and use it to construct a BalancedBaggingClassifier
logistic_model = LogisticClassifier()
model = BalancedBaggingClassifier(model=logistic_model, T=5)

## Load the data and train the BalancedBaggingClassifier
X, y = Imbalance.generate_imbalanced_data(100, 5; num_vals_per_category = [3, 2],
class_probs = [0.9, 0.1],
type = &quot;ColTable&quot;,
rng=42)
julia&gt; Imbalance.checkbalance(y)
1: ▇▇▇▇▇▇▇▇▇▇ 16 (19.0%)
0: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 84 (100.0%)

mach = machine(model, X, y) |&gt; fit!

## Predict using the trained model

yhat = predict(mach, X) ## probabilistic predictions
predict_mode(mach, X) ## point predictions</code></pre></article><nav class="docs-footer"><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.4.1 on <span class="colophon-date" title="Thursday 6 June 2024 02:27">Thursday 6 June 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit 1b50ea5

Please sign in to comment.