{"id":20303593,"url":"https://github.com/elahe-dastan/newborn","last_synced_at":"2025-04-11T13:44:37.146Z","repository":{"id":49833285,"uuid":"290439916","full_name":"elahe-dastan/newborn","owner":"elahe-dastan","description":"A library for ML algorithms","archived":false,"fork":false,"pushed_at":"2020-08-27T20:07:23.000Z","size":396,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T10:03:31.494Z","etag":null,"topics":["algorithms","dataset","go","gola","knn","knn-classification","linear-regression","logistic-regression","machine-learning","math-calculation","ml","polynomial-regression","regression"],"latest_commit_sha":null,"homepage":"","language":"Go","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/elahe-dastan.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"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":"2020-08-26T08:26:47.000Z","updated_at":"2024-01-25T14:36:54.000Z","dependencies_parsed_at":"2022-08-28T21:00:50.701Z","dependency_job_id":null,"html_url":"https://github.com/elahe-dastan/newborn","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/elahe-dastan%2Fnewborn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elahe-dastan%2Fnewborn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elahe-dastan%2Fnewborn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elahe-dastan%2Fnewborn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elahe-dastan","download_url":"https://codeload.github.com/elahe-dastan/newborn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248410918,"owners_count":21098799,"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":["algorithms","dataset","go","gola","knn","knn-classification","linear-regression","logistic-regression","machine-learning","math-calculation","ml","polynomial-regression","regression"],"created_at":"2024-11-14T16:39:27.895Z","updated_at":"2025-04-11T13:44:37.123Z","avatar_url":"https://github.com/elahe-dastan.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://cloud.drone.io/api/badges/elahe-dastan/newborn/status.svg)](https://cloud.drone.io/elahe-dastan/newborn)\n# Introduction\nThis repository is really simple and small I tried to put only basic and most frequently ML algorithms in it, I'm going\nto explain all the algorithms implemented in this repository, how you can use them and even the math calculation behind\nthem for those who are interesting.\n\n# Reading Data And Picturing It\nOne of the most basic capabilities you'll need for sure is to read data from a dataset and plot it if possible, most of \nthe times the dataset is a CSVDataset here is a sample of how to use this library\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\n\t\"github.com/elahe-dastan/newborn/data\"\n)\n\nfunc main() {\n\theaders, content := data.ReadCSVData(\"./data/dataset_test.csv\")\n\tfmt.Println(headers)\n\n\tx := make([]float64, len(content[headers[0]]))\n\ty := make([]float64, len(content[headers[1]]))\n\n\tfor i := 0; i \u003c len(content[headers[0]]); i++ {\n\t\tx[i], _ = strconv.ParseFloat(content[headers[0]][i], 64)\n\t\ty[i], _ = strconv.ParseFloat(content[headers[1]][i], 64)\n\t}\n\n\tdata.ScatterPlot(x, y, headers[0], headers[1], \"example\")\n}\n```\n```\n[x y]\n```\n![](images/example.png)\n\n# Regression\nOne of the basic things everybody has to learn to study ML is linear regression, logistic regression and\nnonlinear regression, regression is used in both predicting a value and classification.\u003cbr/\u003e\nLet's talk a little deeper about regression, we want to fit a line or curve to a set of data.I'm going to show the math\ncalculations of what is happening.\n\n[check here if you are interested in the math calculations](https://elahe-dastan.github.io/newborn/)\n\nIn this repository I haven't implemented linear regression separately because linear regression is polynomial regression \nwith degree equal to 1 and lambda equal to 0\n\n# K Nearest Neighbour\nThis algorithm is used for classification, to choose a label for a new data the algorithm finds the k nearest data to it\nand finds the most repeated label among them, different methods can be used to calculate the distance between the new data \nand the old ones in this repository I use one of the easiest approaches called Euclidean Distance.\u003cbr/\u003e\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/elahe-dastan/newborn/data\"\n\t\"github.com/elahe-dastan/newborn/knn\"\n\t\"strconv\"\n)\n\nfunc main() {\n\theaders, content := data.ReadCSVData(\"./knn/dataset_test.csv\")\n\tcurrentData := make([][]float64, len(content[headers[0]]))\n\tfor i := range currentData {\n\t\tf := make([]float64, len(headers)-1)\n\t\tfor j := range f {\n\t\t\tf[j], _ = strconv.ParseFloat(content[headers[j]][i], 64)\n\t\t}\n\t\tcurrentData[i] = f\n\t}\n\n\tlabels := make([]int, len(content[headers[0]]))\n\tfor i := range labels {\n\t\tlabels[i], _ = strconv.Atoi(content[headers[len(headers)-1]][i])\n\t}\n\n\tnewData := []float64{57.0,1.0,4.0,140.0,192.0,0.0,0.0,148.0,0.0,0.4,2.0,0.0,6.0}\n    \n        // k = 3\n\tlabel := knn.KNN(currentData, labels, newData, 3)\n\tfmt.Println(label)\n}\n```\n```\n0\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felahe-dastan%2Fnewborn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felahe-dastan%2Fnewborn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felahe-dastan%2Fnewborn/lists"}