Skip to content

Commit

Permalink
docs: add linear model example (#1235)
Browse files Browse the repository at this point in the history
* docs: add linear model example

* chore: add experimental series.blob.display() function (#1232)

* add an extra setting to set display prgress bar to None

* docs: add KMeans example (#1234)

* docs: add KMeans example

* fix test

* skip non deterministic examples

* docs: add examples for ml PCA and SimpleImputer (#1236)

* docs: add examples for ml PCA and SimpleImputer

* fix

* fix

* fix doctest bug

* add extra lines to fix docs bug

* fix docstring bug

* remove an extra line

---------

Co-authored-by: Shuowei Li <[email protected]>
Co-authored-by: Garrett Wu <[email protected]>
  • Loading branch information
3 people authored Dec 23, 2024
1 parent 50648e4 commit 2c3e1fd
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions third_party/bigframes_vendored/sklearn/linear_model/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,30 @@ class LinearRegression(RegressorMixin, LinearModel):
to minimize the residual sum of squares between the observed targets in
the dataset, and the targets predicted by the linear approximation.
**Examples:**
>>> from bigframes.ml.linear_model import LinearRegression
>>> import bigframes.pandas as bpd
>>> bpd.options.display.progress_bar = None
>>> X = bpd.DataFrame({ \
"feature0": [20, 21, 19, 18], \
"feature1": [0, 1, 1, 0], \
"feature2": [0.2, 0.3, 0.4, 0.5]})
>>> y = bpd.DataFrame({"outcome": [0, 0, 1, 1]})
>>> # Create the linear model
>>> model = LinearRegression()
>>> model.fit(X, y)
LinearRegression()
>>> # Score the model
>>> score = model.score(X, y)
>>> print(score) # doctest:+SKIP
mean_absolute_error mean_squared_error mean_squared_log_error \
0 0.022812 0.000602 0.00035
median_absolute_error r2_score explained_variance
0 0.015077 0.997591 0.997591
Args:
optimize_strategy (str, default "auto_strategy"):
The strategy to train linear regression models. Possible values are
Expand Down

0 comments on commit 2c3e1fd

Please sign in to comment.