Permalink
Browse files

doc: readme, syntax highlighting for scheme sample

  • Loading branch information...
1 parent 511a83a commit 5a36fdd60a24472e7b988f75ac7d1dedc81e20fb @kristianlm committed Jun 11, 2012
Showing with 21 additions and 19 deletions.
  1. +21 −19 README.md
View
@@ -14,30 +14,32 @@ need to be freed with their associated destroyers.
## Example
Here's the [original example](http://leenissen.dk/fann/html/files2/gettingstarted-txt.html) convered to scheme:
- (use fann)
- (define xor-train (fann:read-train-from-list '(((-1 -1) (-1))
- ((-1 1) (1))
- ((1 -1) (1))
- ((1 1) (-1)))))
+```scheme
+(use fann)
+(define xor-train (fann:read-train-from-list '(((-1 -1) (-1))
+ ((-1 1) (1))
+ ((1 -1) (1))
+ ((1 1) (-1)))))
- (define ann (fann:create-standard 2 3 1))
+(define ann (fann:create-standard 2 3 1))
- (let* ([max-epochs 500000]
- [epochs-between-reports 1000]
- [desired-error 0.001]
- [num-inputs 2]
- [num-outputs 1])
+(let* ([max-epochs 500000]
+ [epochs-between-reports 1000]
+ [desired-error 0.001]
+ [num-inputs 2]
+ [num-outputs 1])
- (fann:set-activation-function-hidden ann fann:sigmoid-symmetric)
- (fann:set-activation-function-output ann fann:sigmoid-symmetric)
- (fann:train-on-data ann xor-train max-epochs epochs-between-reports desired-error))
+ (fann:set-activation-function-hidden ann fann:sigmoid-symmetric)
+ (fann:set-activation-function-output ann fann:sigmoid-symmetric)
+ (fann:train-on-data ann xor-train max-epochs epochs-between-reports desired-error))
- (define input '(-1 1))
- (print input " -> " (fann:run ann input))
+(define input '(-1 1))
+(print input " -> " (fann:run ann input))
- (fann:save ann "/tmp/xor-test.net")
- (fann:destroy-train xor-train)
- (fann:destroy ann)
+(fann:save ann "/tmp/xor-test.net")
+(fann:destroy-train xor-train)
+(fann:destroy ann)
+```
Note that data is not fetched from file but from a list with the `fann:read-train-from-list` function.
Of course, you can still load data from files with `fann:read-train-from-file` as normal.

0 comments on commit 5a36fdd

Please sign in to comment.