{"id":17160714,"url":"https://github.com/yutomizutani/operantkit","last_synced_at":"2025-04-13T14:11:16.489Z","repository":{"id":48764918,"uuid":"145286132","full_name":"YutoMizutani/OperantKit","owner":"YutoMizutani","description":"A tool for operant conditioning experiments for Swift.","archived":false,"fork":false,"pushed_at":"2022-10-06T03:10:38.000Z","size":3047,"stargazers_count":6,"open_issues_count":12,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-28T15:29:47.314Z","etag":null,"topics":["behavior","behavior-analysis","eab","instrumental-conditioning","operant","operant-conditioning","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/YutoMizutani.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}},"created_at":"2018-08-19T08:31:08.000Z","updated_at":"2020-07-28T04:53:55.000Z","dependencies_parsed_at":"2022-09-12T11:01:40.111Z","dependency_job_id":null,"html_url":"https://github.com/YutoMizutani/OperantKit","commit_stats":null,"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YutoMizutani%2FOperantKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YutoMizutani%2FOperantKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YutoMizutani%2FOperantKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YutoMizutani%2FOperantKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YutoMizutani","download_url":"https://codeload.github.com/YutoMizutani/OperantKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724629,"owners_count":21151561,"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":["behavior","behavior-analysis","eab","instrumental-conditioning","operant","operant-conditioning","swift"],"created_at":"2024-10-14T22:25:44.371Z","updated_at":"2025-04-13T14:11:16.466Z","avatar_url":"https://github.com/YutoMizutani.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OperantKit\n\n[![Build Status](https://app.bitrise.io/app/e1b066c3a796bb39/status.svg?token=3DteqY4In4ByLDs_2-iucg\u0026branch=master)](https://app.bitrise.io/app/e1b066c3a796bb39)\n![Swift](https://img.shields.io/badge/Swift-5.0-orange.svg)\n![platform](https://img.shields.io/badge/platform-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS%20%7C%20Linux-333333.svg)\n[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/YutoMizutani/OperantKit/blob/master/LICENSE)\n[![CocoaPods](https://img.shields.io/cocoapods/v/OperantKit.svg)](https://github.com/YutoMizutani/OperantKit)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/YutoMizutani/OperantKit)\n[![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager)\n\n**OperantKit** is a tool kit for *operant conditioning* (*instrumental conditioning*) experiments written in Swift.\n\n日本語:jp:: [README_JP.md](https://github.com/YutoMizutani/OperantKit/blob/master/assets/localization/README_JP.md)\n\n## Usage\n\n```swift\nimport OperantKit\nimport RxSwift\n\nfunc main() {\n\tlet schedule = FR(5) // Fixed ratio 5 schedule\n\tlet events: Observable\u003cVoid\u003e = ... // Observable events\n\tschedule.decision(events)\n\t\t.filter { $0.isReinforcement } // Filtering responses of reinforcement\n\t\t.subscribe(onNext: {\n\t\t\tprint(\"Reinforcement\")\n\t\t})\n\t\t.disposed(by: DisposeBag())\n}\n```\n\n## Examples\n\n* [CLI examples (Linux, macOS)](https://github.com/YutoMizutani/OperantKit/tree/master/Examples/CLI)\n* [iOS examples (iOS)](https://github.com/YutoMizutani/OperantKit/tree/master/Examples/iOS)\n\t* [RatChamber](https://github.com/YutoMizutani/OperantKit/tree/master/Examples/iOS/RatChamber)\n\t![](https://github.com/YutoMizutani/OperantKit/blob/master/assets/img/demo_ratchamber.gif?raw=true)\n\n## Supporting schedules\n\n### Simple schedules\n\n#### Fixed schedules\n\n|Name of schedule|Code|\n|:-:|:-:|\n|Fixed ratio schedule|`FR(5)`|\n|Variable ratio schedule|`VR(5)` ※|\n|Random ratio schedule|`RR(5)`|\n\n※ The number of iterations of the variable schedule is \"12\" by default,\n\n```swift\nVR(10, iterations: 12)\n```\n\nIt is also possible to change the number of iterations and so on.\n\n#### Interval schedules\n\n|Name of schedule|Code|\n|:-:|:-:|\n|Fixed interval schedule|`FI(5)`|\n|Variable interval schedule|`VI(5)`|\n|Random interval schedule|`RI(5)`|\n\nThe time interval defaults in `.seconds`,\n\n```swift\nFI(5, unit: .minutes)\n```\n\nIt is also possible to change the unit in such a way.\n\n#### Time schedules\n\n|Name of schedule|Code|\n|:-:|:-:|\n|Fixed time schedule|`FT(5)`|\n|Variable time schedule|`VT(5)`|\n|Random time schedule|`RT(5)`|\n\nThe time interval defaults in `.seconds`,\n\n```swift\nFI(5, unit: .minutes)\n```\n\nIt is also possible to change the unit in such a way.\n\n#### Other schedules\n\n|Name of schedule|Code|\n|:-:|:-:|\n|Continuous reinforcement|`CRF()`|\n|Extinction schedule|`EXT()`|\n\n### Compound schedules\n\n|Name of schedule|Code|\n|:-:|:-:|\n|Concurrent schedule|`Conc(FR(5), VI(10))` ※|\n\n※ When a common schedule applies to two or more types of operandam like the internal link in concurrent chained schedule, it can be handled by using `Shared()` keyword. e.g. `Conc(Shared(VI(10)))`\n\n## Installation\n\n### [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html)\n\nAdd this to your `Podfile`:\n\n```ruby\npod 'OperantKit'\n```\n\nand\n\n```bash\n$ pod install\n```\n\n### [Carthage](https://github.com/Carthage/Carthage)\n\nAdd this to your `Cartfile`:\n\n```\ngithub \"YutoMizutani/OperantKit\"\n```\n\nand\n\n```bash\n$ carthage update\n```\n\n### [Swift Package Manager](https://github.com/apple/swift-package-manager)\n\nAdd this to your `Package.swift`:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/YutoMizutani/OperantKit.git\", \"0.0.1\" ..\u003c \"1.0.0\"),\n]\n```\n\nand\n\n```bash\n$ swift build\n```\n\n## Dependencies\n\n* [RxSwift](https://www.github.com/ReactiveX/RxSwift)\n* [RxCocoa](https://www.github.com/ReactiveX/RxSwift)\n\n## Documents\n\nSee [https://yutomizutani.github.io/OperantKit/](https://yutomizutani.github.io/OperantKit/)\n\n## Operant conditioning (Instrumental conditioning)\n\n![](https://github.com/YutoMizutani/OperantKit/blob/master/assets/img/abc_analysis.png?raw=true)\n\n## Clean architecture\n\n![](https://blog.cleancoder.com/uncle-bob/images/2012-08-13-the-clean-architecture/CleanArchitecture.jpg)\n\n![](https://github.com/YutoMizutani/OperantKit/blob/master/assets/img/operantkit_architecture.png?raw=true)\n\n## Reactive programming\n\n## Development installation\n\nClone this repository,\n\n```bash\n$ git clone https://github.com/YutoMizutani/OperantKit.git\n```\n\nAnd use `make` command,\n\n```bash\n$ make deps-all\n$ make open\n```\n\n## References\n\n## Author\n\nYuto Mizutani, yuto.mizutani.dev@gmail.com\n\n## Donate\n\nMy \"motivation\" is fully controlled by continuous reinforcement (FR1) schedule :)\n\n## License\n\nOperantKit is available under the [MIT license](https://github.com/YutoMizutani/OperantKit/blob/master/LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyutomizutani%2Foperantkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyutomizutani%2Foperantkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyutomizutani%2Foperantkit/lists"}