Skip to content

Commit 596c5a2

Browse files
committed
black and ruff
1 parent 03c4a19 commit 596c5a2

File tree

7 files changed

+61
-2
lines changed

7 files changed

+61
-2
lines changed

pylace/lace/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""The Python bindings for the Lace ML tool."""
22

33
from importlib import metadata
4+
45
from lace import core
56
from lace.codebook import Codebook
67
from lace.core import (
@@ -37,4 +38,4 @@
3738
"ValueMap",
3839
]
3940

40-
__version__ = metadata.version('pylace')
41+
__version__ = metadata.version("pylace")

pylace/lace/analysis.py

+7
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ def held_out_neglogp(
307307
│ ["Apogee_km", "Country_of_Contra… ┆ 2.992173 ┆ 7 │
308308
│ ["Apogee_km", "Class_of_Orbit", … ┆ 3.956759 ┆ 8 │
309309
└───────────────────────────────────┴─────────────────────┴───────────┘
310+
310311
"""
311312
search = (
312313
HoldOutSearchMethod.Greedy if greedy else HoldOutSearchMethod.Enumerate
@@ -420,6 +421,7 @@ def held_out_inconsistency(
420421
│ ["Apogee_km", "Country_of_Contra… ┆ 0.756218 ┆ 7 │
421422
│ ["Apogee_km", "Class_of_Orbit", … ┆ 1.0 ┆ 8 │
422423
└───────────────────────────────────┴───────────────────────────┴───────────┘
424+
423425
"""
424426
search = (
425427
HoldOutSearchMethod.Greedy if greedy else HoldOutSearchMethod.Enumerate
@@ -530,6 +532,7 @@ def held_out_uncertainty(
530532
│ ["Apogee_km", "Country_of_Contra… ┆ 0.077359 ┆ 7 │
531533
│ ["Apogee_km", "Class_of_Orbit", … ┆ 0.089026 ┆ 8 │
532534
└───────────────────────────────────┴─────────────────────────┴───────────┘
535+
533536
"""
534537
search = (
535538
HoldOutSearchMethod.Greedy if greedy else HoldOutSearchMethod.Enumerate
@@ -654,6 +657,7 @@ def attributable_inconsistency(
654657
... ) # doctest: +NORMALIZE_WHITESPACE
655658
>>> frac
656659
0.2930260843667006
660+
657661
"""
658662

659663
return _attributable_holdout(
@@ -727,6 +731,7 @@ def attributable_neglogp(
727731
... ) # doctest: +NORMALIZE_WHITESPACE
728732
>>> frac
729733
0.29302608436670047
734+
730735
"""
731736

732737
return _attributable_holdout(
@@ -797,6 +802,7 @@ def attributable_uncertainty(
797802
... ) # doctest: +NORMALIZE_WHITESPACE
798803
>>> frac
799804
0.1814171785207335
805+
800806
"""
801807

802808
return _attributable_holdout(
@@ -981,6 +987,7 @@ def explain_prediction(
981987
│ Source_Used_for_Orbital_Data ┆ 0.001454 │
982988
│ Inclination_radians ┆ 0.057333 │
983989
└──────────────────────────────┴───────────┘
990+
984991
"""
985992
if method is None:
986993
method = ABLATIVE_ERR

pylace/lace/codebook.py

+11
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class Codebook:
5050
----------
5151
codebook: core.Codebook
5252
A reference to the underlying rust data structure
53+
5354
"""
5455

5556
codebook: _lc.Codebook
@@ -89,6 +90,7 @@ def from_df(
8990
no_hypers: bool, optional
9091
If `True`, disable hyper prior inference. Priors will be derived
9192
from the data and will remain static.
93+
9294
"""
9395

9496
if isinstance(df, pd.DataFrame):
@@ -214,6 +216,7 @@ def column_metadata(self) -> _ColumnMetadataIndexer:
214216
}
215217
>>> codebook.column_names[-5:]
216218
['solitary', 'nestspot', 'domestic', 'number-in-wild', 'scary']
219+
217220
"""
218221
return _ColumnMetadataIndexer(self.codebook)
219222

@@ -228,6 +231,7 @@ def shape(self) -> Tuple[int, int]:
228231
>>> codebook = Animals().codebook
229232
>>> codebook.shape
230233
(50, 85)
234+
231235
"""
232236
return self.codebook.shape
233237

@@ -242,6 +246,7 @@ def row_names(self) -> List[str]:
242246
>>> codebook = Animals().codebook
243247
>>> codebook.row_names[:4]
244248
['antelope', 'grizzly+bear', 'killer+whale', 'beaver']
249+
245250
"""
246251
return self.codebook.row_names
247252

@@ -256,6 +261,7 @@ def column_names(self) -> List[str]:
256261
>>> codebook = Animals().codebook
257262
>>> codebook.column_names[:4]
258263
['black', 'white', 'blue', 'brown']
264+
259265
"""
260266
return self.codebook.column_names
261267

@@ -284,6 +290,7 @@ def rename(self, name: str):
284290
view_alpha_prior: G(α: 1, β: 1)
285291
columns: 85
286292
rows: 50
293+
287294
"""
288295
codebook = copy.copy(self)
289296
codebook.codebook.rename(name)
@@ -318,6 +325,7 @@ def set_state_alpha_prior(self, shape: float = 1.0, rate: float = 1.0):
318325
view_alpha_prior: G(α: 1, β: 1)
319326
columns: 85
320327
rows: 50
328+
321329
"""
322330
codebook = copy.copy(self)
323331
codebook.codebook.set_state_alpha_prior(shape, rate)
@@ -352,6 +360,7 @@ def set_view_alpha_prior(self, shape: float = 1.0, rate: float = 1.0):
352360
view_alpha_prior: G(α: 2, β: 3.1)
353361
columns: 85
354362
rows: 50
363+
355364
"""
356365
codebook = copy.copy(self)
357366
codebook.codebook.set_view_alpha_prior(shape, rate)
@@ -392,6 +401,7 @@ def set_row_names(
392401
>>> new_rows = np.array(["one", "two", "three-hahaha"])
393402
>>> codebook.set_row_names(new_rows).row_names
394403
['one', 'two', 'three-hahaha']
404+
395405
"""
396406
if isinstance(row_names, (pl.Series, pd.Series)):
397407
row_names = row_names.to_list()
@@ -433,6 +443,7 @@ def value_map(self, col: str):
433443
ValueMap (UInt, k=2)
434444
>>> [c for c in vm.values()]
435445
[0, 1]
446+
436447
"""
437448
return self.column_metadata[col].value_map
438449

0 commit comments

Comments
 (0)