Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on May 7, 2026. It is now read-only.

Commit 32e5313

Browse filesBrowse files
authored
docs: fix LogisticRegression docs rendering (#2295)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-bigquery-dataframes/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> 🦕
1 parent da06439 commit 32e5313
Copy full SHA for 32e5313

1 file changed

+31-29Lines changed: 31 additions & 29 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • third_party/bigframes_vendored/sklearn/linear_model
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎third_party/bigframes_vendored/sklearn/linear_model/_logistic.py‎

Copy file name to clipboardExpand all lines: third_party/bigframes_vendored/sklearn/linear_model/_logistic.py
+31-29Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,37 @@
2323
class LogisticRegression(LinearClassifierMixin, BaseEstimator):
2424
"""Logistic Regression (aka logit, MaxEnt) classifier.
2525
26-
>>> from bigframes.ml.linear_model import LogisticRegression
27-
>>> import bigframes.pandas as bpd
28-
>>> X = bpd.DataFrame({ \
29-
"feature0": [20, 21, 19, 18], \
30-
"feature1": [0, 1, 1, 0], \
31-
"feature2": [0.2, 0.3, 0.4, 0.5]})
32-
>>> y = bpd.DataFrame({"outcome": [0, 0, 1, 1]})
33-
>>> # Create the LogisticRegression
34-
>>> model = LogisticRegression()
35-
>>> model.fit(X, y)
36-
LogisticRegression()
37-
>>> model.predict(X) # doctest:+SKIP
38-
predicted_outcome predicted_outcome_probs feature0 feature1 feature2
39-
0 0 [{'label': 1, 'prob': 3.1895929877221615e-07} ... 20 0 0.2
40-
1 0 [{'label': 1, 'prob': 5.662891265051953e-06} ... 21 1 0.3
41-
2 1 [{'label': 1, 'prob': 0.9999917826885262} {'l... 19 1 0.4
42-
3 1 [{'label': 1, 'prob': 0.9999999993659574} {'l... 18 0 0.5
43-
4 rows × 5 columns
44-
45-
[4 rows x 5 columns in total]
46-
47-
>>> # Score the model
48-
>>> score = model.score(X, y)
49-
>>> score # doctest:+SKIP
50-
precision recall accuracy f1_score log_loss roc_auc
51-
0 1.0 1.0 1.0 1.0 0.000004 1.0
52-
1 rows × 6 columns
53-
54-
[1 rows x 6 columns in total]
26+
**Examples:**
27+
28+
>>> from bigframes.ml.linear_model import LogisticRegression
29+
>>> import bigframes.pandas as bpd
30+
>>> X = bpd.DataFrame({ \
31+
"feature0": [20, 21, 19, 18], \
32+
"feature1": [0, 1, 1, 0], \
33+
"feature2": [0.2, 0.3, 0.4, 0.5]})
34+
>>> y = bpd.DataFrame({"outcome": [0, 0, 1, 1]})
35+
>>> # Create the LogisticRegression
36+
>>> model = LogisticRegression()
37+
>>> model.fit(X, y)
38+
LogisticRegression()
39+
>>> model.predict(X) # doctest:+SKIP
40+
predicted_outcome predicted_outcome_probs feature0 feature1 feature2
41+
0 0 [{'label': 1, 'prob': 3.1895929877221615e-07} ... 20 0 0.2
42+
1 0 [{'label': 1, 'prob': 5.662891265051953e-06} ... 21 1 0.3
43+
2 1 [{'label': 1, 'prob': 0.9999917826885262} {'l... 19 1 0.4
44+
3 1 [{'label': 1, 'prob': 0.9999999993659574} {'l... 18 0 0.5
45+
4 rows × 5 columns
46+
47+
[4 rows x 5 columns in total]
48+
49+
>>> # Score the model
50+
>>> score = model.score(X, y)
51+
>>> score # doctest:+SKIP
52+
precision recall accuracy f1_score log_loss roc_auc
53+
0 1.0 1.0 1.0 1.0 0.000004 1.0
54+
1 rows × 6 columns
55+
56+
[1 rows x 6 columns in total]
5557
5658
Args:
5759
optimize_strategy (str, default "auto_strategy"):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.