Skip to content

Commit

Permalink
New backup 2025-03-04 10:10:44
Browse files Browse the repository at this point in the history
  • Loading branch information
brj0 committed Mar 4, 2025
1 parent 1821b69 commit 094b48e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions examples/rtd_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,12 +821,12 @@
clf_out = methyl_analysis.classify(ids=ids, clf_list="none-kbest-rf")

## Output accuracy scores:
print("Accuracy Scores:", clf_out.metrics["accuracy_scores"])
print("Accuracy Scores:", clf_out[0].metrics["accuracy_scores"])
"""
Accuracy Scores: [1.0, 1.0, 1.0, 1.0, 1.0]
"""
## Detailed classifier report of first sample:
print(clf_out.reports[0])
print(clf_out[0].reports[0])
"""
201530470054_R05C01
===================
Expand Down Expand Up @@ -859,6 +859,7 @@
# Perform prediction on beta values:

## Number of CpGs in the dataset
methyl_analysis.set_betas()
n_cpgs = methyl_analysis.betas_all.shape[1]
## Generate random beta values for 10 artificial samples
random_beta_values = pd.DataFrame(
Expand Down Expand Up @@ -909,7 +910,7 @@
ids = methyl_analysis.idat_handler.ids
clf_out = methyl_analysis.classify(ids=ids, clf_list=rf_clf)

print(clf_out.reports[0])
print(clf_out[0].reports[0])
"""
201530470054_R05C01
===================
Expand Down Expand Up @@ -949,7 +950,7 @@
ids = methyl_analysis.idat_handler.ids
clf_out = methyl_analysis.classify(ids=ids, clf_list=et_clf)

print(clf_out.reports[0])
print(clf_out[0].reports[0])
"""
201530470054_R05C01
===================
Expand Down Expand Up @@ -1000,7 +1001,7 @@ def predict_proba(self, betas, id_=None):
def classes(self):
return self._classes

def info(self):
def info(self, output_format="txt"):
return "This text will be printed in reports."

def metrics(self):
Expand All @@ -1013,7 +1014,7 @@ def metrics(self):
## Perform classification
clf_out = methyl_analysis.classify(ids=ids, clf_list=custom_clf)

print(clf_out.reports[0])
print(clf_out[0].reports[0])
"""
201530470054_R05C01
===================
Expand Down
2 changes: 1 addition & 1 deletion mepylome/analysis/methyl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1789,7 +1789,7 @@ def classify(
Raises:
ValueError: If not exactly one if `ids` or `values` is set.
"""
if sum(bool(x) for x in (ids, values)) != 1:
if sum(x is not None for x in (ids, values)) != 1:
msg = "Provide exactly one of 'ids' or 'values'."
raise ValueError(msg)

Expand Down

0 comments on commit 094b48e

Please sign in to comment.