Re: Pydantic - Type Hints For Validating Data

2023-04-15 Thread David Szent-Györgyi
It does sound interesting. It even supports "custom" (user-defined) types. 

A plug-in for Pydantic supports Hypothesis 
, «a Python library for 
creating unit tests which are simpler to write and more powerful when run, 
finding edge cases in your code you wouldn’t have thought to look for. It 
is stable, powerful and easy to add to any existing test suite. It works by 
letting you write tests that assert that something should be true for every 
case, not just the ones you happen to think of.»

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/252da855-1da7-4a7a-b7c2-24e3fe4f5ed1n%40googlegroups.com.


Re: Example of me using chatGPT

2023-04-15 Thread Thomas Passin
For one thing, these vectors are very sparse - most elements are empty.  I 
don't know how sparse vectors and matrices are handled by people who know 
what they are doing, but for playing around a little I used dictionaries.

On Saturday, April 15, 2023 at 9:54:08 AM UTC-4 Edward K. Ream wrote:

> On Sat, Apr 15, 2023 at 8:00 AM Thomas Passin  wrote:
>
> I have some reservations about using cosine similarity with vectors like 
>> this.
>>
>
> Good study question. It seems the authors are not concerned, presumably 
> for good reasons.
>
> A related question. What goes into the 10,000 element vectors ;-)
>
> Edward
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/dc5e5525-bb5f-4f64-a3ac-000eb0324fedn%40googlegroups.com.


Re: Example of me using chatGPT

2023-04-15 Thread Edward K. Ream
On Sat, Apr 15, 2023 at 8:00 AM Thomas Passin  wrote:

I have some reservations about using cosine similarity with vectors like
> this.
>

Good study question. It seems the authors are not concerned, presumably for
good reasons.

A related question. What goes into the 10,000 element vectors ;-)

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS3rWv5hPw0ZqBwwc7bhZ39XjLDZ%2BRfUgTqafsTchh70Zw%40mail.gmail.com.


Re: Example of me using chatGPT

2023-04-15 Thread Thomas Passin
Very interesting!  I just started reading the home page link.  I was struck 
by this statement:

" HD/VSA addresses these challenges by providing a binding operator 
associating individual (John, Mary) with roles 
 (AGENT, PATIENT) and a 
superposition  operator 
that allows multiple associations to be composed into a coherent whole."

The Topic Maps model for organizing knowledge has *topics *- a topic is 
anything that can be talked about - and *relationships*.  A relationship 
type has a number of *roles*, and those roles are filled by topics. It 
sounds very similar, at a basic level.  A Topic Maps relationship would be 
the equivalent of the HD/VSA binding operator.

I have some reservations about using cosine similarity with vectors like 
this.  I have experimented with them a little, not in the area of AI but 
for answering queries in a certain space of questions and knowledge.  The 
trouble is that the components of a vector are not often orthogonal, so the 
simple ways to compute their projections are not valid.  You can crank out 
the results, but they will not be correct, to a degree that depends on the 
other vector involved.  I will be interested to learn how these 
investigators handle this.

As an example of what I mean, consider a vector of words, and you want to 
know how similar it is to another vector of words.  A simpleminded approach 
make each word into a vector component.  So here are two sentences:

"Which comes first, the chicken or the egg"
"Evolutionarily speaking a bird can be considered to be the reason for an 
egg"

Now make vectors of these two sentences, where every word is on its own 
axis.  You take the cosine by multiplying the value of each component in 
one vector by  the value of the same component in the other vector.  Each 
component here has a value of 0 or 1 (since the word is either present or 
not).  The only components that  match are "the" and "egg".  So the score - 
the cosine - will be very low.  However, we can see that the two sentences 
are actually very similar in meaning.

And how can we determine how orthogonal  a bird is to a chicken?

So this approach is too simple.  It will be interesting to see what these 
folks are really doing.  Personally, I expect that an approach using fuzzy 
logic would be promising.   It would be similar to using cosines to project 
one vector onto another, but with fuzzy operators instead of 
multiplication.  Why fuzzy logic?  Because it matches how people (and no 
doubt animals) actually assess things in the real world.  How you you judge 
how tall a person is?  You don't divide up the arithmetic range into spans 
- 5 ft to 5'2", 5'2" - 5'4", etc. (sorry, non-US units people) and see 
which bin the person falls into.  No, you have a notion of what "tall", 
"medium", "short" and "very short" mean, and you see how well the person 
*matches* each of them.  So the person might be "somewhat tall but not far 
from medium".

