Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

29
LINES

< > BotCompany Repo | #1023890 // "Coarse Procedures"

Document

1  
What are "Coarse Procedures"?
2  
-----------------------------
3  
4  
A "coarse procedure" is some rough, often handwritten code that solves a subset of a difficult or open-ended task.
5  
6  
Example:
7  
8  
  static String containsGazelle(String s) {
9  
    int dist = levenSubstringIC_limited(s, "gazelle", 2);
10  
    ret dist == 0 ? "yes" : dist == 1 ? "maybe" : "no";
11  
  }
12  
13  
This function detects whether the word "gazelle" or a slight misspelling occurs in a line.
14  
15  
For "hello gazelle", the function returns "yes". For "hello gazele", it returns "maybe"... and so on. It uses a variation of the Levenshtein distance algorithm.
16  
17  
This is of course not the final function that we actually want, which will be much smarter and adapt to more cases.
18  
19  
However, the coarse function is very useful anyway.
20  
21  
-We can use it right away
22  
-It is cheap to run
23  
-It is predictable, reliable and easy to understand
24  
-It will do what we want if the input is sufficiently well-formed
25  
-It gets an intention across
26  
-It can serve as a basis for an optimization algorithm that generates better code in its place
27  
...and more.
28  
29  
We can bootstrap an AI system with a bunch of coarse procedures and then proceed to optimize it, be it manually or automatically.

download  show line numbers   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023890
Snippet name: "Coarse Procedures"
Eternal ID of this version: #1023890/5
Text MD5: 577d2e8af502521238a1a99e425fbf5f
Author: stefan
Category: javax / a.i.
Type: Document
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-11 19:55:52
Source code size: 1233 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 495 / 115
Version history: 4 change(s)
Referenced in: [show references]