{"id":17331912,"url":"https://github.com/ocramz/record-encode","last_synced_at":"2025-04-14T18:05:18.709Z","repository":{"id":56876293,"uuid":"143676531","full_name":"ocramz/record-encode","owner":"ocramz","description":"Generic encoding of record types","archived":false,"fork":false,"pushed_at":"2019-01-27T20:08:55.000Z","size":40,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-14T18:04:54.731Z","etag":null,"topics":["categorical-data","categorical-features","data-analysis","data-mining","data-science","generic-programming","machine-learning","one-hot-encode","preprocessing"],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ocramz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-06T04:29:29.000Z","updated_at":"2019-12-05T06:36:26.000Z","dependencies_parsed_at":"2022-08-20T23:10:26.251Z","dependency_job_id":null,"html_url":"https://github.com/ocramz/record-encode","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocramz%2Frecord-encode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocramz%2Frecord-encode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocramz%2Frecord-encode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocramz%2Frecord-encode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ocramz","download_url":"https://codeload.github.com/ocramz/record-encode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248933341,"owners_count":21185460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["categorical-data","categorical-features","data-analysis","data-mining","data-science","generic-programming","machine-learning","one-hot-encode","preprocessing"],"created_at":"2024-10-15T14:56:01.604Z","updated_at":"2025-04-14T18:05:18.667Z","avatar_url":"https://github.com/ocramz.png","language":"Haskell","readme":"# record-encode\n\n## Encoding categorical variables\n\n[![Build Status](https://travis-ci.org/ocramz/record-encode.png)](https://travis-ci.org/ocramz/record-encode)\n[![Hackage](https://img.shields.io/hackage/v/record-encode.svg)](https://hackage.haskell.org/package/record-encode)\n\nThis library provides generic machinery to encode values of some algebraic type as points in a vector space.\n\nValues of a sum type (e.g. enumerations) are also called \"categorical\" variables in statistics, because they encode a choice between a number of discrete categories.\n\nOn the other hand, many data science / machine learning algorithms rely on a purely numerical representation of data; the conversion code from values of a static type is often \"boilerplate\", i.e. largely repeated and not informative.\n\nThe `encodeOneHot` function provided here is a generic utility function (i.e. defined once and for all) to compute the one-hot representation of any sum type. \n\n# Usage example\n\n```\n    {-# language DeriveGeneric -#}\n\n    import qualified GHC.Generics as G\n    import qualified Generics.SOP as SOP\n    \n    import Data.Record.Encode\n\n    data X = A | B | C deriving (G.Generic)\n    instance SOP.Generic X\n```\n\n```\n    \u003e encodeOneHot B\n    OH {oDim = 3, oIx = 1}\n```\n\nPlease refer to the documentation of Data.Record.Encode for more examples and details.\n\n\n# Acknowledgements\n\nGagandeep Bhatia (@gagandeepb) for his Google Summer of Code 2018 work on [`Frames-beam`](https://github.com/gagandeepb/Frames-beam), Mark Karpov (@mrkkrp) for his Template Haskell tutorial, Anthony Cowley (@acowley) for [`Frames`](https://hackage.haskell.org/package/Frames), @mniip on Freenode #haskell for helping me better understand what can be done with generic programming.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focramz%2Frecord-encode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Focramz%2Frecord-encode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focramz%2Frecord-encode/lists"}