Skip to content

Commit

Permalink
Merge pull request #16 from AutoResearch/15-chore-consistent-default-…
Browse files Browse the repository at this point in the history
…argument-for-num_samples-in-score_sample

chore: change default input argument of score_sample
  • Loading branch information
younesStrittmatter authored Sep 3, 2023
2 parents 6ede48b + f5e4167 commit 52363f2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/autora/experimentalist/model_disagreement/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import itertools
from typing import Iterable, List, Union
from typing import Iterable, List, Union, Optional
import numpy as np
import pandas as pd

from autora.utils.deprecation import deprecated_alias
from sklearn.preprocessing import StandardScaler


def score_sample(conditions: Union[pd.DataFrame, np.ndarray],
models: List,
num_samples: int = 1):
models: List,
num_samples: Optional[int] = None):
"""
A experimentalist that returns selected samples for independent variables
for which the models disagree the most in terms of their predictions.
Expand Down Expand Up @@ -80,7 +81,11 @@ def score_sample(conditions: Union[pd.DataFrame, np.ndarray],
conditions["score"] = score
conditions = conditions.sort_values(by="score", ascending=False)

return conditions.head(num_samples)
if num_samples is None:
return conditions
else:
return conditions.head(num_samples)



def sample(conditions: Union[pd.DataFrame, np.ndarray],
Expand Down

0 comments on commit 52363f2

Please sign in to comment.