https://github.com/yutomizutani/operantkit
A tool for operant conditioning experiments for Swift.
https://github.com/yutomizutani/operantkit
behavior behavior-analysis eab instrumental-conditioning operant operant-conditioning swift
Last synced: 11 months ago
JSON representation
A tool for operant conditioning experiments for Swift.
- Host: GitHub
- URL: https://github.com/yutomizutani/operantkit
- Owner: YutoMizutani
- License: mit
- Created: 2018-08-19T08:31:08.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-10-06T03:10:38.000Z (over 3 years ago)
- Last Synced: 2024-05-28T15:29:47.314Z (almost 2 years ago)
- Topics: behavior, behavior-analysis, eab, instrumental-conditioning, operant, operant-conditioning, swift
- Language: Swift
- Homepage:
- Size: 2.91 MB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OperantKit
[](https://app.bitrise.io/app/e1b066c3a796bb39)


[](https://github.com/YutoMizutani/OperantKit/blob/master/LICENSE)
[](https://github.com/YutoMizutani/OperantKit)
[](https://github.com/YutoMizutani/OperantKit)
[](https://github.com/apple/swift-package-manager)
**OperantKit** is a tool kit for *operant conditioning* (*instrumental conditioning*) experiments written in Swift.
日本語:jp:: [README_JP.md](https://github.com/YutoMizutani/OperantKit/blob/master/assets/localization/README_JP.md)
## Usage
```swift
import OperantKit
import RxSwift
func main() {
let schedule = FR(5) // Fixed ratio 5 schedule
let events: Observable = ... // Observable events
schedule.decision(events)
.filter { $0.isReinforcement } // Filtering responses of reinforcement
.subscribe(onNext: {
print("Reinforcement")
})
.disposed(by: DisposeBag())
}
```
## Examples
* [CLI examples (Linux, macOS)](https://github.com/YutoMizutani/OperantKit/tree/master/Examples/CLI)
* [iOS examples (iOS)](https://github.com/YutoMizutani/OperantKit/tree/master/Examples/iOS)
* [RatChamber](https://github.com/YutoMizutani/OperantKit/tree/master/Examples/iOS/RatChamber)

## Supporting schedules
### Simple schedules
#### Fixed schedules
|Name of schedule|Code|
|:-:|:-:|
|Fixed ratio schedule|`FR(5)`|
|Variable ratio schedule|`VR(5)` ※|
|Random ratio schedule|`RR(5)`|
※ The number of iterations of the variable schedule is "12" by default,
```swift
VR(10, iterations: 12)
```
It is also possible to change the number of iterations and so on.
#### Interval schedules
|Name of schedule|Code|
|:-:|:-:|
|Fixed interval schedule|`FI(5)`|
|Variable interval schedule|`VI(5)`|
|Random interval schedule|`RI(5)`|
The time interval defaults in `.seconds`,
```swift
FI(5, unit: .minutes)
```
It is also possible to change the unit in such a way.
#### Time schedules
|Name of schedule|Code|
|:-:|:-:|
|Fixed time schedule|`FT(5)`|
|Variable time schedule|`VT(5)`|
|Random time schedule|`RT(5)`|
The time interval defaults in `.seconds`,
```swift
FI(5, unit: .minutes)
```
It is also possible to change the unit in such a way.
#### Other schedules
|Name of schedule|Code|
|:-:|:-:|
|Continuous reinforcement|`CRF()`|
|Extinction schedule|`EXT()`|
### Compound schedules
|Name of schedule|Code|
|:-:|:-:|
|Concurrent schedule|`Conc(FR(5), VI(10))` ※|
※ 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)))`
## Installation
### [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html)
Add this to your `Podfile`:
```ruby
pod 'OperantKit'
```
and
```bash
$ pod install
```
### [Carthage](https://github.com/Carthage/Carthage)
Add this to your `Cartfile`:
```
github "YutoMizutani/OperantKit"
```
and
```bash
$ carthage update
```
### [Swift Package Manager](https://github.com/apple/swift-package-manager)
Add this to your `Package.swift`:
```swift
dependencies: [
.package(url: "https://github.com/YutoMizutani/OperantKit.git", "0.0.1" ..< "1.0.0"),
]
```
and
```bash
$ swift build
```
## Dependencies
* [RxSwift](https://www.github.com/ReactiveX/RxSwift)
* [RxCocoa](https://www.github.com/ReactiveX/RxSwift)
## Documents
See [https://yutomizutani.github.io/OperantKit/](https://yutomizutani.github.io/OperantKit/)
## Operant conditioning (Instrumental conditioning)

## Clean architecture


## Reactive programming
## Development installation
Clone this repository,
```bash
$ git clone https://github.com/YutoMizutani/OperantKit.git
```
And use `make` command,
```bash
$ make deps-all
$ make open
```
## References
## Author
Yuto Mizutani, yuto.mizutani.dev@gmail.com
## Donate
My "motivation" is fully controlled by continuous reinforcement (FR1) schedule :)
## License
OperantKit is available under the [MIT license](https://github.com/YutoMizutani/OperantKit/blob/master/LICENSE).