Skip to content

(DEPRECATED) Machine Learning to predict if a person is working out.

License

Notifications You must be signed in to change notification settings

HeartRateLearning/HRLEngine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HRLEngine

CI Status codecov.io Version Docs

This repository is DEPRECATED. Refer to HRLClassifier instead.

Use Machine Learning to predict if a person is working out based of his/her heart rate.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

HRLEngine is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "HRLEngine"

Usage

let date = Date()

let dataFrame = DataFrame()
dataFrame.append(record: Record(date:date.addingTimeInterval(-6 * 60 * 60),
                                bpm:Float(100)),
                 isWorkingOut: false)
dataFrame.append(record: Record(date:date.addingTimeInterval(-5 * 60 * 60),
                                bpm:Float(140)),
                 isWorkingOut: true)
dataFrame.append(record: Record(date:date.addingTimeInterval(-4 * 60 * 60),
                                bpm:Float(120)),
                 isWorkingOut: true)
dataFrame.append(record: Record(date:date.addingTimeInterval(-3 * 60 * 60),
                                bpm:Float(70)),
                 isWorkingOut: false)
dataFrame.append(record: Record(date:date.addingTimeInterval(-2 * 60 * 60),
                                bpm:Float(55)),
                 isWorkingOut: false)
dataFrame.append(record: Record(date:date.addingTimeInterval(-1 * 60 * 60),
                                bpm:Float(125)),
                 isWorkingOut: true)

let engine = Engine()
engine.train(with: dataFrame)

let predictDate = date.addingTimeInterval(-3.5 * 60 * 60)
let predictBPM = Float(130)
let isWorkingOut = engine.predictedWorkingOut(for: Record(date:predictDate,
                                                          bpm:predictBPM))

print("At \(predictDate) with \(predictBPM) bpm, is user working out? \(isWorkingOut)")

License

HRLEngine is available under the MIT license. See the LICENSE file for more info.

About

(DEPRECATED) Machine Learning to predict if a person is working out.

Resources

License

Stars

Watchers

Forks

Packages

No packages published