Skip to content

Commit

Permalink
Merge pull request #15 from UBC-MDS/score_df_docstring
Browse files Browse the repository at this point in the history
adding scoring_df docstring
  • Loading branch information
musiccabin authored Jan 12, 2025
2 parents 2c49a1f + 75c6ad4 commit 8ff709d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ Ready to contribute? Here's how to set up `compare_classifiers` for local develo
2. Install `compare_classifiers` using `poetry`:

```console
$ poetry install
$ poetry install compare_classifiers

```

3. Use `git` (or similar) to create a branch for local development and make your changes:

```console
$ git checkout -b name-of-your-bugfix-or-feature

```

4. When you're done making changes, check that your changes conform to any code formatting requirements and pass any tests.
Expand Down
30 changes: 30 additions & 0 deletions src/compare_classifiers/compare_classifiers/compare_f1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
def compare_f1(estimators, X, y):
"""
Show cross validation results, including fit time and f1 scores for each estimator.
Parameters
----------
estimators : list of tuples
A list of (name, estimator) tuples, consisting of individual estimators to be processed through the voting or stacking classifying ensemble. Each tuple contains a string: name/label of estimator, and a model: the estimator, which implements
the scikit-learn API (`fit`, `predict`, etc.).
X_train : Pandas data frame
Data frame containing training data along with n features.
y_train : Pandas series
Target class labels for data in X_train.
Returns:
--------
Pandas data frame
A data frame showing cross validation results on training data, with 3 columns: fit_time, test_score, train_score and 1 rows for each estimator.
Example:
--------
>>> estimators = [
... ('rf', RandomForestClassifier(n_estimators=10, random_state=42)),
... ('svm', make_pipeline(StandardScaler(), LinearSVC(random_state=42)))
... ]
>>> compare_f1(estimators, X, y)
"""
pass
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def ensemble_compare_f1(estimators, X_train, y_train):
... ('rf', RandomForestClassifier(n_estimators=10, random_state=42)),
... ('svm', make_pipeline(StandardScaler(), LinearSVC(random_state=42)))
... ]
ensemble_compare_f1(estimators, X, y)
>>> ensemble_compare_f1(estimators, X, y)
"""
# ...existing code...

Expand Down

0 comments on commit 8ff709d

Please sign in to comment.