{"id":13413357,"url":"https://github.com/sjwhitworth/golearn","last_synced_at":"2025-05-13T19:03:07.487Z","repository":{"id":12779397,"uuid":"15452925","full_name":"sjwhitworth/golearn","owner":"sjwhitworth","description":"Machine Learning for Go","archived":false,"fork":false,"pushed_at":"2024-01-15T13:55:44.000Z","size":27723,"stargazers_count":9385,"open_issues_count":88,"forks_count":1191,"subscribers_count":431,"default_branch":"master","last_synced_at":"2025-04-27T08:37:44.047Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sjwhitworth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-12-26T13:06:14.000Z","updated_at":"2025-04-26T16:27:17.000Z","dependencies_parsed_at":"2024-06-18T11:14:44.642Z","dependency_job_id":null,"html_url":"https://github.com/sjwhitworth/golearn","commit_stats":{"total_commits":432,"total_committers":64,"mean_commits":6.75,"dds":0.7476851851851851,"last_synced_commit":"74ae077eafb245fa3bdca0288854b6d51f97fe60"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjwhitworth%2Fgolearn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjwhitworth%2Fgolearn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjwhitworth%2Fgolearn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjwhitworth%2Fgolearn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sjwhitworth","download_url":"https://codeload.github.com/sjwhitworth/golearn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254010793,"owners_count":21998993,"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":[],"created_at":"2024-07-30T20:01:38.516Z","updated_at":"2025-05-13T19:03:07.470Z","avatar_url":"https://github.com/sjwhitworth.png","language":"Go","funding_links":[],"categories":["Go","General Machine Learning libraries","开源类库","机器学习","Machine Learning","Open source library","Machine Learning Framework","Golang","其他_机器学习与深度学习","[](https://github.com/josephmisiti/awesome-machine-learning/blob/master/README.md#go)Go","\u003cspan id=\"机器学习-machine-learning\"\u003e机器学习 Machine Learning\u003c/span\u003e","Relational Databases"],"sub_categories":["Vector Database","机器学习","交流","检索及分析资料库","Machine Learning","General Purpose Framework","Search and Analytic Databases","Tools","[Tools](#tools-1)","Speech Recognition","Advanced Console UIs","SQL 查询语句构建库","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e"],"readme":"GoLearn\n=======\n\n\u003cimg src=\"http://talks.golang.org/2013/advconc/gopherhat.jpg\" width=125\u003e\u003cbr\u003e\n[![GoDoc](https://godoc.org/github.com/sjwhitworth/golearn?status.png)](https://godoc.org/github.com/sjwhitworth/golearn)\n[![Build Status](https://travis-ci.org/sjwhitworth/golearn.png?branch=master)](https://travis-ci.org/sjwhitworth/golearn)\u003cbr\u003e\n[![Code Coverage](https://codecov.io/gh/sjwhitworth/golearn/branch/master/graph/badge.svg)](https://codecov.io/gh/sjwhitworth/golearn)\n\n[![Support via Gittip](https://rawgithub.com/twolfson/gittip-badge/0.2.0/dist/gittip.png)](https://www.gittip.com/sjwhitworth/)\n\nGoLearn is a 'batteries included' machine learning library for Go. **Simplicity**, paired with customisability, is the goal.\nWe are in active development, and would love comments from users out in the wild. Drop us a line on Twitter.\n\ntwitter: [@golearn_ml](http://www.twitter.com/golearn_ml)\n\nInstall\n=======\n\nSee [here](https://github.com/sjwhitworth/golearn/wiki/Installation) for installation instructions.\n\nGetting Started\n=======\n\nData are loaded in as Instances. You can then perform matrix like operations on them, and pass them to estimators.\nGoLearn implements the scikit-learn interface of Fit/Predict, so you can easily swap out estimators for trial and error.\nGoLearn also includes helper functions for data, like cross validation, and train and test splitting.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/sjwhitworth/golearn/base\"\n\t\"github.com/sjwhitworth/golearn/evaluation\"\n\t\"github.com/sjwhitworth/golearn/knn\"\n)\n\nfunc main() {\n\t// Load in a dataset, with headers. Header attributes will be stored.\n\t// Think of instances as a Data Frame structure in R or Pandas.\n\t// You can also create instances from scratch.\n\trawData, err := base.ParseCSVToInstances(\"datasets/iris.csv\", true)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Print a pleasant summary of your data.\n\tfmt.Println(rawData)\n\n\t//Initialises a new KNN classifier\n\tcls := knn.NewKnnClassifier(\"euclidean\", \"linear\", 2)\n\n\t//Do a training-test split\n\ttrainData, testData := base.InstancesTrainTestSplit(rawData, 0.50)\n\tcls.Fit(trainData)\n\n\t//Calculates the Euclidean distance and returns the most popular label\n\tpredictions, err := cls.Predict(testData)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Prints precision/recall metrics\n\tconfusionMat, err := evaluation.GetConfusionMatrix(testData, predictions)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Unable to get confusion matrix: %s\", err.Error()))\n\t}\n\tfmt.Println(evaluation.GetSummary(confusionMat))\n}\n```\n\n```\nIris-virginica\t28\t2\t  56\t0.9333\t0.9333  0.9333\nIris-setosa\t    29\t0\t  59\t1.0000  1.0000\t1.0000\nIris-versicolor\t27\t2\t  57\t0.9310\t0.9310  0.9310\nOverall accuracy: 0.9545\n```\n\nExamples\n========\n\nGoLearn comes with practical examples. Dive in and see what is going on.\n\n```bash\ncd $GOPATH/src/github.com/sjwhitworth/golearn/examples/knnclassifier\ngo run knnclassifier_iris.go\n```\n```bash\ncd $GOPATH/src/github.com/sjwhitworth/golearn/examples/instances\ngo run instances.go\n```\n```bash\ncd $GOPATH/src/github.com/sjwhitworth/golearn/examples/trees\ngo run trees.go\n```\n\nDocs\n====\n\n * [English](https://github.com/sjwhitworth/golearn/wiki)\n * [中文文档(简体)](doc/zh_CN/Home.md)\n * [中文文档(繁体)](doc/zh_TW/Home.md)\n\nJoin the team\n=============\n\nPlease send me a mail at stephenjameswhitworth@gmail.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjwhitworth%2Fgolearn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsjwhitworth%2Fgolearn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjwhitworth%2Fgolearn/lists"}