-
Notifications
You must be signed in to change notification settings - Fork 0
/
learn
executable file
·62 lines (55 loc) · 1.33 KB
/
learn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env coffee
coeffs_to_weights = require('./coeffs_to_weights.coffee')
{ N_PHASES } = require './pattern'
defaults = require('./learn.coffee').defaults
opt = require 'yargs'
.options
l:
alias: 'logistic'
desc: 'Logistic regression'
type: 'boolean'
default: false
b:
alias: 'book'
desc: 'Database file'
type: 'string'
default: defaults.book
requiresArg: true
l2:
desc: 'L2 regularization parameter'
type: 'number'
default: defaults.l2
requiresArg: true
e:
alias: 'epochs'
desc: 'Number of epochs'
type: 'number'
default: defaults.epochs
requiresArg: true
batch_size:
desc: 'Number of samples per batch (default auto)'
type: 'number'
default: defaults.batch_size
requiresArg: true
o:
alias: 'outfile'
desc: 'Output weights file'
type: 'string'
default: 'weights.json'
requiresArg: true
l2file:
desc: 'L2 regularization parameter file'
default: 'auto'
requiresArg: true
h:
alias: 'help'
.version false
.strict()
.argv
{ load_samples, learn } = require('./learn.coffee')(opt)
results = []
results =
for phase in [0...N_PHASES]
load_samples phase
learn phase
coeffs_to_weights outfile: opt.outfile, array: results