README.md in anomaly-0.2.0 vs README.md in anomaly-0.2.1
- old
+ new
@@ -27,15 +27,19 @@
]
```
The last column **must** be 0 for non-anomalies, 1 for anomalies. Non-anomalies are used to train the detector, and both anomalies and non-anomalies are used to find the best value of ε.
-To train the detector and test for anomalies, run:
+Train the detector
```ruby
detector = Anomaly::Detector.new(weather_data)
+```
+Test for anomalies
+
+```ruby
# 85°F, 42% humidity, 12.3 in. pressure
detector.anomaly?([85, 42, 12.3])
```
Anomaly automatically finds the best value for ε, which you can access with:
@@ -53,24 +57,24 @@
## Persistence
You can easily persist the detector to a file or database - it’s very tiny.
```ruby
-dump = Marshal.dump(detector)
-File.binwrite("detector.dump", dump)
+bin = Marshal.dump(detector)
+File.binwrite("detector.bin", bin)
```
Then read it later:
```ruby
-dump = File.binread("detector.dump")
-detector = Marshal.load(dump)
+bin = File.binread("detector.bin")
+detector = Marshal.load(bin)
```
## Credits
-A special thanks to [Andrew Ng](http://www.ml-class.org).
+A special thanks to [Andrew Ng](https://www.coursera.org/learn/machine-learning).
## History
View the [changelog](https://github.com/ankane/anomaly/blob/master/CHANGELOG.md)
@@ -80,5 +84,14 @@
- [Report bugs](https://github.com/ankane/anomaly/issues)
- Fix bugs and [submit pull requests](https://github.com/ankane/anomaly/pulls)
- Write, clarify, or fix documentation
- Suggest or add new features
+
+To get started with development:
+
+```sh
+git clone https://github.com/ankane/anomaly.git
+cd anomaly
+bundle install
+bundle exec rake spec
+```