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

29
LINES

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

Document

What are "Coarse Procedures"?
-----------------------------

A "coarse procedure" is some rough, often handwritten code that solves a subset of a difficult or open-ended task.

Example:

  static String containsGazelle(String s) {
    int dist = levenSubstringIC_limited(s, "gazelle", 2);
    ret dist == 0 ? "yes" : dist == 1 ? "maybe" : "no";
  }

This function detects whether the word "gazelle" or a slight misspelling occurs in a line.

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.

This is of course not the final function that we actually want, which will be much smarter and adapt to more cases.

However, the coarse function is very useful anyway.

-We can use it right away
-It is cheap to run
-It is predictable, reliable and easy to understand
-It will do what we want if the input is sufficiently well-formed
-It gets an intention across
-It can serve as a basis for an optimization algorithm that generates better code in its place
...and more.

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: 493 / 115
Version history: 4 change(s)
Referenced in: [show references]