Swiftpack.co - Package - YutoMizutani/OperantKit

OperantKit

Build Status platform MIT License CocoaPods Carthage compatible Swift Package Manager compatible

OperantKit is a tool kit for operant conditioning (instrumental conditioning) experiments written in Swift.

日本語:jp:: README_JP.md

Usage

import OperantKit
import RxSwift

func main() {
	let schedule = FR(5) // Fixed ratio 5 schedule
	let events: Observable<Void> = ... // Observable events
	schedule.decision(events)
		.filter({ $0.isReinforcement }) // Filtering responses of reinforcement
		.subscribe(onNext: {
			print("Reinforcement")
		})
		.disposed(by: DisposeBag())
}

Demo

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,

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,

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,

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

Add this to your Podfile:

pod 'OperantKit'

and

$ pod install

Carthage

Add this to your Cartfile:

github "YutoMizutani/OperantKit"

and

$ carthage update

Swift Package Manager

Add this to your Package.swift:

dependencies: [
    .package(url: "https://github.com/YutoMizutani/OperantKit.git", "0.0.1" ..< "1.0.0"),
]

and

$ swift build

Dependencies

Documents

See docs/index.html

Operant conditioning (Instrumental conditioning)

Clean architecture

Reactive programming

Development installation

Clone this repository,

$ git clone https://github.com/YutoMizutani/OperantKit.git

And use make command,

$ 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.

Github

link
Stars: 0
Help us keep the lights on

Dependencies

Releases

0.0.8 - Nov 13, 2018

  • Add Time schedule