{"id":15063664,"url":"https://github.com/kortirso/elixir_learn_kit","last_synced_at":"2025-04-10T11:25:11.584Z","repository":{"id":57515539,"uuid":"150889328","full_name":"kortirso/elixir_learn_kit","owner":"kortirso","description":"Elixir library for machine learning","archived":false,"fork":false,"pushed_at":"2019-01-09T08:14:21.000Z","size":69,"stargazers_count":32,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T10:12:03.132Z","etag":null,"topics":["classification","elixir","elixir-library","gaussian-naive-bayes","knn-classifier","linear-regression","machine-learning","phoenix","prediction"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kortirso.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-29T17:51:46.000Z","updated_at":"2023-10-27T23:20:03.000Z","dependencies_parsed_at":"2022-08-30T04:20:51.048Z","dependency_job_id":null,"html_url":"https://github.com/kortirso/elixir_learn_kit","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kortirso%2Felixir_learn_kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kortirso%2Felixir_learn_kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kortirso%2Felixir_learn_kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kortirso%2Felixir_learn_kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kortirso","download_url":"https://codeload.github.com/kortirso/elixir_learn_kit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248208614,"owners_count":21065203,"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":["classification","elixir","elixir-library","gaussian-naive-bayes","knn-classifier","linear-regression","machine-learning","phoenix","prediction"],"created_at":"2024-09-25T00:05:38.934Z","updated_at":"2025-04-10T11:25:11.559Z","avatar_url":"https://github.com/kortirso.png","language":"Elixir","readme":"# LearnKit\n\nElixir package for machine learning\n\nAvailable preprocessing methods:\n\n- Normalization\n\nAvailable algorithms for prediction:\n\n- Linear Regression\n- Polynomial Regression\n\nAvailable algorithms for classification:\n\n- K-Nearest Neighbours\n- Gaussian Naive Bayes\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `learn_kit` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:learn_kit, \"~\u003e 0.1.6\"}\n  ]\nend\n```\n\n### Normalization\n\nNormalize data set with minimax normalization\n\n```elixir\n  alias LearnKit.Preprocessing\n  Preprocessing.normalize([[1, 2], [3, 4], [5, 6]])\n```\n\nOr normalize data set with selected type\n\n```elixir\n  Preprocessing.normalize([[1, 2], [3, 4], [5, 6]], [type: \"z_normalization\"])\n```\n  options - array of options\n\nAdditionally you can prepare coefficients for normalization\n\n```elixir\n  Preprocessing.coefficients([[1, 2], [3, 4], [5, 6]], \"minimax\")\n```\n    type - method of normalization, one of the [minimax|z_normalization], required\n\nAnd then normalize 1 feature with predefined coefficients\n\n```elixir\n  Preprocessing.normalize_feature([1, 2], [{1, 5}, {2, 6}], \"minimax\")\n```\n    type - method of normalization, one of the [minimax|z_normalization], required\n\n### Linear Regression\n\nInitialize predictor with data:\n\n```elixir\n  alias LearnKit.Regression.Linear\n  predictor = Linear.new([1, 2, 3, 4], [3, 6, 10, 15])\n```\n\nFit data set with least squares method:\n\n```elixir\n  predictor = predictor |\u003e Linear.fit\n```\n\nFit data set with gradient descent method:\n\n```elixir\n  predictor = predictor |\u003e Linear.fit([method: \"gradient descent\"])\n```\n\nPredict using the linear model:\n\n```elixir\n  predictor |\u003e Linear.predict([4, 8, 13])\n```\n    samples - array of variables, required\n\nReturns the coefficient of determination R^2 of the prediction:\n\n```elixir\n  predictor |\u003e Linear.score\n```\n\n### K-Nearest Neighbours classification\n\nInitialize classifier with data set consists from labels and features:\n\n```elixir\n  alias LearnKit.Knn\n  classifier =\n    Knn.new\n    |\u003e Knn.add_train_data({:a1, [-1, -1]})\n    |\u003e Knn.add_train_data({:a1, [-2, -1]})\n    |\u003e Knn.add_train_data({:a2, [1, 1]})\n```\n\nPredict label for new feature:\n\n```elixir\n  Knn.classify(classifier, [feature: [-1, -2], k: 3, weight: \"distance\", normalization: \"minimax\"])\n```\n    feature - new feature for prediction, required\n    k - number of nearest neighbors, optional, default - 3\n    algorithm - algorithm for calculation of distances, one of the [brute], optional, default - \"brute\"\n    weight - method of weighted neighbors, one of the [uniform|distance], optional, default - \"uniform\"\n    normalization - method of normalization, one of the [none|minimax|z_normalization], optional, default - \"none\"\n\n### Gaussian Naive Bayes classification\n\nInitialize classifier with data set consists from labels and features:\n\n```elixir\n  alias LearnKit.NaiveBayes.Gaussian\n  classifier =\n    Gaussian.new\n    |\u003e Gaussian.add_train_data({:a1, [-1, -1]})\n    |\u003e Gaussian.add_train_data({:a1, [-2, -1]})\n    |\u003e Gaussian.add_train_data({:a2, [1, 1]})\n```\n\nNormalize data set:\n\n```elixir\n  classifier = classifier |\u003e Gaussian.normalize_train_data(\"minimax\")\n```\n    type - method of normalization, one of the [none|minimax|z_normalization], optional, default - \"none\"\n\nFit data set:\n\n```elixir\n  classifier = classifier |\u003e Gaussian.fit\n```\n\nReturn probability estimates for the feature:\n\n```elixir\n  classifier |\u003e Gaussian.predict_proba([1, 2])\n```\n    feature - new feature for prediction, required\n\nReturn exact prediction for the feature:\n\n```elixir\n  classifier |\u003e Gaussian.predict([1, 2])\n```\n    feature - new feature for prediction, required\n\nReturns the mean accuracy on the given test data and labels:\n\n```elixir\n  classifier |\u003e Gaussian.score\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/kortirso/elixir_learn_kit.\n\n## License\n\nThe package is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n## Disclaimer\n\nUse this package at your own peril and risk.\n\n## Documentation\n\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)\nand published on [HexDocs](https://hexdocs.pm). Once published, the docs can\nbe found at [https://hexdocs.pm/learn_kit](https://hexdocs.pm/learn_kit).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkortirso%2Felixir_learn_kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkortirso%2Felixir_learn_kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkortirso%2Felixir_learn_kit/lists"}