File tree Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Original file line number Diff line number Diff line change 1
- # TensorFlow.js Example: Training a baseball model in Node.js
1
+ # TensorFlow.js Example: Training a baseball model in Node.js
2
2
3
3
This demo demonstrates how to train a server-side model to classify baseball pitch types using [ Node.js] ( https://github.com/tensorflow/tfjs-node ) .
4
4
@@ -12,29 +12,39 @@ It has four parts:
12
12
13
13
14
14
## Running the Demo
15
- First, prepare the environment and download the baseball training and test data :
15
+ First, prepare the environment:
16
16
``` sh
17
- yarn && yarn download-data
17
+ $ npm install
18
+ # or
19
+ $ yarn
18
20
```
19
21
20
22
Next, start the client:
21
23
``` sh
22
- yarn start-client
24
+ $ npm run start-client
25
+ # or
26
+ $ yarn start-client
23
27
```
24
28
25
29
Open the client running at: http://localhost:8080/
26
30
27
31
In a new shell, start the server:
28
32
``` sh
29
- yarn start-server
33
+ $ npm run start-server
34
+ # or
35
+ $ yarn start-server
30
36
```
31
37
32
- If you are interested in testing out the training, without running a web server:
38
+ Two small scripts are provided to test training both of the baseball models without running the client/server demo:
39
+
40
+ * Pitch Type model:
33
41
``` sh
34
- yarn train-pitch-model
42
+ $ node train_pitch_type.js
35
43
```
44
+
45
+ * Strike Zone model:
36
46
``` sh
37
- yarn train-strike-model
47
+ $ node train_strike_zone.js
38
48
```
39
49
40
50
## Baseball Models
Original file line number Diff line number Diff line change 3
3
"version" : " 0.2.0" ,
4
4
"description" : " Deep learning models for classifying baseball metrics" ,
5
5
"scripts" : {
6
- "download-data" : " ./scripts/download-data.sh" ,
7
- "start-client" : " webpack-dev-server" ,
6
+ "start-client" : " webpack && webpack-dev-server" ,
8
7
"start-server" : " node server.js"
9
8
},
10
9
"license" : " Apache-2.0" ,
You can’t perform that action at this time.
0 commit comments