forked from nogibjj/mlops-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create sklearn hello world example for Issue nogibjj#9
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
sk-learn hello world demo | ||
""" | ||
from sklearn import linear_model | ||
|
||
def linearRegression(X, y, sample_weight=None): | ||
""" | ||
Lineaer Regresssion based on sklearn | ||
Parameters | ||
---------- | ||
X : {array-like, sparse matrix} of shape (n_samples, n_features) | ||
Training data. | ||
y : array-like of shape (n_samples,) or (n_samples, n_targets) | ||
Target values. Will be cast to X's dtype if necessary. | ||
sample_weight : array-like of shape (n_samples,), default=None | ||
Individual weights for each sample. | ||
.. versionadded:: 0.17 | ||
parameter *sample_weight* support to LinearRegression. | ||
Returns | ||
------- | ||
self : object | ||
Fitted Estimator. | ||
""" | ||
reg = linear_model.LinearRegression() | ||
reg.fit(X, y, sample_weight) | ||
return reg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters