zero-one-group / geni

A Clojure dataframe library that runs on Spark
Apache License 2.0
281 stars 28 forks source link

Fix code for Cookbook 11.3 #343

Closed matthewedwarddavidson closed 8 months ago

matthewedwarddavidson commented 1 year ago

The example in part 11.3 did not work for me, it was zipmapping column headers to :size, :indices, :values of feature-importances. There was also an extra closing bracket on the end, maybe for a missing bit of code? The suggested change does what, I think, the example was meant to show.

skylee03 commented 8 months ago

Thanks for pointing this out!

Indeed, our desired result is:

{"housing-median-age" 0.060262475752573055,
 "median-income" 0.7847621702619059,
 "bedrooms-per-house" 0.010547166447551434,
 "population-per-house" 0.14442818753796965}

But the actual result is:

{"housing-median-age" [:size 4],
 "median-income" [:indices (0 1 2 3)],
 "bedrooms-per-house" [:values (0.060262475752573055 0.7847621702619059 0.010547166447551434 0.14442818753796965)]}

Your patch solves this problem.


As for the extra right bracket, I think it was caused by copying the code directly from cookbook-11.clj when writing the docs.

codecov-commenter commented 8 months ago

Codecov Report

Merging #343 (62ea3ad) into develop (b0a8b6b) will not change coverage. The diff coverage is n/a.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/zero-one-group/geni/pull/343/graphs/tree.svg?width=650&height=150&src=pr&token=o9ahpgt4Bh&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zero-one-group)](https://app.codecov.io/gh/zero-one-group/geni/pull/343?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zero-one-group) ```diff @@ Coverage Diff @@ ## develop #343 +/- ## ========================================= Coverage 99.839% 99.839% ========================================= Files 36 36 Lines 3118 3118 Branches 4 4 ========================================= Hits 3113 3113 Misses 1 1 Partials 4 4 ```