{"id":34599287,"url":"https://github.com/mtresnik/intel","last_synced_at":"2026-04-18T23:05:10.461Z","repository":{"id":181510580,"uuid":"389683705","full_name":"mtresnik/intel","owner":"mtresnik","description":"A machine learning library for kotlin JVM.","archived":false,"fork":false,"pushed_at":"2022-05-15T16:07:26.000Z","size":859,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-07-15T23:26:02.419Z","etag":null,"topics":["apache2","constraint-satisfaction-problem","decision-trees","gradle","k-means","kd-tree","kotlin","library","n-queens","svm"],"latest_commit_sha":null,"homepage":"","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/mtresnik.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}},"created_at":"2021-07-26T15:36:58.000Z","updated_at":"2023-07-15T23:26:03.383Z","dependencies_parsed_at":"2023-07-15T23:26:03.340Z","dependency_job_id":"e6b196a0-befc-48a6-b67a-610f23e26836","html_url":"https://github.com/mtresnik/intel","commit_stats":null,"previous_names":["mtresnik/intel"],"tags_count":1,"template":null,"template_full_name":null,"purl":"pkg:github/mtresnik/intel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtresnik%2Fintel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtresnik%2Fintel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtresnik%2Fintel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtresnik%2Fintel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtresnik","download_url":"https://codeload.github.com/mtresnik/intel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtresnik%2Fintel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28002250,"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","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["apache2","constraint-satisfaction-problem","decision-trees","gradle","k-means","kd-tree","kotlin","library","n-queens","svm"],"created_at":"2025-12-24T12:08:02.177Z","updated_at":"2025-12-24T12:08:13.928Z","avatar_url":"https://github.com/mtresnik.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# intel\n\n[![build status](https://github.com/mtresnik/intel/actions/workflows/gradle.yml/badge.svg)](https://github.com/mtresnik/intel/actions/workflows/gradle.yml/)\n[![version](https://img.shields.io/badge/version-1.0.0-blue)](https://github.com/mtresnik/intel/packages/1423052)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/mtresnik/intel/blob/main/LICENSE)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg?style=flat-square)](https://makeapullrequest.com)\n\u003chr\u003e\n\n## Dependencies\n\u003e Please compile against [com.resnik.math:1.0.0](https://github.com/mtresnik/math/packages/1409888) as well as this project.\n\n## Getting Started\n\n\u003e This is a slightly different process to that of [com.resnik.math](https://github.com/mtresnik/math/).\n\n**~/.m2/settings.xml:**\n```xml\n\u003csettings xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\"\n  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n  xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0\n                      http://maven.apache.org/xsd/settings-1.0.0.xsd\"\u003e\n    ...\n  \u003cactiveProfiles\u003e\n    \u003cactiveProfile\u003egithub\u003c/activeProfile\u003e\n  \u003c/activeProfiles\u003e\n    ...\n  \u003cservers\u003e\n    \u003cserver\u003e\n      \u003cid\u003egithub\u003c/id\u003e\n      \u003cusername\u003eGITHUB_USERNAME\u003c/username\u003e\n      \u003cpassword\u003eGITHUB_PAT\u003c/password\u003e\n    \u003c/server\u003e\n  \u003c/servers\u003e\n\u003c/settings\u003e\n```\n\n**pom.xml:**\n```xml\n\u003crepository\u003e\n    \u003cid\u003egithub\u003c/id\u003e\n    \u003curl\u003ehttps://maven.pkg.github.com/mtresnik/math\u003c/url\u003e\n    \u003csnapshots\u003e\n        \u003cenabled\u003etrue\u003c/enabled\u003e\n    \u003c/snapshots\u003e\n\u003c/repository\u003e\n...\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.resnik\u003c/groupId\u003e\n    \u003cartifactId\u003emath\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.resnik\u003c/groupId\u003e\n    \u003cartifactId\u003eintel\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Gradle (groovy)\n\n**~/.gradle/gradle.properties:**\n```groovy\ngpr.user=GITHUB_USERNAME\ngpr.token=GITHUB_PAT\n```\n\n**build.gradle:**\n```groovy\nrepositories {\n    ...\n    maven {\n        name=\"GitHubPackages\"\n        url= uri(\"https://maven.pkg.github.com/mtresnik/math\")\n        credentials {\n            // Runner stored in env, else stored in ~/.gradle/gradle.properties\n            username = System.getenv(\"USERNAME\") ?: findProperty(\"gpr.user\") ?: \"\u003cGITHUB_USERNAME\u003e\"\n            password = System.getenv(\"TOKEN\") ?: findProperty(\"gpr.token\")\n        }\n    }\n    ...\n    maven {\n        name=\"GitHubPackages\"\n        url= uri(\"https://maven.pkg.github.com/mtresnik/intel\")\n        credentials {\n            // Runner stored in env, else stored in ~/.gradle/gradle.properties\n            username = System.getenv(\"USERNAME\") ?: findProperty(\"gpr.user\") ?: \"\u003cGITHUB_USERNAME\u003e\"\n            password = System.getenv(\"TOKEN\") ?: findProperty(\"gpr.token\")\n        }\n    }\n}\n\ndependencies {\n    ...\n    implementation group: 'com.resnik', name: 'math', version: '1.0.0'\n    implementation group: 'com.resnik', name: 'intel', version: '1.0.0'\n    ...\n}\n```\n\n\u003chr\u003e\n\n## Constraint Satisfaction Problems (CSP's)\n\nFinding solutions to smaller CSP's is simple enough using recursion, but harder for larger / more complex domains. For larger domains we run into the `StackOverflowException` and `Java OEM Exception` since the solutionset is stored at each point on the stack in a recursion model.\n\n**CSPAgent** : A non-recursive Depth-First-Search (DFS) graph explorer with a Stack of parents.\n**CSPSingleParentAgent** : A `CSPAgent` with only one parent (used in Async CSP's)\n\n### CSP Types:\n\n* **CSPTree** : Synchronous, linear DFS on the search space using a `CSPAgent`.\n* **CSPDomainAsync** : Separates the first variable's domain into |D| `CSPAgent`'s on separate sections of the search space.\n* **CSPInferredAsync** : Uses `THREAD_COUNT` `CSPAgent`'s on separate sections of the search space.\n* **CSPCoroutine** : Uses kotlin coroutines in JVM Thread Pools.\n\n\u003e If unsure which CSP type to use, just call `CSPFactory`\n\n```kotlin\nval variables = listOf\u003cString\u003e(\"A\", \"B\", \"C\")\nval domain = listOf\u003cInt\u003e(1, 2, 3)\nval domainMap = variables.associateWith{ domain }\nval csp = CSPFactory.createCSP(domainMap)\ncsp.addConstraint(GlobalAllDiff())\nval solutions = csp.findAllSolutions()\nval timeTaken = csp.finalTime()\n```\n\n### Constraints:\n\nConstraints are used to limit the search space given the initial variables and domains. **Local Constraints** provide *path consistency* while **Global Constraints** provide *absolute consistency*.\n\n**Local Constraints** imply that local consistency tends to global consistency. Used for monotone solutions. \u003c/br\u003e Ex: `sumLessThan()`, `localAllDiff()`\n\n**Global Constraints** imply that the entire sequence is needed to know consistency. \u003c/br\u003e Ex: `isName()`, `equals()`\n\n**Reusable Constraints** accomplishes both local and global consistency. These can both prune the search space while exploring and be reused as global constraints at the end. \u003c/br\u003e Ex: `min()`, `max()`\n\n\u003e **_NOTE:_** High computation constraints should be weighed against search space complexity.\n\n#### Worst Case Complexity (No Solutions, No Constraints):\n\n`// Had to change the background on this one for dark-mode legibility`\n\u003c/br\u003e\n\u003cimg src=\"https://i.imgur.com/i7BBTz4.png\" width=\"300\"\u003e\n\n### Examples\n\n#### Map Coloring\n\n| Same Sized Rects - Trivial Case | Different Sized Rects - First Solution | \n| -------- | -------- |\n| \u003cimg src=\"https://i.imgur.com/IfRWdAO.png\" width=\"300\"\u003e     | \u003cimg src=\"https://i.imgur.com/n6bo1II.png\" width=\"300\"\u003e     |\n\n#### n-Queens\n\n| (n=8, solutions=92, time=101ms) | (n=14, solutions=365596, time=49.435s) | \n| -------- | -------- |\n| \u003cimg src=\"https://i.imgur.com/rzmAFtC.jpg\" width=\"300\"\u003e    | \u003cimg src=\"https://i.imgur.com/8WvWPvB.jpg\" width=\"300\"\u003e     |\n\n## Quad Trees and k-d Trees\n\nSpeed Limit Sign (quad tree, distance threshold = 40 / 255.0) \u003c/br\u003e\n\u003cimg src=\"https://i.imgur.com/HgdFG3b.png\" width=\"300\"\u003e \u003c/br\u003e\nSunday in the Park With George (k-d tree, uniform random seeds = 1000) \u003c/br\u003e\n\u003cimg src=\"https://i.imgur.com/oK2I3az.png\" width=\"300\"\u003e\n\n## K-Means Clustering\n\n### Euclidean Distance Relations\nK-Means Shown as Points (k=20, seedPoints=40) \u003c/br\u003e\n\u003cimg src=\"https://i.imgur.com/XEML1tA.png\" width=\"300\"\u003e\n\n**Seed Points**: Sample Data the model is clustered on.\n\n```kotlin=1\nval kMeans : KMeans\n// Initialize the kMeans with seed points\nval closestCluster : Cluster = kMeans[samplePoint]\n```\n\nFor initializing a kMeans clustering, use `KMeans.getBestKMeans()`.\nThis will minimize the kMeans variance over the number of iterations.\n\n```kotlin=4\n// kMeansVariance: high = poor clustering\nval kMeansVariance = kMeans.getMeanVariance()\n// each cluster has variance as well\nval clusterVariance = closestCluster.getVariance()\n```\n\n### Image Compression\n\nFor image compression, your number of means is the number of unique colors you want. As k increases, from 8 to 16, 32, 64, etc, the quality of the image increases. Similarly, the number of seed points needed from the original image may increase when k is small to preserve information content.\n\nVideo: \u003c/br\u003e\n[![K-Means Image Compression](https://img.youtube.com/vi/4C_0dY91V1U/0.jpg)](https://www.youtube.com/watch?v=4C_0dY91V1U)\n\n## Proof of Concept Work\n\n### Neural Networks\n\n#### Feed Forward Neural Network\n(xor problem, training set=4, data={(0,0),(0)}, {(0,1),(1)}, {(1,0),(1)}, {(1,1),(0)}) \u003c/br\u003e\n\u003cimg src=\"https://i.imgur.com/xBGMrqR.png\" width=\"300\"\u003e\n\n#### Recurrant Neural Networks / Convolutional Neural Networks (WIP)\n\nMore Tensor iteration work is needed before these are *fully fleshed out.\n\n### Support Vector Machines (SVM's)\n\n\u003cimg src=\"https://i.imgur.com/tdmBOE9.png\" width=\"300\"\u003e\n\n### Decision Trees\n\nExample of decision trees on the Tennis Dataset but generalized for other Attribute types.\n\n#### Tennis Dataset\nAttributes = (Outlook, Temperature, Humidity, Wind, PlayTennis) \u003c/br\u003e\nOutlook = (Sunny, Overcast, Rain) \u003c/br\u003e\nTemperature = (Hot, Mild, Cool) \u003c/br\u003e\nHumidity = (High, Normal) \u003c/br\u003e\nWind = (Weak, Strong) \u003c/br\u003e\nPlayTennis = (No, Yes) \u003c/br\u003e\n\n```kotlin \nval schema = Schema(outlook, temperature, humidity, wind, tennis)\nval dataset = Dataset(schema, tennis) // schema, target\ndataset.addEntry(Entry(schema, sunny, hot, high, weak, no))\n// ...\n// Add other Entries\n// ...\nval decisionTree = dataset.buildTree()\nval result = decisionTree.traverse(\"Sunny\", \"Mild\", \"High\", \"Strong\")\n// The typeof(result) is the same as the TargetAttribute.type\n```\nIn general, you can have any number of `Attribute`'s each with different types in the same `Schema`.\n\n### Genetic Algorithms (WIP)\n\nMainly used for String breeding algorithms and minimization functions.\n\n\u003e Note: Future work will include multi-threaded breeders and speciation in a custom bioinformatics library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtresnik%2Fintel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtresnik%2Fintel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtresnik%2Fintel/lists"}