{"id":18024093,"url":"https://github.com/thomasnield/numky","last_synced_at":"2025-04-04T18:27:40.046Z","repository":{"id":148076058,"uuid":"190628028","full_name":"thomasnield/numky","owner":"thomasnield","description":"Idiomatic linear algebra for Kotlin using KMath","archived":false,"fork":false,"pushed_at":"2019-06-09T05:16:01.000Z","size":25,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-10T03:43:01.219Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thomasnield.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-06T18:10:39.000Z","updated_at":"2019-09-20T11:52:54.000Z","dependencies_parsed_at":"2023-05-19T02:00:27.834Z","dependency_job_id":null,"html_url":"https://github.com/thomasnield/numky","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/thomasnield%2Fnumky","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasnield%2Fnumky/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasnield%2Fnumky/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasnield%2Fnumky/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomasnield","download_url":"https://codeload.github.com/thomasnield/numky/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247228237,"owners_count":20904832,"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-10-30T07:11:52.696Z","updated_at":"2025-04-04T18:27:40.020Z","avatar_url":"https://github.com/thomasnield.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# numky\nIdiomatic linear algebra for Kotlin using KMath\n\n** Experimental work in progress! Do not use for production  **\n\n```kotlin \nimport org.nield.numky.linear.*\nimport org.ojalgo.random.Normal\nimport java.net.URL\n\nfun main() {\n\n    val points = URL(\"https://tinyurl.com/y58sesrr\")\n            .readText().split(Regex(\"\\\\r?\\\\n\"))\n            .asSequence()\n            .drop(1)\n            .filter { it.isNotEmpty() }\n            .map { it.split(\",\").map { it.toDouble() }.toDoubleArray() }\n            .toMatrix()\n\n    val x = points.extractColumn(0)\n    val y = points.extractColumn(1)\n\n    val normal = Normal(0.0,1.0)\n\n    val epochs = 200_000\n\n    val n = x.rowNum.toDouble()\n\n    var m = 0.0\n    var b = 0.0\n\n    var bestLoss = 10000000000000.0\n\n    repeat(epochs){\n        val mAdjust = normal.get()\n        val bAdjust = normal.get()\n\n        m += mAdjust\n        b += bAdjust\n\n        val newLoss = ((y - (x * m + b)).square() ).sum() / n\n\n        if (newLoss \u003c bestLoss) {\n            bestLoss = newLoss\n        } else {\n            m -= mAdjust\n            b -= bAdjust\n        }\n    }\n\n    println(\"f(x) = ${m}x + $b\")\n}\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasnield%2Fnumky","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomasnield%2Fnumky","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasnield%2Fnumky/lists"}