Amazing AlgorithmsFor Solving Problems in SoftwareBarry S. StahlPrincipal Engineer - AZNerds.net@bsstahl@cognitiveinheritance.comhttps://CognitiveInheritance.com |
|
Favorite Physicists
Other notables: Stephen Hawking, Edwin Hubble, Leonard Susskind, Christiaan Huygens |
Favorite Mathematicians
Other notables: Blaise Pascal, Daphne Koller, Grady Booch, Evelyn Berezin, Pascal Van Hentenryck |
|
|
|
|
|
The success of a problem-solving algorithm is often determined before the algorithm even runs -- by how the problem is modeled |
|
|
|
|
|
|
|
|
|
|
|
|
DetermineDistance(s,d)
|
|
|
|
Find the best strategy in a multi-player board game
|
|
|
|
|
Find Solutions by Simulating Darwinian Evolution
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note: For normalized vectors, cosine similarity is the same as the dot-product |
|
| Feature | Example |
|---|---|
| Synonym | "Happy" is closer to "Joyful" than to "Sad" |
| Language | "The Queen" is very close to "La Reina" |
| Idiom | "He kicked the bucket" is closer to "He died" than to "He kicked the ball" |
| Sarcasm | "Well, look who's on time" is closer to "Actually Late" than "Actually Early" |
| Homonym | "Bark" (dog sound) is closer to "Howl" than to "Bark" (tree layer) |
| Collocation | "Fast food" is closer to "Junk food" than to "Fast car" |
| Proverb | "The early bird catches the worm" is closer to "Success comes to those who prepare well and put in effort" than to "A bird in the hand is worth two in the bush" |
| Metaphor | "Time is money" is closer to "Don't waste your time" than to "Time flies" |
| Simile | "He is as brave as a lion" is closer to "He is very courageous" than to "He is a lion" |
Find distant embeddings
|
|
|
|
|
What should change to find words distant from the current
|
|
|
You are a simulation of a great linguist. You classify words/phrases within the following categories:
You identify words/phrases that meet the requested characteristics. |
|
|
Give me a word or phrase with the following characteristics:
and is not in the following list: "prime genius", "engineer a cooperative symbiosis". Be sure to only respond with the selected word or phrase, no ceremony. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialize n fireflies to random positions
loop maxEpochs times
for each firefly i
for each firefly j
if intensity(i) < intensity(j)
compute attractiveness
move firefly(i) toward firefly(j)
update firefly(i) intensity
end for
end for
sort fireflies
end loop
return best position found
initialize the amoeba with n (size) locations
loop maxEpochs times
calculate new possible solutions
contracted - midway between centroid and worst
reflected - contracted point reflected across centroid
expanded - beyond reflected point by a constant factor
if any solution is better than the current
replace worst value with best value from new solution
else
shrink (multiple contract) all lesser nodes toward the best
increment epoch count
end loop
return best position found
|
|
|
|
|
|
|
|
The weight (m) often has a greater effect on the error than the bias (b) |
|
|
|
|
...we've invented a fantastic array of tricks and gimmicks for putting together the numbers, without actually doing it. We don't actually [apply \(Y = mX + b\) for every neuron] We do it by the tricks of mathematics, and that's all. So, we're not going to worry about that. You don't have to know about [Linear Algebra]. All you have to know is what it is, tricky ways of doing something which would be laborious otherwise.
With apologies to Professor Feynman, who was talking about the tricks of Calculus as applied to Physics, not the tricks of Linear Algebra as applied to Machine Learning.
Predict the unknown values in a linear equation
|
|
|
|
Understand the Problem Deeply
Clarify inputs, outputs, constraints, and goals
Is optimality required? Can constraints be relaxed?
Identify if it can be broken into reusable parts?
Classify the Problem Type
Search? Optimization? Graph traversal? Dynamic programming candidate?
Are brute-force or exponential-time solutions feasible?
What tools do we have that can help? Can we buy vs build?
Implement and Test
Try a naive solution 1st
Use test cases to validate correctness and performance
Optimize as needed / Start over if necessary
|
|
|
|
Would you like to try to model a problem from one of your domains? |
Linear Programming (LP) & Mixed-Integer Programming (MIP)
|
|
|
|
|
George Dantzig - Creator of the Simplex Algorithm