Skip to content

Commit c93d0be

Browse files
authored
Added machine teaching (microsoft#91)
* Added Readme files * Added BRAINS
1 parent f91c75b commit c93d0be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+116513
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Microsoft
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Motion Calibration Demo
2+
CNC machines cut metal with spinning tools. Friction reduces precision and periodically demands recalibration. An expert operator must travel to calibrate the machine, repeatedly turn the knobs and take measurements until the machine regains precision.
3+
4+
## LOCAL (CLI) GUIDE
5+
6+
### CLI INSTALLATION
7+
1. Install the Bonsai CLI by following our [detailed CLI installation guide](https://docs.bons.ai/guides/cli-install-guide.html)
8+
9+
### CREATE YOUR BRAIN
10+
1. Setup your BRAIN's local project folder.
11+
`bonsai create <your_brain_name>`
12+
2. Run this command to install additional requirements for training your BRAIN.
13+
`pip3 install -r requirements.txt`
14+
15+
16+
### HOW TO TRAIN YOUR BRAIN
17+
1. Upload Inkling and simulation files to the Bonsai server with one command.
18+
`bonsai push`
19+
2. Run this command to start training mode for your BRAIN.
20+
`bonsai train start`
21+
If you want to run this remotely on the Bonsai server use the `--remote` option.
22+
`bonsai train start --remote`
23+
3. Connect the simulator for training.
24+
`python3 cnc_simulator.py` or `python cnc_simulator.py`
25+
4. When training has hit a sufficient accuracy for prediction, which is dependent on your project, stop training your BRAIN.
26+
`bonsai train stop`
27+
28+
### GET PREDICTIONS
29+
1. Run the simulator using predictions from your BRAIN. You can now see AI in action!
30+
`python cnc_simulator.py --predict`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"training": {"command": "python3 cnc_simulator.py", "simulator": "bonsai.ai"}, "files": ["*.ink", "*.py", "*.csv", "LICENSE", "README.md", "requirements.txt"]}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
schema CNCState
2+
Float32 error,
3+
Float32 time
4+
end
5+
6+
schema CNCAction
7+
Float32{0:1} calibration_adjustment
8+
end
9+
10+
schema CNCConfig
11+
Float32 motor_alignment,
12+
Float32 bit_alignment,
13+
Float32 slider_alignment
14+
end
15+
16+
concept machine_calibrator is estimator
17+
predicts (CNCAction)
18+
follows input(CNCState)
19+
feeds output
20+
end
21+
22+
simulator cnc_simulator(CNCConfig)
23+
action (CNCAction)
24+
state (CNCState)
25+
end
26+
27+
curriculum my_curriculum
28+
train machine_calibrator
29+
using algorithm TRPO
30+
with simulator cnc_simulator
31+
objective speed_and_accuracy
32+
lesson my_first_lesson
33+
configure
34+
constrain motor_alignment with Float32{5.0:20.0},
35+
constrain bit_alignment with Float32{5.0:20.0},
36+
constrain slider_alignment with Float32{5.0:20.0}
37+
until
38+
maximize speed_and_accuracy
39+
end

0 commit comments

Comments
 (0)