On Saturday, April 15, 2023 at 6:35:02 AM UTC-4 Edward K. Ream wrote:

> On Saturday, April 15, 2023 at 5:31:41 AM UTC-5 Edward K. Ream wrote:
>
> The article describes NVSA: Neuro-vector-symbolic Architecture. Googling 
> this term found the home page for (HD/VSA) Vector Symbolic Architecture 
> . This must be one of the 
> best home pages ever written!
>
>
> I recommend following *all* the links on this page. Most links point to 
> Wikipedia pages for *easy* math concepts. I bookmarked many of these 
> links.
>
> Edward
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/c3001d84-fca2-482f-8022-e8c6db3e54dfn%40googlegroups.com.


Re: Example of me using chatGPT

2023-04-15 Thread Edward K. Ream
On Saturday, April 15, 2023 at 5:31:41 AM UTC-5 Edward K. Ream wrote:

The article describes NVSA: Neuro-vector-symbolic Architecture. Googling 
this term found the home page for (HD/VSA) Vector Symbolic Architecture 
. This must be one of the 
best home pages ever written!


I recommend following *all* the links on this page. Most links point to 
Wikipedia pages for *easy* math concepts. I bookmarked many of these links.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/bf831c1a-a7c9-4eb3-9660-7b40115a87bcn%40googlegroups.com.


Re: Example of me using chatGPT

2023-04-15 Thread Edward K. Ream
On Fri, Apr 14, 2023 at 8:10 PM Félix  wrote:

Perhaps the years ahead will lead to other neuronal system architectures
> that will complement the "textual-generation-prediction" ones that are
> actually in vogue.
>

A new architecture is already here! I was going to write this up in another
thread, but I might as well reply here:-)

- Starting point: This article

in Quanta magazine.
- The solve a classic problem
 link in the article
leads to a paywalled article in Nature.
  However, googling shows there is an arxiv preprint
 for free.

Important: the "classic problem" is *not* a math problem, but a psych test
called Raven's Progressive Matrices
.

I have been studying this preprint closely. The article describes NVSA:
Neuro-vector-symbolic Architecture. Googling this term found the home page
for (HD/VSA) Vector Symbolic Architecture
. This must be one of the
best home pages ever written!

The preprint proposes an architecture whose front end involves *perception *and
whose back end involves *reasoning*. Here is an excerpt from the summary:

"The efficacy of NVSA is demonstrated by solving the Raven’s progressive
matrices datasets...end-to-end training of NVSA achieves a new record of
87.7% average accuracy in RAVEN, and 88.1% in I-RAVEN datasets. Moreover,
...[our method] is two orders of magnitude faster [than existing
state-of-the art]. Our code is available at
https://github.com/IBM/neuro-vector-symbolic-architectures.;

This GitHub repo contains nothing but Python code. Naturally I imported
them into Leo. leo-editor-contrib now contains nvsa.leo

.

As expected, the code's math consists *entirely *of matrix operations using
the torch and numpy libs. The only "if" statements involve handling user
options. There are a few "for" loops. I don't know how those loops affect
performance.

*Summary of the ideas*

Here is my summary of my present study, taken mainly from the HD/VSA page:

The math is unbelievably simple. Anybody who knows high school algebra will
likely understand. *All* data are vectors in a high-dimensional space.  n =
10,000 dimensions is typical. The natural distance between two vectors
is cosine
similarity , the
n-dimensional analog of the cosine. In other words, the *distance *between
vectors is taken to be the *angle *between the vectors.

Here's the kicker. Almost all vectors in this high-dimensional space
are *almost
orthogonal*. The converse is extremely useful. Queries are *very simple*
compositions of vectors. These queries contain "cruft", but this cruft
doesn't matter. The query is close to equal to the desired answer! These
vectors remind me of git's hashes. "Vector collisions" never happen in a
high-dimensional space!

Furthermore, with a clever design of the *contents* of the vectors, *queries
are bi-directional*!! Given the results of a query, it's trivial to find
what vectors were involved in the original query.

*Summary*

The advantages of nvsa:

- Integration of perception (front end) with reasoning (back end).
  I don't yet understand the details.
- No searching required!
- No back propagation needed for training!
- Full transparency of reasoning in the back end.
- Dead simple math, supported by far-from-dead-simple theory.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS3izj8JqJUWSpcOxFze9o0Eg5sJWxoARC_2-hPpk7nKgw%40mail.gmail.com.