Skip to content

Commit

Permalink
rec series
Browse files Browse the repository at this point in the history
  • Loading branch information
Caitlyn Chen committed Feb 16, 2021
1 parent 704370b commit 74da4f4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
13 changes: 13 additions & 0 deletions lux/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,16 @@ def on_button_clicked(b):
warnings.warn(traceback.format_exc())
display(self.to_pandas())
return ""

@property
def recommendation(self):
from lux.core.frame import LuxDataFrame

if self.name is None:
self.name = " "
ldf = LuxDataFrame(self)

if self._recommendation is not None and self._recommendation == {}:
ldf.maintain_metadata()
ldf.maintain_recs()
return ldf._recommendation
1 change: 0 additions & 1 deletion tests/test_interestingness.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def test_interestingness_0_1_0(global_var):
):
rank3 = f
assert rank1 < rank2 and rank1 < rank3 and rank2 < rank3


# check that top recommended filter graph score is not none and that ordering makes intuitive sense
assert interestingness(df.recommendation["Filter"][0], df) != None
Expand Down
14 changes: 14 additions & 0 deletions tests/test_vis.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,3 +497,17 @@ def test_matplotlib_heatmap_flag_config():
assert not df.recommendation["Correlation"][0]._postbin
lux.config.heatmap = True
lux.config.plotting_backend = "vegalite"


def test_series_recommendation():
lux.config.plotting_backend = "matplotlib"
df = pd.read_csv("https://raw.githubusercontent.com/lux-org/lux-datasets/master/data/employee.csv")
df.plot_config = None
df = df["YearsAtCompany"] / df["TotalWorkingYears"]
assert len(df.recommendation["Distribution"]) > 0

lux.config.plotting_backend = "vegalite"
df = pd.read_csv("https://raw.githubusercontent.com/lux-org/lux-datasets/master/data/employee.csv")
df.plot_config = None
df = df["YearsAtCompany"] / df["TotalWorkingYears"]
assert len(df.recommendation["Distribution"]) > 0

0 comments on commit 74da4f4

Please sign in to comment.